Commit 650bf5d4 authored by Stefan Behnel's avatar Stefan Behnel

fix repeated expression evaluation in f-string implementation for !s/r/a...

fix repeated expression evaluation in f-string implementation for !s/r/a conversions by switching from macro to inline function
parent 20c17119
...@@ -835,12 +835,20 @@ static CYTHON_INLINE int __Pyx_PyByteArray_Append(PyObject* bytearray, int value ...@@ -835,12 +835,20 @@ static CYTHON_INLINE int __Pyx_PyByteArray_Append(PyObject* bytearray, int value
//////////////////// PyObjectFormatAndDecref.proto //////////////////// //////////////////// PyObjectFormatAndDecref.proto ////////////////////
#define __Pyx_PyObject_FormatSimpleAndDecref(s, f) \ static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatSimpleAndDecref(PyObject* s, PyObject* f);
((unlikely(!s) || likely(PyUnicode_CheckExact(s))) ? s : __Pyx_PyObject_FormatAndDecref(s, f))
static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatAndDecref(PyObject* s, PyObject* f); static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatAndDecref(PyObject* s, PyObject* f);
//////////////////// PyObjectFormatAndDecref //////////////////// //////////////////// PyObjectFormatAndDecref ////////////////////
static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatSimpleAndDecref(PyObject* s, PyObject* f) {
if (unlikely(!s)) return NULL;
if (likely(PyUnicode_CheckExact(s))) return s;
#if PY_MAJOR_VERSION < 3
if (likely(PyString_CheckExact(s))) return s;
#endif
return __Pyx_PyObject_FormatAndDecref(s, f);
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatAndDecref(PyObject* s, PyObject* f) { static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatAndDecref(PyObject* s, PyObject* f) {
PyObject *result = PyObject_Format(s, f); PyObject *result = PyObject_Format(s, f);
Py_DECREF(s); Py_DECREF(s);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment