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

oinspect.find_file: Additional safety if file cannot be found. #1933

Merged
merged 1 commit into from Jun 13, 2012

Conversation

bfroehle
Copy link
Contributor

In some code paths, e.g. when introspecting fortran objects generated by f2py, oinspect.find_file will raise an UnboundLocalError. Prevent this by setting fname to None.

In some code paths, e.g. when introspecting fortran objects generated by
f2py, oinspect.find_file will raise an UnboundLocalError.  Prevent this by
setting fname to None.
@takluyver
Copy link
Member

Is there any reasonable way to have a self-contained test for this?

@fperez
Copy link
Member

fperez commented Jun 12, 2012

Test results for commit b570c26 merged into master
Platform: linux2

  • python2.7: OK
  • python3.2: OK (libraries not available: cython matplotlib pymongo rpy2 wx wx.aui)

Not available for testing: python2.6, python3.1

@fperez
Copy link
Member

fperez commented Jun 12, 2012

@bfroehle, if you think you can easily add an extra test that catches the problem, that would be great. Otherwise this can go in as-is, given it's such a tiny amount of code and fairly obvious by inspection.

@bfroehle
Copy link
Contributor Author

It's unclear to me how we could test this without a compiler being present. I checked the NumPy source (where f2py lives) but by default there aren't any modules compiled using f2py. Additionally it doesn't seem to be possible to instantiate a 'fortran' object.

But, if you want to play around I started a gist at https://gist.github.com/2920793

@fperez
Copy link
Member

fperez commented Jun 13, 2012

Nah, not worth burning the cycles for such a simple fix. We have bigger fish to fry. Merging now.

Thanks!!

fperez added a commit that referenced this pull request Jun 13, 2012
oinspect.find_file: Additional safety if file cannot be found.

In some code paths, e.g. when introspecting fortran objects generated by f2py, oinspect.find_file will raise an UnboundLocalError. Prevent this by setting fname to None.
@fperez fperez merged commit 410a18b into ipython:master Jun 13, 2012
mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this pull request Nov 3, 2014
oinspect.find_file: Additional safety if file cannot be found.

In some code paths, e.g. when introspecting fortran objects generated by f2py, oinspect.find_file will raise an UnboundLocalError. Prevent this by setting fname to None.
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.

None yet

3 participants