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

AttributeError: __flags__ using muppy #24

Closed
jmilloy opened this issue Dec 3, 2015 · 4 comments
Closed

AttributeError: __flags__ using muppy #24

jmilloy opened this issue Dec 3, 2015 · 4 comments

Comments

@jmilloy
Copy link

jmilloy commented Dec 3, 2015

I confirmed that I can use muppy or a tracker with the expected results in a simple case. But when I import my library, I get an AttributeError when using muppy. It is not informative enough for me to figure out what aspect of my library is causing the problem.

from pympler import muppy
import <my library>
objs = muppy.get_objects()

This code gives the following exception

Traceback (most recent call last):
  File "/home/jmilloy/test.py", line 5, in <module>
    objs = muppy.get_objects()
  File "/usr/local/lib/python2.7/dist-packages/pympler/muppy.py", line 45, in get_objects
    if not _is_containerobject(ref):
  File "/usr/local/lib/python2.7/dist-packages/pympler/muppy.py", line 246, in _is_containerobject
    if type(o).__flags__ & __TPFLAGS_HAVE_GC == 0:
AttributeError: __flags__

You won't be able to reproduce because I can't give you access to my library, but maybe we can figure out what's causing it. Have you seen this before?

@Pankrat
Copy link
Member

Pankrat commented Dec 12, 2015

I haven't seen this yet. Which exact version of Python (and Pympler) are you using?

It would be interesting to know which kind of object will raise the AttributeError. If you could catch the error in _is_containerobject and log repr(o) and type(o) this might help figuring out how to fix this (whether to return True or False in this case).

Thanks for the report.

@jmilloy
Copy link
Author

jmilloy commented Dec 13, 2015

I've got python 2.7.10 and pympler 0.4.2.

The object is a VTK object (which I think is due to mayavi in my project):

ipdb> type(o)
<type 'vtkclass'>
ipdb> repr(o)
'<vtkclass vtkInfovisPython.vtkCircularLayoutStrategy>'

@Pankrat
Copy link
Member

Pankrat commented Dec 14, 2015

Thanks - that helped. This should now be fixed on master. Please re-open the ticket if it still doesn't work.

@Pankrat Pankrat closed this as completed Dec 14, 2015
@jmilloy
Copy link
Author

jmilloy commented Dec 14, 2015

Cool, thanks!

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