Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
20c17119
Commit
20c17119
authored
Mar 26, 2016
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reduce string formatting overhead for the very likely case of str values in Py2
parent
cae601f6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
Cython/Utility/StringTools.c
Cython/Utility/StringTools.c
+7
-2
No files found.
Cython/Utility/StringTools.c
View file @
20c17119
...
@@ -815,9 +815,14 @@ static CYTHON_INLINE int __Pyx_PyByteArray_Append(PyObject* bytearray, int value
...
@@ -815,9 +815,14 @@ static CYTHON_INLINE int __Pyx_PyByteArray_Append(PyObject* bytearray, int value
//////////////////// PyObjectFormatSimple.proto ////////////////////
//////////////////// PyObjectFormatSimple.proto ////////////////////
#if
PY_MAJOR_VERSION < 3 ||
!CYTHON_COMPILING_IN_CPYTHON
#if !CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_PyObject_FormatSimple(s, f) ( \
#define __Pyx_PyObject_FormatSimple(s, f) ( \
likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) : \
likely(PyUnicode_CheckExact(s) ? (Py_INCREF(s), s) : \
PyObject_Format(s, f))
#elif PY_MAJOR_VERSION < 3
// Py2 can handle both unicode and str in PyUnicode_Join() which we (normally) call afterwards
#define __Pyx_PyObject_FormatSimple(s, f) ( \
likely(PyUnicode_CheckExact(s) | PyString_CheckExact(s)) ? (Py_INCREF(s), s) : \
PyObject_Format(s, f))
PyObject_Format(s, f))
#else
#else
// Py3 nicely returns unicode strings from str() which makes this quite efficient for builtin types
// Py3 nicely returns unicode strings from str() which makes this quite efficient for builtin types
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment