Skip to content

Commit 6dd42b5

Browse files
StrongerXifacebook-github-bot
authored andcommitted
Trace into descriptor with __set__ (#154176)
Summary: As title, this patch basically implements https://github.com/python/cpython/blob/3.11/Objects/object.c#L1371-L1452, and make the `__get__` handling more robust. I ran into this while fixing #133762. X-link: pytorch/pytorch#154176 Approved by: https://github.com/jansel Reviewed By: izaitsevfb Differential Revision: D75488090 fbshipit-source-id: 23246b81e656ee0077a9c71d4f6a64fa114eb501
1 parent 9486136 commit 6dd42b5

File tree

1 file changed

+6
-0
lines changed
  • userbenchmark/dynamo/dynamobench/_dynamo

1 file changed

+6
-0
lines changed

userbenchmark/dynamo/dynamobench/_dynamo/utils.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3505,6 +3505,12 @@ def object_has_getattribute(value: Any):
35053505
return class_has_getattribute(type(value))
35063506

35073507

3508+
def object_setattr_ignore_descriptor(obj, name, value):
3509+
# https://github.com/python/cpython/blob/3.11/Objects/object.c#L1286-L1335
3510+
d = object.__getattribute__(obj, "__dict__")
3511+
d[name] = value
3512+
3513+
35083514
def class_has_getattribute(cls: type):
35093515
try:
35103516
if isinstance(

0 commit comments

Comments
 (0)