Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

ImportFinder: Support find_spec interface#836

Merged
sebastinas merged 1 commit intobpython:masterfrom
tbabej:master
Jul 31, 2020
Merged

ImportFinder: Support find_spec interface#836
sebastinas merged 1 commit intobpython:masterfrom
tbabej:master

Conversation

@tbabej
Copy link
Contributor

The absence ofImportFinder wrapping thefind_spec method (introduced in Python 3.4), which is a successor to now deprecatedfind_module [0] cause one of the finder classes to not find the namespace package, as it is only detectable usingfind_spec

Implements backwards-compatible logic to supportfind_spec if present in the Finder being wrapped.

Closes#835.

[0]https://docs.python.org/3/library/importlib.html#importlib.abc.MetaPathFinder.find_spec

ebr reacted with thumbs up emoji
@sebastinassebastinas merged commita453c02 intobpython:masterJul 31, 2020
@sebastinas
Copy link
Contributor

@tbabej Looks like that didn't cover all of it:

bpython version 0.20.dev10 on top of Python 3.8.5 /usr/bin/python3             Traceback (most recent call last):                                               File "<input>", line 1, in <module>                                              from bpython.curtsiesfrontend._internal import _Helper                    File "<frozen importlib._bootstrap>", line 991, in _find_and_load  File "<frozen importlib._bootstrap>", line 971, in _find_and_load_unlocked                                                                                     File "<frozen importlib._bootstrap>", line 914, in _find_spec    File "/home/sebastian/development/bpython/bpython/curtsiesfrontend/repl.py", line 299, in find_spec    spec.__loader__ = ImportLoader(self.watcher, spec.__loader__)              AttributeError: 'ModuleSpec' object has no attribute '__loader__'              Traceback (most recent call last):                                               File "<input>", line 1, in <module>                                              help = _Helper(_repl)            NameError: name '_Helper' is not defined

I've now changed it inafc28c3 to only replace__loader__ if defined and notNone. Do you think that this makes sense?

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

bpython shell cannot import python namespace packages

2 participants

@tbabej@sebastinas

[8]ページ先頭

©2009-2026 Movatter.jp