diff options
author | Jason Kirtland <jek@discorporate.us> | 2008-11-10 22:56:22 +0000 |
---|---|---|
committer | Jason Kirtland <jek@discorporate.us> | 2008-11-10 22:56:22 +0000 |
commit | d403d8b865884b05169c7d56d0545e84088ba8a4 (patch) | |
tree | ab9d24ac7d9bef9744a800bc58c1148417dda62f /lib/sqlalchemy/util.py | |
parent | ea12a628e46783e255f5ae6068a24f29fe784d05 (diff) | |
download | sqlalchemy-d403d8b865884b05169c7d56d0545e84088ba8a4.tar.gz |
Quashed import sets deprecation warning on 2.6.. not wild about this but it seems like it will be ok. [ticket:1209]
Diffstat (limited to 'lib/sqlalchemy/util.py')
-rw-r--r-- | lib/sqlalchemy/util.py | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/lib/sqlalchemy/util.py b/lib/sqlalchemy/util.py index f2f2cdd79..297dd738f 100644 --- a/lib/sqlalchemy/util.py +++ b/lib/sqlalchemy/util.py @@ -4,7 +4,7 @@ # This module is part of SQLAlchemy and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php -import inspect, itertools, new, operator, sets, sys, warnings, weakref +import inspect, itertools, new, operator, sys, warnings, weakref import __builtin__ types = __import__('types') @@ -18,8 +18,20 @@ except ImportError: import dummy_threading as threading from dummy_threading import local as ThreadLocal -# TODO: 2.6 will whine about importing `sets`, but I think we still need it to -# around to support older DB-API modules that return the 2.3 style set. +if sys.version_info < (2, 6): + import sets +else: + # 2.6 deprecates sets.Set, but we still need to be able to detect them + # in user code and as return values from DB-APIs + ignore = ('ignore', None, DeprecationWarning, None, 0) + try: + warnings.filters.insert(0, ignore) + except Exception: + import sets + else: + import sets + warnings.filters.remove(ignore) + set_types = set, sets.Set EMPTY_SET = frozenset() |