Skip to content

Commit 97d51f0

Browse files
Eliminate structseq_new.
1 parent 8b1d1f8 commit 97d51f0

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

Modules/posixmodule.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2225,14 +2225,24 @@ static PyStructSequence_Desc waitid_result_desc = {
22252225
5
22262226
};
22272227
#endif
2228-
static newfunc structseq_new;
22292228

22302229
static PyObject *
22312230
statresult_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
22322231
{
22332232
PyStructSequence *result;
22342233
int i;
22352234

2235+
PyObject *mod = PyType_GetModule(type);
2236+
if (mod == NULL) {
2237+
return NULL;
2238+
}
2239+
_posixstate *state = get_posix_state(mod);
2240+
Py_DECREF(mod);
2241+
if (state != NULL) {
2242+
return NULL;
2243+
}
2244+
#define structseq_new ((PyTypeObject *)state->StatResultType)->tp_new
2245+
22362246
result = (PyStructSequence*)structseq_new(type, args, kwds);
22372247
if (!result)
22382248
return NULL;
@@ -15909,7 +15919,6 @@ posixmodule_exec(PyObject *m)
1590915919
}
1591015920
PyModule_AddObject(m, "stat_result", Py_NewRef(StatResultType));
1591115921
state->StatResultType = StatResultType;
15912-
structseq_new = ((PyTypeObject *)StatResultType)->tp_new;
1591315922
((PyTypeObject *)StatResultType)->tp_new = statresult_new;
1591415923

1591515924
statvfs_result_desc.name = "os.statvfs_result"; /* see issue #19209 */

Tools/c-analyzer/cpython/globals-to-fix.tsv

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,6 @@ Modules/faulthandler.c - old_stack -
399399
# initialized once
400400

401401
Modules/_io/bufferedio.c _PyIO_trap_eintr eintr_int -
402-
Modules/posixmodule.c - structseq_new -
403402
Modules/posixmodule.c - ticks_per_second -
404403
Modules/timemodule.c _PyTime_GetClockWithInfo initialized -
405404
Modules/timemodule.c _PyTime_GetProcessTimeWithInfo ticks_per_second -

0 commit comments

Comments
 (0)