zhuyifei1999 / guppy3

guppy / heapy ported to Python3. It works for real!
https://zhuyifei1999.github.io/guppy3/
MIT License
389 stars 23 forks source link

Exception in creating hpy instance #47

Open silverwingbug opened 7 months ago

silverwingbug commented 7 months ago

Hi Experts,

Meet an exception in creating hpy instance like below: 2024-04-01T07:21:41Z Wa(180)[+] sha: h=guppy.hpy() 2024-04-01T07:21:41Z Wa(180)[+] sha: File "/usr/lib/x/y/lib/python/guppy/init.py", line 38, in hpy 2024-04-01T07:21:41Z Wa(180)[+] sha: return r.guppy.heapy.Use 2024-04-01T07:21:41Z Wa(180)[+] sha: File "/usr/lib/x/y/lib/python/guppy/etc/Glue.py", line 50, in getattr 2024-04-01T07:21:41Z Wa(180)[+] sha: return self._share.getattr(self, name) 2024-04-01T07:21:41Z Wa(180)[+] sha: File "/usr/lib/x/y/lib/python/guppy/etc/Glue.py", line 219, in getattr 2024-04-01T07:21:41Z Wa(180)[+] sha: d = self.getattr2(inter, cache, owner, name) 2024-04-01T07:21:41Z Wa(180)[+] sha: File "/usr/lib/x/y/lib/python/guppy/etc/Glue.py", line 236, in getattr2 2024-04-01T07:21:41Z Wa(180)[+] sha: x = self.getattr_package(inter, name) 2024-04-01T07:21:41Z Wa(180)[+] sha: File "/usr/lib/x/y/lib/python/guppy/etc/Glue.py", line 284, in getattr_package 2024-04-01T07:21:41Z Wa(180)[+] sha: x = self.makeModule(x, name) 2024-04-01T07:21:41Z Wa(180)[+] sha: File "/usr/lib/x/y/lib/python/guppy/etc/Glue.py", line 350, in makeModule 2024-04-01T07:21:41Z Wa(180)[+] sha: return Share(module, self, module.name, Clamp) 2024-04-01T07:21:41Z Wa(180)[+] sha: File "/usr/lib/x/y/lib/python/guppy/etc/Glue.py", line 208, in init 2024-04-01T07:21:41Z Wa(180)[+] sha: getattr(inter, name) 2024-04-01T07:21:41Z Wa(180)[+] sha: File "/usr/lib/x/y/lib/python/guppy/etc/Glue.py", line 50, in getattr 2024-04-01T07:21:41Z Wa(180)[+] sha: return self._share.getattr(self, name) 2024-04-01T07:21:41Z Wa(180)[+] sha: File "/usr/lib/x/y/lib/python/guppy/etc/Glue.py", line 219, in getattr 2024-04-01T07:21:41Z Wa(180)[+] sha: d = self.getattr2(inter, cache, owner, name) 2024-04-01T07:21:41Z Wa(180)[+] sha: File "/usr/lib/x/y/lib/python/guppy/etc/Glue.py", line 238, in getattr2 2024-04-01T07:21:41Z Wa(180)[+] sha: x = self.getattr3(inter, name) 2024-04-01T07:21:41Z Wa(180)[+] sha: File "/usr/lib/x/y/lib/python/guppy/etc/Glue.py", line 323, in getattr3 2024-04-01T07:21:41Z Wa(180)[+] sha: pa = getattr(pa, at) 2024-04-01T07:21:41Z Wa(180)[+] sha: File "/usr/lib/x/y/lib/python/guppy/etc/Glue.py", line 50, in getattr 2024-04-01T07:21:41Z Wa(180)[+] sha: return self._share.getattr(self, name) 2024-04-01T07:21:41Z Wa(180)[+] sha: File "/usr/lib/x/y/lib/python/guppy/etc/Glue.py", line 219, in getattr 2024-04-01T07:21:41Z Wa(180)[+] sha: d = self.getattr2(inter, cache, owner, name) 2024-04-01T07:21:41Z Wa(180)[+] sha: File "/usr/lib/x/y/lib/python/guppy/etc/Glue.py", line 236, in getattr2 2024-04-01T07:21:41Z Wa(180)[+] sha: x = self.getattr_package(inter, name) 2024-04-01T07:21:41Z Wa(180)[+] sha: File "/usr/lib/x/y/lib/python/guppy/etc/Glue.py", line 273, in getattr_package 2024-04-01T07:21:41Z Wa(180)[+] sha: x = import(self.makeName(name)) 2024-04-01T07:21:41Z Wa(180)[+] sha: File "/usr/lib/x/y/lib/python/guppy/heapy/View.py", line 605, in 2024-04-01T07:21:41Z Wa(180)[+] sha: prime_builtin_types() 2024-04-01T07:21:41Z Wa(180)[+] sha: File "/usr/lib/x/y/lib/python/guppy/heapy/View.py", line 551, in prime_builtin_types 2024-04-01T07:21:41Z Wa(180)[+] sha: if isinstance(t, types): 2024-04-01T07:21:41Z Wa(180)[+] sha: TypeError: isinstance() arg 2 must be a type or tuple of types

To accommodate our platform, I compiled the source to build a manylinux version wheel, then unzip and copy the stuff in the package to the platform for reference.

BR/Amber

zhuyifei1999 commented 1 month ago

Hi I'm so sorry I missed this bug.

You have

2024-04-01T07:21:41Z Wa(180)[+] sha: if isinstance(t, types):

The closest matching line seems to be https://github.com/zhuyifei1999/guppy3/blob/master/guppy/heapy/View.py#L551

            if isinstance(t, type):

it's type instead of types here. What is types for?

Assuming the code was actually type and not types the error message makes no sense, because type itself is a type. But if the code was actually changed from type to types then it would actually refer to a module imported at line 539 and emit the error you saw.