mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
bpo-43962: Fix _PyInterpreterState_IDIncref() (GH-25683)
_PyInterpreterState_IDIncref() now calls _PyInterpreterState_IDInitref() and always increments id_refcount.
This commit is contained in:
parent
21b02b5f40
commit
32c5a17444
4 changed files with 22 additions and 10 deletions
|
@ -24,15 +24,21 @@ newinterpid(PyTypeObject *cls, int64_t id, int force)
|
|||
}
|
||||
}
|
||||
|
||||
if (interp != NULL) {
|
||||
if (_PyInterpreterState_IDIncref(interp) < 0) {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
interpid *self = PyObject_New(interpid, cls);
|
||||
if (self == NULL) {
|
||||
if (interp != NULL) {
|
||||
_PyInterpreterState_IDDecref(interp);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
self->id = id;
|
||||
|
||||
if (interp != NULL) {
|
||||
_PyInterpreterState_IDIncref(interp);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue