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

RuntimeError in completer #543

Closed
jstenar opened this issue Jun 28, 2011 · 2 comments
Closed

RuntimeError in completer #543

jstenar opened this issue Jun 28, 2011 · 2 comments
Milestone

Comments

@jstenar
Copy link
Member

jstenar commented Jun 28, 2011

Using master f0437d2 I get "RuntimeError: can't re-enter readline" when completing on properties of some objects. I have gotten it on proxy objects in Pyro (python remote objects) and some other objects I don't recall right now. This problem does not appear on 0.10.2.

I get a crashreport ( https://gist.github.com/1051868 ) but ipython does not go down completely. There are two files in the gist, the first one is the crash report and the second one is the output that I got at the terminal that was not part of the crash report.

/Jörgen

@jstenar
Copy link
Member Author

jstenar commented Jun 28, 2011

By catching both ValueError and AttributeError in utils/dir2 as shown below, the error disappears:

if hasattr(obj, 'trait_names'):
    try:
        words.extend(obj.trait_names())
        may_have_dupes = True
    except (TypeError, AttributeError):
        # This will happen if `obj` is a class and not an instance.
        pass

# Support for PyCrust-style _getAttributeNames magic method.
if hasattr(obj, '_getAttributeNames'):
    try:
        words.extend(obj._getAttributeNames())
        may_have_dupes = True
    except (TypeError, AttributeError):
        # `obj` is a class and not an instance.  Ignore
        # this error.
        pass

@minrk
Copy link
Member

minrk commented Jun 28, 2011

Thanks for tracking it down! It's pretty terrible when remote object libraries lie to hasattr. I'll go ahead and make the change.

@minrk minrk closed this as completed in b9b8f44 Jun 28, 2011
mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this issue Nov 3, 2014
Some remote object libraries (e.g. Pyro) will lie to hasattr, not raising AttributeError until the attr is actually requested.
This prevents these AttributeErrors from crashing IPython.

closes ipythongh-543

Signed-off-by: MinRK <benjaminrk@gmail.com>
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

No branches or pull requests

2 participants