Repository navigation
Fixes for Python 3.7 #7617
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
Fixes for Python 3.7 #7617
Changes from 6 commits
2d61303
75e39a8
204aa73
a6e2c15
8eee26b
e35668b
dd353b1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,7 +7,7 @@ | |
| """ | ||
|
|
||
|
|
||
| import collections | ||
| import collections.abc | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can't have this for the 2.0.x backport. I'll remove this change from the backport, but anyway, expect that it won't cause any roubles given the last commit of the PR.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, the warning is filtered for lxml, so should be fine. |
||
| import itertools | ||
| import operator | ||
|
|
||
|
|
@@ -95,10 +95,10 @@ def sortmore(*args, **kw): | |
| if globalkey is None: | ||
| globalkey = lambda *x: 0 | ||
|
|
||
| if not isinstance(globalkey, collections.Callable): | ||
| if not isinstance(globalkey, collections.abc.Callable): | ||
| raise ValueError('globalkey needs to be callable') | ||
|
|
||
| if isinstance(key, collections.Callable): | ||
| if isinstance(key, collections.abc.Callable): | ||
| k = lambda x: (globalkey(*x), key(x[0])) | ||
| elif isinstance(key, tuple): | ||
| key = (k if k else lambda x: 0 for k in key) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -157,7 +157,24 @@ def __exit__(self, *exc_info): | |
| # https://github.com/astropy/astropy/pull/7372 | ||
| r"Importing from numpy\.testing\.decorators is deprecated, import from numpy\.testing instead\.", | ||
| # Deprecation warnings ahead of pytest 4.x | ||
| r"MarkInfo objects are deprecated"])} | ||
| r"MarkInfo objects are deprecated"]), | ||
| (3, 7): set([ | ||
| # py.test reads files with the 'U' flag, which is | ||
| # deprecated. | ||
| r"'U' mode is deprecated", | ||
| # inspect raises this slightly different warning on Python 3.6. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this be |
||
| # Keeping it since e.g. lxml as of 3.8.0 is still calling getargspec() | ||
| r"inspect\.getargspec\(\) is deprecated, use " | ||
| r"inspect\.signature\(\) or inspect\.getfullargspec\(\)", | ||
| # https://github.com/astropy/astropy/pull/7372 | ||
| r"Importing from numpy\.testing\.decorators is deprecated, import from numpy\.testing instead\.", | ||
| # Deprecation warnings ahead of pytest 4.x | ||
| r"MarkInfo objects are deprecated", | ||
| # Deprecation warning for collections.abc, fixed in Astropy but still | ||
| # used in lxml, and maybe others | ||
| r"Using or importing the ABCs from 'collections'", | ||
| ]), | ||
| } | ||
|
|
||
|
|
||
| def enable_deprecations_as_exceptions(include_astropy_deprecations=True, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Must admit I find this auto-cleanup bad form, but that's somewhat out of scope of this PR!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really a cleanup, I had to change the use of
__dir__to list the attributes that shall not be deleted because setting a list to__dir__no more works.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@saimn - I meant that I found the whole stanza rather bad form, not your change to it! It just seems that by being a bit more careful in the code itself, one can avoid introducing these unwanted things in the namespace (or delete them after their use). Anyway, as said, definitely out of scope here!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mhvk - Ah ok! I agree with you, we could find a simpler way to keep the namespace clean.