Skip to content

Make autoreload extension work on Python 3.#1289

Merged
takluyver merged 2 commits into
ipython:masterfrom
takluyver:autoreload-py3
Jan 20, 2012
Merged

Make autoreload extension work on Python 3.#1289
takluyver merged 2 commits into
ipython:masterfrom
takluyver:autoreload-py3

Conversation

@takluyver
Copy link
Copy Markdown
Member

Some changes for Python 3 in general, and some changes for the .pyc repository directories introduced in Python 3.2 (PEP 3147)

Closes gh-846

Some changes for Python 3 in general, and some changes for the .pyc repository
directories introduced in Python 3.2 (PEP 3147)

Closes ipythongh-846
Comment thread IPython/extensions/autoreload.py Outdated
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think this check is now superfluous, but I'd like someone else to look at it before I remove it. source_from_cache raises ValueError unless the extension is .pyc or .pyo.

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.

Removing it looks clean to me.

@fperez
Copy link
Copy Markdown
Member

fperez commented Jan 20, 2012

Looks good, go ahead and merge after removing that try/except if you want. Thanks!

@takluyver
Copy link
Copy Markdown
Member Author

Sorry, I meant the if ext != PY_COMPILED_EXT check, not the try/except. The try/except is essential, as I spent a while working out.

@fperez
Copy link
Copy Markdown
Member

fperez commented Jan 20, 2012

Ah, OK. Actually, I imagine if you are running from a read-only filesystem with only sources (.py) installed, ext could be .py, no? That would justify keeping that if ext != PY_COMPILED_EXT check, it seems to me.

@takluyver
Copy link
Copy Markdown
Member Author

if ext is .py, it gets set to PY_COMPILED_EXT a few lines above.

The only way I think it could now be called is if we somehow end up with a .pyo filename in a normal process, or a .pyc in an optimised one. And if that did happen, I don't think it would need to be skipped, anyway.

@fperez
Copy link
Copy Markdown
Member

fperez commented Jan 20, 2012

OK, then go ahead with the removal and merge. Thanks!

takluyver added a commit that referenced this pull request Jan 20, 2012
Make autoreload extension work on Python 3.
@takluyver takluyver merged commit 3472072 into ipython:master Jan 20, 2012
mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this pull request Nov 3, 2014
Make autoreload extension work on Python 3.
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.

Autoreload extension doesn't work with Python 3.2

2 participants