Skip to content

Commit fbd25d5

Browse files
committed
Change special_attrs from PY2 to PY3
Change deprecated variables in PY2 to new ones in PY3
1 parent d6b6c3c commit fbd25d5

File tree

2 files changed

+20
-12
lines changed

2 files changed

+20
-12
lines changed

wx/py/introspect.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,11 @@ def getAttributeNames(obj, includeMagic=1, includeSingle=1,
3939
if not hasattrAlwaysReturnsTrue(obj):
4040
# Add some attributes that don't always get picked up.
4141
special_attrs = ['__bases__', '__class__', '__dict__', '__name__',
42-
'func_closure', 'func_code', 'func_defaults',
43-
'func_dict', 'func_doc', 'func_globals', 'func_name']
42+
'__closure__', '__code__', '__defaults__',
43+
'__globals__',
44+
'__builtins__', # Added to method attributes in 3.10
45+
'__get__', # Not found in `dir(method)` in 3.11
46+
]
4447
attributes += [attr for attr in special_attrs \
4548
if hasattr(obj, attr)]
4649
if includeMagic:

wx/py/tests/test_introspect.py

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -411,9 +411,12 @@ def setUp(self):
411411
'__builtins__',
412412
'__call__',
413413
'__class__',
414+
'__closure__',
414415
'__cmp__',
416+
'__code__',
415417
'__coerce__',
416418
'__contains__',
419+
'__defaults__',
417420
'__del__',
418421
'__delattr__',
419422
'__delitem__',
@@ -428,12 +431,14 @@ def setUp(self):
428431
'__flags__',
429432
'__float__',
430433
'__floordiv__',
434+
'__func__',
431435
'__ge__',
432436
'__get__',
433437
'__getattr__',
434438
'__getattribute__',
435439
'__getitem__',
436440
'__getslice__',
441+
'__globals__',
437442
'__gt__',
438443
'__hash__',
439444
'__hex__',
@@ -522,18 +527,18 @@ def setUp(self):
522527
'fileno',
523528
'find',
524529
'flush',
525-
'func_closure',
526-
'func_code',
527-
'func_defaults',
528-
'func_dict',
529-
'func_doc',
530-
'func_globals',
531-
'func_name',
530+
# 'func_closure',
531+
# 'func_code',
532+
# 'func_defaults',
533+
# 'func_dict',
534+
# 'func_doc',
535+
# 'func_globals',
536+
# 'func_name',
532537
'get',
533538
'has_key',
534-
'im_class',
535-
'im_func',
536-
'im_self',
539+
# 'im_class',
540+
# 'im_func',
541+
# 'im_self',
537542
'imag',
538543
'index',
539544
'insert',

0 commit comments

Comments
 (0)