Skip to content

Commit

Permalink
Rework C++ calls for older GCC
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mkleehammer committed Apr 11, 2023
1 parent b7b4e90 commit 0912d9a
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/decimal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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);
}

0 comments on commit 0912d9a

Please sign in to comment.