mirror of
https://github.com/python/cpython.git
synced 2025-10-07 15:42:02 +00:00
GH-84436: Skip refcounting for known immortals (GH-107605)
This commit is contained in:
parent
ec0a0d2bd9
commit
05a824f294
19 changed files with 52 additions and 65 deletions
|
@ -1277,13 +1277,13 @@ _encoded_const(PyObject *obj)
|
|||
{
|
||||
/* Return the JSON string representation of None, True, False */
|
||||
if (obj == Py_None) {
|
||||
return Py_NewRef(&_Py_ID(null));
|
||||
return &_Py_ID(null);
|
||||
}
|
||||
else if (obj == Py_True) {
|
||||
return Py_NewRef(&_Py_ID(true));
|
||||
return &_Py_ID(true);
|
||||
}
|
||||
else if (obj == Py_False) {
|
||||
return Py_NewRef(&_Py_ID(false));
|
||||
return &_Py_ID(false);
|
||||
}
|
||||
else {
|
||||
PyErr_SetString(PyExc_ValueError, "not a const");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue