mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-26 12:49:24 +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
|
frame_locals = frame.f_locals
|
||||||
for inspected in ('self', 'cls'):
|
for inspected in ('self', 'cls'):
|
||||||
if inspected in frame_locals:
|
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:
|
try:
|
||||||
v = getattr(frame_locals[inspected], attr_name)
|
v = getattr(frame_locals[inspected], attr_name)
|
||||||
except Exception:
|
except Exception:
|
||||||
|
@ -1179,9 +1179,9 @@ class UtilsPythonTest(SupyTestCase):
|
|||||||
def test_dict(self):
|
def test_dict(self):
|
||||||
class Foo:
|
class Foo:
|
||||||
def __hasattr__(self, n):
|
def __hasattr__(self, n):
|
||||||
raise Exception()
|
raise Exception(n)
|
||||||
def __getattr__(self, n):
|
def __getattr__(self, n):
|
||||||
raise Exception()
|
raise Exception(n)
|
||||||
|
|
||||||
def f():
|
def f():
|
||||||
self = Foo()
|
self = Foo()
|
||||||
@ -1199,7 +1199,7 @@ class UtilsPythonTest(SupyTestCase):
|
|||||||
class Foo:
|
class Foo:
|
||||||
__slots__ = ('bar',)
|
__slots__ = ('bar',)
|
||||||
def __hasattr__(self, n):
|
def __hasattr__(self, n):
|
||||||
raise Exception()
|
raise Exception(n)
|
||||||
def __getattr__(self, n):
|
def __getattr__(self, n):
|
||||||
raise Exception(n)
|
raise Exception(n)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user