Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix collections.abc import for Python 3.10 #142

Merged
merged 1 commit into from
May 7, 2021

Conversation

hugovk
Copy link
Contributor

@hugovk hugovk commented Jan 20, 2020

Since Python 3.3, MutableMapping has been available in collections.abc.

Since Python 3.9, MutableMapping is only available in collections.abc.

Python 3.9.0a2+ (heads/master:ec007cb, Jan  5 2020, 12:34:22)
[Clang 10.0.1 (clang-1001.0.46.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import collections
>>> collections.MutableMapping
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'collections' has no attribute 'MutableMapping'
>>> collections.abc.MutableMapping
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'collections' has no attribute 'abc'
>>> import collections.abc
>>> collections.abc.MutableMapping
<class 'collections.abc.MutableMapping'>
>>>

Python 3.9 is in alpha with full release due in October.

Fedora are already making early builds for 3.9 and found this problem: https://bugzilla.redhat.com/show_bug.cgi?id=1792029.

@hugovk hugovk changed the title Fix collections.abc import for Python 3.9 Fix collections.abc import for Python 3.10 Dec 12, 2020
@hugovk
Copy link
Contributor Author

hugovk commented Dec 12, 2020

Updated title because they postponed this breaking change to Python 3.10 (due out October 2021):

Python 3.9.1 (v3.9.1:1e5d33e9b9, Dec  7 2020, 12:10:52)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import collections
>>> collections.MutableMapping
<stdin>:1: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.10 it will stop working
<class 'collections.abc.MutableMapping'>
>>> collections.abc.MutableMapping
<class 'collections.abc.MutableMapping'>
>>>

Base automatically changed from master to main February 15, 2021 19:18
@hugovk
Copy link
Contributor Author

hugovk commented May 5, 2021

Rebased on main.

Python 3.10 is now in beta and has an error. 3.10.0 final is due out on 2021-10-04.

Python 3.9

$ python3.9 -c "import collections; collections.MutableMapping"
<string>:1: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.10 it will stop working

Python 3.10

$ python3.10 -c "import collections; collections.MutableMapping"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
AttributeError: module 'collections' has no attribute 'MutableMapping'

@behdad
Copy link
Contributor

behdad commented May 5, 2021

I don't know if we still support older Python or what. @anthrotype?

@anthrotype
Copy link
Member

Sorry I had missed this one. We support Python 3.6 and above

LGTM

@behdad behdad merged commit 1ddd841 into googlefonts:main May 7, 2021
@hugovk hugovk deleted the fix-py39 branch May 7, 2021 19:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants