Commit 5280922
committed
Fix classmethod descr_get to match CPython behavior
Simplify classmethod.__get__ to always create a PyBoundMethod binding
the callable to the class, matching CPython's cm_descr_get which simply
calls PyMethod_New(cm->cm_callable, type).
The previous implementation incorrectly tried to call __get__ on the
wrapped callable, which broke when a bound method was passed to
classmethod() (e.g. classmethod(A().foo)).1 parent 7eb1821 commit 5280922
File tree
2 files changed
+1
-6
lines changed- Lib/test
- crates/vm/src/builtins
2 files changed
+1
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
291 | 291 | | |
292 | 292 | | |
293 | 293 | | |
294 | | - | |
295 | 294 | | |
296 | 295 | | |
297 | 296 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
| 62 | + | |
67 | 63 | | |
68 | 64 | | |
69 | 65 | | |
| |||
0 commit comments