[3.13] gh-142595: Amend be5e0dcded (fix NULL pointer dereference) (GH-142775) (GH-142789)

(cherry picked from commit 15a9762500)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
This commit is contained in:
Miss Islington (bot) 2025-12-16 12:00:40 +01:00 committed by GitHub
parent c32a4c14fd
commit 4480f5b661
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -5922,8 +5922,9 @@ _decimal_exec(PyObject *m)
/* DecimalTuple */
ASSIGN_PTR(collections, PyImport_ImportModule("collections"));
obj = PyObject_CallMethod(collections, "namedtuple", "(ss)", "DecimalTuple",
"sign digits exponent");
ASSIGN_PTR(obj, PyObject_CallMethod(collections, "namedtuple", "(ss)",
"DecimalTuple",
"sign digits exponent"));
if (!PyType_Check(obj)) {
PyErr_SetString(PyExc_TypeError,
"type is expected from namedtuple call");