Skip to content

Commit 866f384

Browse files
DinoVmeta-codesync[bot]
authored andcommitted
Fix type construction issues
Summary: A couple of issues around defining static types in 3.14: 1) We can't use `_PyObject_GenericSetAttrWithDict` to set attributes as there's an assertion it doesn't get called for types. 2) 1UL << 2 is now Py_TPFLAGS_INLINE_VALUES, we need to use a different free value. Reviewed By: alexmalyshev Differential Revision: D83679254 fbshipit-source-id: e8dcb45e614e3b5afbe56bef6a687f30047c2d1a
1 parent d853e23 commit 866f384

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

cinderx/Common/extra-py-flags.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@
1515
#define CI_CO_STATICALLY_COMPILED 0x4000000
1616
#endif
1717

18-
#if PY_VERSION_HEX >= 0x030C0000
18+
#if PY_VERSION_HEX >= 0x030E0000
19+
20+
#define Ci_Py_TPFLAGS_IS_STATICALLY_DEFINED (1UL << 21)
21+
22+
#elif PY_VERSION_HEX >= 0x030C0000
1923

2024
// Lowest bit is unused
2125
#define Ci_Py_TPFLAGS_IS_STATICALLY_DEFINED (1UL << 2)

cinderx/StaticPython/_static.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1556,8 +1556,7 @@ static PyObject* _static___build_cinder_class__(
15561556
}
15571557

15581558
int res;
1559-
res = _PyObject_GenericSetAttrWithDict(
1560-
type, s___final_method_names__, final_method_names, NULL);
1559+
res = PyObject_SetAttr(type, s___final_method_names__, final_method_names);
15611560
if (res != 0) {
15621561
goto error;
15631562
}

0 commit comments

Comments
 (0)