From 0912d9a62022d41701c4ccf5edfaa4579189c321 Mon Sep 17 00:00:00 2001 From: Michael Kleehammer Date: Tue, 11 Apr 2023 12:27:22 -0500 Subject: [PATCH] Rework C++ calls for older GCC The old code compiles with newer compilers but Python 3.6 wouldn't compile. This works with 2.7 and 3.9+. I don't have 3.6 so I'll let the automatic build test it. --- src/decimal.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/decimal.cpp b/src/decimal.cpp index 9e08d326..4460e5f2 100644 --- a/src/decimal.cpp +++ b/src/decimal.cpp @@ -140,7 +140,7 @@ PyObject* DecimalFromText(const TextEnc& enc, const byte* pb, Py_ssize_t cb) if (!text) return 0; - Object cleaned = PyObject_CallMethod(pRegExpRemove, "sub", "sO", "", text.Get()); + Object cleaned(PyObject_CallMethod(pRegExpRemove, "sub", "sO", "", text.Get())); if (!cleaned) return 0; @@ -152,6 +152,5 @@ PyObject* DecimalFromText(const TextEnc& enc, const byte* pb, Py_ssize_t cb) cleaned.Attach(c2.Detach()); } - PyObject* result = PyObject_CallFunctionObjArgs(decimal, cleaned.Get(), 0); - return result; + return PyObject_CallFunctionObjArgs(decimal, cleaned.Get(), 0); }