commit | 5951f2300f43d75d344d542e171daed47a0382a6 | [log] [tgz] |
---|---|---|
author | Serhiy Storchaka <storchaka@gmail.com> | Thu Dec 24 10:35:35 2015 +0200 |
committer | Serhiy Storchaka <storchaka@gmail.com> | Thu Dec 24 10:35:35 2015 +0200 |
tree | 2e173dda0c0d4c4bf887e8a6a309430d0d9cd5be | |
parent | 6ed42ea08b3a961944e94f1dd941ffabc7657065 [diff] [blame] |
Issue #20440: Massive replacing unsafe attribute setting code with special macro Py_SETREF.
diff --git a/Modules/_json.c b/Modules/_json.c index 5dac038..fede6b1 100644 --- a/Modules/_json.c +++ b/Modules/_json.c
@@ -1717,8 +1717,7 @@ } else if (PyUnicode_Check(s->encoding)) { PyObject *tmp = PyUnicode_AsEncodedString(s->encoding, NULL, NULL); - Py_DECREF(s->encoding); - s->encoding = tmp; + Py_SETREF(s->encoding, tmp); } if (s->encoding == NULL) goto bail;