Skip to content
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

Make autoreload extension work on Python 3. #1289

Merged
merged 2 commits into from Jan 20, 2012

Conversation

takluyver
Copy link
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
try:
py_filename = pyfile.source_from_cache(filename)
except ValueError:
continue

if ext != PY_COMPILED_EXT:
Copy link
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
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
Member

fperez commented Jan 20, 2012

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

@takluyver
Copy link
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
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
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
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