summaryrefslogtreecommitdiff
path: root/Cython/Utility/ModuleSetupCode.c
diff options
context:
space:
mode:
authorStefan Behnel <stefan_ml@behnel.de>2013-12-06 15:22:52 +0100
committerStefan Behnel <stefan_ml@behnel.de>2013-12-06 15:22:52 +0100
commit1da05d6e1e930b365491eb81c1b8b6bd6b8f158d (patch)
tree680b555fa53c38e109994d44a68403c42cf9e494 /Cython/Utility/ModuleSetupCode.c
parent08c7bf8bdc1346ee2c27c1ed3122428b7d12943f (diff)
downloadcython-1da05d6e1e930b365491eb81c1b8b6bd6b8f158d.tar.gz
improve type inference for string %/+/* operations and use more direct C-API calls for these unicode operations
Diffstat (limited to 'Cython/Utility/ModuleSetupCode.c')
-rw-r--r--Cython/Utility/ModuleSetupCode.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Cython/Utility/ModuleSetupCode.c b/Cython/Utility/ModuleSetupCode.c
index 1fe66ea5c..3bb72cd99 100644
--- a/Cython/Utility/ModuleSetupCode.c
+++ b/Cython/Utility/ModuleSetupCode.c
@@ -157,6 +157,10 @@
#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_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 PyBaseString_Type PyUnicode_Type
#define PyStringObject PyUnicodeObject