mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-24 03:33:11 +01:00
Fix previous commit for py2 and pypy.
This commit is contained in:
parent
969b9ed341
commit
233deee0d3
@ -159,7 +159,15 @@ def collect_extra_debug_data():
|
||||
frame_locals = frame.f_locals
|
||||
for inspected in ('self', 'cls'):
|
||||
if inspected in frame_locals:
|
||||
for attr_name in dir(frame_locals[inspected]):
|
||||
try:
|
||||
attribute_names = dir(frame_locals[inspected])
|
||||
except Exception: # For Python 2 and Pypy
|
||||
try:
|
||||
attribute_names = list(
|
||||
frame_locals[inspected].__dict__)
|
||||
except Exception:
|
||||
attribute_names = []
|
||||
for attr_name in attribute_names:
|
||||
try:
|
||||
v = getattr(frame_locals[inspected], attr_name)
|
||||
except Exception:
|
||||
|
@ -1179,9 +1179,9 @@ class UtilsPythonTest(SupyTestCase):
|
||||
def test_dict(self):
|
||||
class Foo:
|
||||
def __hasattr__(self, n):
|
||||
raise Exception()
|
||||
raise Exception(n)
|
||||
def __getattr__(self, n):
|
||||
raise Exception()
|
||||
raise Exception(n)
|
||||
|
||||
def f():
|
||||
self = Foo()
|
||||
@ -1199,7 +1199,7 @@ class UtilsPythonTest(SupyTestCase):
|
||||
class Foo:
|
||||
__slots__ = ('bar',)
|
||||
def __hasattr__(self, n):
|
||||
raise Exception()
|
||||
raise Exception(n)
|
||||
def __getattr__(self, n):
|
||||
raise Exception(n)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user