Skip to content

Commit c7825ed

Browse files
committed
Fixed #424.
Fixed TypeManager.function.fget.__get__ not complying with the specification of the attribute descriptor API (PEP 252).
1 parent 28de8d3 commit c7825ed

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

Diff for: addons/source-python/packages/source-python/entities/_base.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ def dynamic_attributes(self):
359359
attributes = {}
360360
for cls, instance in self.server_classes.items():
361361
attributes.update(
362-
{attr:(instance, getattr(cls, attr)) for attr in dir(cls)}
362+
{attr:(instance, value) for attr, value in vars(cls).items()}
363363
)
364364
return attributes
365365

Diff for: addons/source-python/packages/source-python/memory/manager.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,13 @@ def function(
647647
return_type = self.create_converter(return_type)
648648

649649
class fget(object):
650-
def __get__(fget_self, obj, cls):
650+
def __get__(fget_self, obj, cls=None):
651+
if cls is None:
652+
if obj is None:
653+
return fget_self
654+
else:
655+
cls = obj.__class__
656+
651657
if cls._binary is None:
652658
raise ValueError('_binary was not specified.')
653659

0 commit comments

Comments
 (0)