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

display_method of objects with custom __getattr__ #5227

Closed
Zaharid opened this issue Feb 26, 2014 · 1 comment · Fixed by #5229
Closed

display_method of objects with custom __getattr__ #5227

Zaharid opened this issue Feb 26, 2014 · 1 comment · Fixed by #5229
Labels
Milestone

Comments

@Zaharid
Copy link
Contributor

Zaharid commented Feb 26, 2014

Some objects such as pymongo collections implement a custom __getattr__ method that always retursn an object.

Then for the IPython display there is https://github.com/ipython/ipython/blob/master/IPython/core/displayhook.py#L245 which will call the _ipython_display_ attribute returned by __getattr__ and produce unpredictable behaviour; best case just an error, like:

TypeError: 'Collection' object is not callable. If you meant to call the '_ipython_display_'
 method on a 'Collection' object it is failing because no such method exists.

Probably can be considered a bug of pymongo, but may be worth considering to check for existence in __dict__ rather than getattr.

@minrk
Copy link
Member

minrk commented Feb 26, 2014

See #5229.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants