GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — `_operator`: `methodcaller_clear` has the wrong signature for the `tp_clear` slot (returns `void`, not `int`) · Issue #156762 · python/cpython Closed Labels 3.14bugs and security fixesbugs and security fixes3.15bugs and security fixesbugs and security fixes3.16new features, bugs and security fixesnew features, bugs and security fixesextension-modulesC modules in the Modules dirC modules in the Modules dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error DescriptionBug reportBug description:
/* Modules/_operator.c:1743 */ static void methodcaller_clear(PyObject *op) { methodcallerobject *mc = methodcallerobject_CAST(op); Py_CLEAR(mc->name); Py_CLEAR(mc->args); Py_CLEAR(mc->kwds); Py_CLEAR(mc->vectorcall_args); Py_CLEAR(mc->vectorcall_kwnames); } /* Modules/_operator.c:1928 */ static PyType_Slot methodcaller_type_slots[] = { ... {Py_tp_clear, methodcaller_clear}, ... }; The mismatch is not diagnosed at compile time because UBSan with The trace above is from a free-threaded build. The defect is in the slot registration, not in
ImpactBenign on the mainstream targets I checked. Both GC implementations discard the result It is still an indirect call through an incompatible function type, i.e. undefined behaviour,
I grepped every ReproducerThe wrong slot signature is present in every build; a sanitizer build is only what makes it
Then: The Suggested fix-static void +static int methodcaller_clear(PyObject *op) { methodcallerobject *mc = methodcallerobject_CAST(op); Py_CLEAR(mc->name); Py_CLEAR(mc->args); Py_CLEAR(mc->kwds); Py_CLEAR(mc->vectorcall_args); Py_CLEAR(mc->vectorcall_kwnames); + return 0; }
Environment
CPython versions tested on:3.16, CPython main branch, 3.15 Operating systems tested on:Linux Linked PRsActivity
MetadataMetadataAssigneesLabels3.14bugs and security fixesbugs and security fixes3.15bugs and security fixesbugs and security fixes3.16new features, bugs and security fixesnew features, bugs and security fixesextension-modulesC modules in the Modules dirC modules in the Modules dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error ProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |