mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
gh-86493: Use PyModule_Add() instead of PyModule_AddObjectRef() (GH-106860)
This commit is contained in:
parent
40f3f11a77
commit
a293fa5915
14 changed files with 26 additions and 116 deletions
|
@ -1756,22 +1756,12 @@ static int
|
|||
_json_exec(PyObject *module)
|
||||
{
|
||||
PyObject *PyScannerType = PyType_FromSpec(&PyScannerType_spec);
|
||||
if (PyScannerType == NULL) {
|
||||
return -1;
|
||||
}
|
||||
int rc = PyModule_AddObjectRef(module, "make_scanner", PyScannerType);
|
||||
Py_DECREF(PyScannerType);
|
||||
if (rc < 0) {
|
||||
if (PyModule_Add(module, "make_scanner", PyScannerType) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
PyObject *PyEncoderType = PyType_FromSpec(&PyEncoderType_spec);
|
||||
if (PyEncoderType == NULL) {
|
||||
return -1;
|
||||
}
|
||||
rc = PyModule_AddObjectRef(module, "make_encoder", PyEncoderType);
|
||||
Py_DECREF(PyEncoderType);
|
||||
if (rc < 0) {
|
||||
if (PyModule_Add(module, "make_encoder", PyEncoderType) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue