diff options
author | Stefan Behnel <stefan_ml@behnel.de> | 2013-12-31 19:13:43 +0100 |
---|---|---|
committer | Stefan Behnel <stefan_ml@behnel.de> | 2013-12-31 19:13:43 +0100 |
commit | 059eac4ef1c2aeabcb475003809b6f07d60288e9 (patch) | |
tree | e7f11bdf8421c8e99d64a206e1e1b7b8fb7421cb /Cython/Utility/ModuleSetupCode.c | |
parent | 48975c91566c335a145922148f85589da92e12ab (diff) | |
download | cython-059eac4ef1c2aeabcb475003809b6f07d60288e9.tar.gz |
optimise str % formatting
Diffstat (limited to 'Cython/Utility/ModuleSetupCode.c')
-rw-r--r-- | Cython/Utility/ModuleSetupCode.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Cython/Utility/ModuleSetupCode.c b/Cython/Utility/ModuleSetupCode.c index 3bb72cd99..6b524ef7f 100644 --- a/Cython/Utility/ModuleSetupCode.c +++ b/Cython/Utility/ModuleSetupCode.c @@ -157,11 +157,18 @@ #define __Pyx_PyUnicode_READ(k, d, i) ((k=k), (Py_UCS4)(((Py_UNICODE*)d)[i])) #endif -#define __Pyx_PyUnicode_Format(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) +#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) +#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) #define __Pyx_PyUnicode_Concat(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ? \ PyNumber_Add(a, b) : PyUnicode_Concat(a, b)) #if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b) +#else + #define __Pyx_PyString_Format(a, b) PyString_Format(a, b) +#endif + +#if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type #define PyStringObject PyUnicodeObject #define PyString_Type PyUnicode_Type |