diff options
author | Bob Ippolito <bob@redivi.com> | 2023-04-04 10:10:10 -0700 |
---|---|---|
committer | Bob Ippolito <bob@redivi.com> | 2023-04-04 10:11:04 -0700 |
commit | 1e495c1199f56c2e8e7931f20bda7481842e18ff (patch) | |
tree | e556ca84c511e862d1a0cff72bf6f94fa0e168c9 | |
parent | 7c2ccb773ab9343e25f14d72356dab75420e288f (diff) | |
download | simplejson-1e495c1199f56c2e8e7931f20bda7481842e18ff.tar.gz |
SJ-PT-23-02: Fix missing reference count decrease
-rw-r--r-- | CHANGES.txt | 2 | ||||
-rw-r--r-- | simplejson/_speedups.c | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index 06ac399..ddb2bd8 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -2,6 +2,8 @@ Version 3.19.0 released 2023-04-XX * Fix invalid handling of unicode escape sequences in the pure Python implementation of the decoder (SJ-PT-23-01) +* Fix missing reference count decrease if PyOS_string_to_double raises + an exception in Python 2.x; was probably unreachable (SJ-PT-23-02) Version 3.18.4 released 2023-03-14 diff --git a/simplejson/_speedups.c b/simplejson/_speedups.c index ec054c7..43c589b 100644 --- a/simplejson/_speedups.c +++ b/simplejson/_speedups.c @@ -1949,8 +1949,10 @@ _match_number_str(PyScannerObject *s, PyObject *pystr, Py_ssize_t start, Py_ssiz /* rval = PyFloat_FromDouble(PyOS_ascii_atof(PyString_AS_STRING(numstr))); */ double d = PyOS_string_to_double(PyString_AS_STRING(numstr), NULL, NULL); - if (d == -1.0 && PyErr_Occurred()) + if (d == -1.0 && PyErr_Occurred()) { + Py_DECREF(numstr); return NULL; + } rval = PyFloat_FromDouble(d); } } |