]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Fix collections ABC access before Python 3.8
authorNathaniel Knight <nknight@cfenet.ubc.ca>
Wed, 1 Aug 2018 01:59:47 +0000 (21:59 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Wed, 1 Aug 2018 16:30:29 +0000 (12:30 -0400)
commit4580f942fb851963ce09a05a0c3e6ad6b861ed7d
tree52b46e9baf6743377030312ff4edde99c63931ea
parent5cad77a87bbfc98999454ab5314a47895d5beded
Fix collections ABC access before Python 3.8

Started importing "collections" from "collections.abc" under Python 3.3 and
greater for Python 3.8 compatibility.  Pull request courtesy Nathaniel
Knight.

In Python 3.3, the abstract base classes (Iterable, Mapping, etc.)
were moved from the `collections` module and put in the
`collections.abc` module. They remain in the `collections` module for
backwards compatibility, and will until Python 3.8.

This commit adds a variable (`collections_abc`) to the `util/compat`
module, which will be the `collections` module for Python < 3.3 and
before, or the `collections.abc` module for Python >= 3.3. It also
uses the new variable, getting rid of some deprecation warnings that
were seen when running under Python 3.7.

Change-Id: I2d1c0ef97c8ecac7af152cc56263422a40faa6bb
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/464
(cherry picked from commit a59c3b8f302a34ab037ec445b7452b1f353b91af)
doc/build/changelog/unreleased_12/pr464.rst [new file with mode: 0644]
lib/sqlalchemy/util/__init__.py
lib/sqlalchemy/util/_collections.py
lib/sqlalchemy/util/compat.py
test/sql/test_operators.py