]> 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:09 +0000 (12:30 -0400)
commita51b0528d3dca59e655e4d19b50bb271015f8196
tree5a50c4981c5dbd71e4a0a4cbde252b8571d4f180
parent1c32206120b1a6555f8bb7a20a0c4c53ea2f52a8
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
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