Comments (4)
hmm. Is this how to reproduce this?
$ python
Python 3.9.9 (main, Nov 17 2021, 14:19:07)
[GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import weakref
>>> key1 = lambda: None
>>> key2 = lambda: None
>>> obj = object()
>>> dct = {weakref.ref(key1): obj, weakref.ref(key2): obj}
>>> import guppy
>>> iso = guppy.hpy().iso(obj)
>>> del obj
>>> iso.shpaths
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/zhuyifei1999/guppy3/guppy/heapy/OutputHandling.py", line 386, in reprfunc
return self.printer.get_str_of_top()
File "/home/zhuyifei1999/guppy3/guppy/heapy/OutputHandling.py", line 272, in get_str_of_top
return self.get_str(self, True)
File "/home/zhuyifei1999/guppy3/guppy/heapy/OutputHandling.py", line 339, in get_str
return self.mod.View.enter(lambda: f())
File "/home/zhuyifei1999/guppy3/guppy/heapy/View.py", line 256, in enter
retval = func()
File "/home/zhuyifei1999/guppy3/guppy/heapy/OutputHandling.py", line 339, in <lambda>
return self.mod.View.enter(lambda: f())
File "/home/zhuyifei1999/guppy3/guppy/heapy/OutputHandling.py", line 307, in f
nxt = next(it)
File "/home/zhuyifei1999/guppy3/guppy/heapy/OutputHandling.py", line 232, in lines_from
yield self.line_at(idx)
File "/home/zhuyifei1999/guppy3/guppy/heapy/OutputHandling.py", line 212, in line_at
li = next(self.line_iter)
File "/home/zhuyifei1999/guppy3/guppy/heapy/Path.py", line 368, in _oh_get_line_iter
for el in self:
File "/home/zhuyifei1999/guppy3/guppy/heapy/Path.py", line 289, in __iter__
return self.iter()
File "/home/zhuyifei1999/guppy3/guppy/heapy/Path.py", line 292, in iter
return PathsIter(self, start, stop)
File "/home/zhuyifei1999/guppy3/guppy/heapy/Path.py", line 176, in __init__
self.reset(start)
File "/home/zhuyifei1999/guppy3/guppy/heapy/Path.py", line 209, in reset
sr = self.mod.sortedrels(self.paths.IG, src)
File "/home/zhuyifei1999/guppy3/guppy/heapy/Path.py", line 462, in sortedrels
t.sort(key=lambda x: x[0])
File "/home/zhuyifei1999/guppy3/guppy/heapy/Path.py", line 94, in __lt__
return self.r < other.r
TypeError: '<' not supported between instances of 'weakref' and 'weakref'
I think among all the relations, only dict keys can be weakrefs. I guess I could change it so that if a comparison fails, compare its id(). The problem is that in that case, say, id(1) > id('foo') and id(2) < id('foo'), it implies id(2) < id('foo') < id(1), but that would conflict with 1 < 2. I could say compare type(1) and type('foo') when the types are different, and when types are the same, try to compare directly, and if that fails with typeerror, compare id... that should work right?
from guppy3.
That's at least how I patched it here, and I think it was okay, but you probably know better what consequences that can have. But maybe it's not worse than crashing. :)
from guppy3.
Yep. 5542d9c should fix it. If dict keys have same-type-but-sometimes-compariable says, say (None,)
and (1,)
, it might fail to have total ordering but there's not much I can do about it.
from guppy3.
Thanks a lot!
from guppy3.
Related Issues (20)
- Feature: replace/patch an imported class at runtime HOT 15
- Question: How to analyze guppy heap files HOT 2
- Getting text output from tool HOT 3
- Idea: Save the entire reference graph (to make profile browsers more useful)
- Feature: monitor external python process, possibly by injecting a stub? HOT 3
- pywin32<300 causes NULL pointer deference during referrer graph generation HOT 32
- Provide `guppy.__version__` HOT 1
- Use commas for big numbers HOT 5
- Add support to release aarch64 wheels HOT 2
- [Question] How does `theone` return the Python object? HOT 8
- python.exe crashed on hpy.heap() after Import Official Dropbox SDK for Python HOT 2
- Is it possible to dump the memory snapshot for offline analysis? HOT 3
- Usage with JAX HOT 8
- Heisenbug: test_RefPat.RefPatCase.test_presentation fails sometimes on Python 3.9 on Windows HOT 4
- AttributeError with guppy.heapy.UniSet.IdentitySetMulti.partition HOT 3
- Fails to build on Python 3.11 RC2: fatal error: longintrepr.h: No such file or directory HOT 13
- Profile Browser fails with AttributeError: 'bool' object has no attribute '_root' HOT 4
- Remote monitor mode not available for python >3.8 ? HOT 1
- Exception in creating hpy instance
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from guppy3.