Skip to content

Avoid reloading builtin types module. - #10318

Merged
takluyver merged 1 commit into
ipython:masterfrom
Carreau:prevent-reload-types
Feb 22, 2017
Merged

takluyver merged 1 commit into
ipython:masterfrom
Carreau:prevent-reload-types

Conversation

@Carreau

@Carreau Carreau commented Feb 21, 2017

Copy link
Copy Markdown
Member

Closes #10235

@Carreau Carreau added this to the 6.0 milestone Feb 21, 2017
Comment thread IPython/lib/deepreload.py
# bowels of Python and screw up the import machinery after.
# unlike other imports the `exclude` list aleady in place is not enough.

if m is types:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bit disturbing that the exclude list doesn't work for this.

I'd like to find a way to exclude all standard library modules from deepreload(), but I don't know of a good way to check if something's in the stdlib.

Maybe the rule should be 'anything that IPython uses' - i.e. anything that's in sys.modules before user code runs. It's possibly tricky to do that now that we don't load deepreload on start.

@Carreau

Carreau commented Feb 22, 2017

Copy link
Copy Markdown
Member Author

I'd like to find a way to exclude all standard library modules from deepreload(), but I don't know of a good way to check if something's in the stdlib.

There isn't. And AFAICT Core python does not see any interest in doing it. We could check early-python-modules that have the specific file _bootstrap_external_something.

I've looked as to where the NotImplementedError but that's too far down in CPython, I I don't understand the real reason why it hits this spot. And exclude does not work, because it work on module names, and the current code fails when trying to get the modulename (via find_spec), so it does not have a chance to exclude it...

I honestly think it might be a Bug in CPython itself. But it would be nice to even have a band-aid potentially opening an issue to investigate later.

@takluyver
takluyver merged commit 030ba7a into ipython:master Feb 22, 2017
@Carreau
Carreau deleted the prevent-reload-types branch May 7, 2017 05:21
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.

2 participants