]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-35936: Updates to modulefinder (GH-11787)
authorBrandt Bucher <brandtbucher@gmail.com>
Sun, 7 Apr 2019 08:00:41 +0000 (01:00 -0700)
committerNick Coghlan <ncoghlan@gmail.com>
Sun, 7 Apr 2019 08:00:41 +0000 (18:00 +1000)
commit9d7b2c0909b78800d1376fd696f73824ea680463
tree6e5f5f855d527c6429ea3c3cb20b70818489033f
parent2dad96013ca24abdc5ba5a369ea42d70ff02487a
bpo-35936: Updates to modulefinder (GH-11787)

* Properly handle SyntaxErrors in Python source files.

SyntaxErrors in the target module will rise normally, while SyntaxErrors in dependencies will be added to badmodules. This includes a new regression test.

* Fix name collision bug.

This fixes an issue where a "fromlist" import with the same name as a previously failed import would be incorrectly added to badmodules. This includes a new regression test.

* Replace mutable default values.

Bound empty lists have been replaced with the "if param is None" idiom.

* Replace deprecated imp usage.

Constants imported from imp have been moved to private module-level constants, and ModuleFinder.find_module has been refactored to use importlib. Other than an improvement on how frozen builtin imports are reported (as the frozen imports they are, rather than the stdlib modules they *may* have originated from), these changes maintain complete compatibility with past versions... including odd behavior for returning relative (below current directory, but not a C extension) vs. absolute (above current directory, or a C extension) paths.

Patch by Brandt Bucher.
Lib/modulefinder.py
Lib/test/test_modulefinder.py
Misc/ACKS
Misc/NEWS.d/next/Library/2019-02-13-18-56-22.bpo-17396.oKRkrD.rst [new file with mode: 0644]
Misc/NEWS.d/next/Library/2019-02-13-18-56-27.bpo-35376.UFhYLj.rst [new file with mode: 0644]
Misc/NEWS.d/next/Library/2019-02-16-22-19-32.bpo-35936.Ay5WtD.rst [new file with mode: 0644]