Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions mypyc/lib-rt/misc_ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -619,11 +619,17 @@ int CPyStatics_Initialize(PyObject **statics,
PyObject **result = statics;
// Start with some hard-coded values
*result++ = Py_None;
#if !CPY_3_14_FEATURES
Py_INCREF(Py_None);
#endif
*result++ = Py_False;
#if !CPY_3_14_FEATURES
Py_INCREF(Py_False);
#endif
*result++ = Py_True;
#if !CPY_3_14_FEATURES
Py_INCREF(Py_True);
#endif
if (strings) {
for (; **strings != '\0'; strings++) {
size_t num;
Expand All @@ -638,6 +644,9 @@ int CPyStatics_Initialize(PyObject **statics,
}
PyUnicode_InternInPlace(&obj);
*result++ = obj;
#if CPY_3_14_FEATURES
CPy_SetImmortal(obj);
#endif
data += len;
}
}
Expand All @@ -655,6 +664,9 @@ int CPyStatics_Initialize(PyObject **statics,
return -1;
}
*result++ = obj;
#if CPY_3_14_FEATURES
CPy_SetImmortal(obj);
#endif
data += len;
}
}
Expand All @@ -670,6 +682,9 @@ int CPyStatics_Initialize(PyObject **statics,
if (obj == NULL) {
return -1;
}
#if CPY_3_14_FEATURES
CPy_SetImmortal(obj);
#endif
data = end;
data++;
*result++ = obj;
Expand All @@ -683,6 +698,9 @@ int CPyStatics_Initialize(PyObject **statics,
if (obj == NULL) {
return -1;
}
#if CPY_3_14_FEATURES
CPy_SetImmortal(obj);
#endif
*result++ = obj;
}
}
Expand All @@ -695,6 +713,9 @@ int CPyStatics_Initialize(PyObject **statics,
if (obj == NULL) {
return -1;
}
#if CPY_3_14_FEATURES
CPy_SetImmortal(obj);
#endif
*result++ = obj;
}
}
Expand All @@ -706,10 +727,17 @@ int CPyStatics_Initialize(PyObject **statics,
if (obj == NULL) {
return -1;
}
#if CPY_3_14_FEATURES
CPy_SetImmortal(obj);
#endif
int i;
for (i = 0; i < num_items; i++) {
PyObject *item = statics[*tuples++];
#if CPY_3_14_FEATURES
CPy_SetImmortal(item);
#else
Py_INCREF(item);
#endif
PyTuple_SET_ITEM(obj, i, item);
}
*result++ = obj;
Expand All @@ -723,9 +751,16 @@ int CPyStatics_Initialize(PyObject **statics,
if (obj == NULL) {
return -1;
}
//#if CPY_3_14_FEATURES
// CPy_SetImmortal(obj);
//#endif
for (int i = 0; i < num_items; i++) {
PyObject *item = statics[*frozensets++];
#if CPY_3_14_FEATURES
CPy_SetImmortal(item);
#else
Py_INCREF(item);
#endif
if (PySet_Add(obj, item) == -1) {
return -1;
}
Expand Down