]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- [bug] Fixed inappropriate usage of util.py3k
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 15 Dec 2011 15:31:55 +0000 (10:31 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 15 Dec 2011 15:31:55 +0000 (10:31 -0500)
flag and renamed it to util.py3k_warning, since
this flag is intended to detect the -3 flag
series of import restrictions only.
[ticket:2348]

CHANGES
lib/sqlalchemy/orm/collections.py
lib/sqlalchemy/util/__init__.py
lib/sqlalchemy/util/compat.py
lib/sqlalchemy/util/langhelpers.py
test/lib/testing.py

diff --git a/CHANGES b/CHANGES
index 2b4959e9079ad33bc28835e651f802c0bef5c20a..f5540e1e0f1807c2d8ecb37f04fa3c79c9f9dc90 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -9,6 +9,13 @@ CHANGES
   - [bug] Fixed bug whereby hybrid_property didn't 
     work as a kw arg in any(), has().
 
+- Py3K
+  - [bug] Fixed inappropriate usage of util.py3k
+    flag and renamed it to util.py3k_warning, since 
+    this flag is intended to detect the -3 flag
+    series of import restrictions only.
+    [ticket:2348]
+
 0.7.4
 =====
 - orm
index d605d849bc3a3362aa9a0c7b6a8a08cb6b89d396..7c82f3735097a0dd1b6c85f8117337f77bcdf44e 100644 (file)
@@ -1166,7 +1166,7 @@ def _dict_decorators():
     l.pop('Unspecified')
     return l
 
-if util.py3k:
+if util.py3k_warning:
     _set_binop_bases = (set, frozenset)
 else:
     import sets
index c78cddf778924f2c3e57fe12a1abef1fc2a37672..d1a72eaf249bcdcb08fbe7f9ca4fa231444674eb 100644 (file)
@@ -5,7 +5,7 @@
 # the MIT License: http://www.opensource.org/licenses/mit-license.php
 
 from compat import callable, cmp, reduce, defaultdict, py25_dict, \
-    threading, py3k, jython, pypy, win32, set_types, buffer, pickle, \
+    threading, py3k_warning, jython, pypy, win32, set_types, buffer, pickle, \
     update_wrapper, partial, md5_hex, decode_slice, dottedgetter,\
     parse_qsl
 
index 380e3a9a596472b8e037d1022c26582bc84db95b..18549c8b9faad6ef727e288d176076cb10b04c2c 100644 (file)
@@ -18,12 +18,12 @@ except ImportError:
     import dummy_threading as threading
 
 py32 = sys.version_info >= (3, 2)
-py3k = getattr(sys, 'py3kwarning', False) or sys.version_info >= (3, 0)
+py3k_warning = getattr(sys, 'py3kwarning', False) or sys.version_info >= (3, 0)
 jython = sys.platform.startswith('java')
 pypy = hasattr(sys, 'pypy_version_info')
 win32 = sys.platform.startswith('win')
 
-if py3k:
+if py3k_warning:
     set_types = set
 elif sys.version_info < (2, 6):
     import sets
@@ -43,7 +43,7 @@ else:
 
     set_types = set, sets.Set
 
-if py3k:
+if py3k_warning:
     import pickle
 else:
     try:
@@ -89,12 +89,13 @@ if sys.version_info < (2, 6):
 else:
     from urlparse import parse_qsl
 
-if py3k:
-    from inspect import getfullargspec as inspect_getfullargspec
-else:
-    from inspect import getargspec as inspect_getfullargspec
+# Py3K
+#from inspect import getfullargspec as inspect_getfullargspec
+# Py2K
+from inspect import getargspec as inspect_getfullargspec
+# end Py2K
 
-if py3k:
+if py3k_warning:
     # they're bringing it back in 3.2.  brilliant !
     def callable(fn):
         return hasattr(fn, '__call__')
index 722003796d7b777d376d46763402fb71ebc7ec18..f10ab3fb59f2449b0e72bbaf9e4ea0ac2523d2ee 100644 (file)
@@ -15,7 +15,7 @@ import re
 import sys
 import types
 import warnings
-from compat import update_wrapper, set_types, threading, callable, inspect_getfullargspec, py3k
+from compat import update_wrapper, set_types, threading, callable, inspect_getfullargspec, py3k_warning
 from sqlalchemy import exc
 
 def _unique_symbols(used, *bases):
@@ -162,20 +162,21 @@ def format_argspec_plus(fn, grouped=True):
     else:
         self_arg = None
 
-    if py3k:
-        apply_pos = inspect.formatargspec(spec[0], spec[1], spec[2], None, spec[4])
-        num_defaults = 0
-        if spec[3]:
-            num_defaults += len(spec[3])
-        if spec[4]:
-            num_defaults += len(spec[4])
-        name_args = spec[0] + spec[4]
-    else:
-        apply_pos = inspect.formatargspec(spec[0], spec[1], spec[2])
-        num_defaults = 0
-        if spec[3]:
-            num_defaults += len(spec[3])
-        name_args = spec[0]
+    # Py3K
+    #apply_pos = inspect.formatargspec(spec[0], spec[1], spec[2], None, spec[4])
+    #num_defaults = 0
+    #if spec[3]:
+    #    num_defaults += len(spec[3])
+    #if spec[4]:
+    #    num_defaults += len(spec[4])
+    #name_args = spec[0] + spec[4]
+    # Py2K
+    apply_pos = inspect.formatargspec(spec[0], spec[1], spec[2])
+    num_defaults = 0
+    if spec[3]:
+        num_defaults += len(spec[3])
+    name_args = spec[0]
+    # end Py2K
 
     if num_defaults:
         defaulted_vals = name_args[0-num_defaults:]
index 90e8b7746d91dd636a5675868ad622da79dcfce2..53a277b9df887437b8b3983fbeac0e22d80d2dc9 100644 (file)
@@ -10,7 +10,7 @@ from cStringIO import StringIO
 
 from test.bootstrap import config
 from test.lib import assertsql, util as testutil
-from sqlalchemy.util import py3k, decorator
+from sqlalchemy.util import decorator
 from engines import drop_all_tables
 
 from sqlalchemy import exc as sa_exc, util, types as sqltypes, schema, \