summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Dauvergne <bdauvergne@entrouvert.com>2021-09-27 12:14:23 (GMT)
committerBenjamin Dauvergne <bdauvergne@entrouvert.com>2021-09-28 08:23:10 (GMT)
commita28fb8c8e1a01c7c226e016c91bef2e5b4436e23 (patch)
treea4e823a770d419948f513ccc25cddd9a6338d0c8
parentd80357e22635888764c9a07eb2604a6d0cb56f91 (diff)
downloadlasso-main.zip
lasso-main.tar.gz
lasso-main.tar.bz2
Does not decref boolean constants (#57268)HEADmain
TRUE/FALSE are special references in CPython bindings whose reference count must never be updated.
-rw-r--r--bindings/python/lang.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/bindings/python/lang.py b/bindings/python/lang.py
index 1e88e7b..5ba4265 100644
--- a/bindings/python/lang.py
+++ b/bindings/python/lang.py
@@ -728,7 +728,8 @@ register_constants(PyObject *d)
else:
print_('E: unknown constant type: %r' % c[0], file=sys.stderr)
print_(' PyDict_SetItemString(d, "%s", obj);' % c[1][6:], file=fd)
- print_(' Py_DECREF(obj);', file=fd)
+ if c[0] != 'b': # refcount of Py_True/False should not be changed
+ print_(' Py_DECREF(obj);', file=fd)
print_('}', file=fd)
print_('', file=fd)