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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Xavier Thompson
cython
Commits
6a99c289
Commit
6a99c289
authored
Aug 19, 2017
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Split an inline helper function to reduce excessive inlining.
parent
524b5755
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
34 deletions
+44
-34
Cython/Utility/TypeConversion.c
Cython/Utility/TypeConversion.c
+44
-34
No files found.
Cython/Utility/TypeConversion.c
View file @
6a99c289
...
@@ -204,15 +204,9 @@ static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
...
@@ -204,15 +204,9 @@ static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
return
__Pyx_PyObject_AsStringAndSize
(
o
,
&
ignore
);
return
__Pyx_PyObject_AsStringAndSize
(
o
,
&
ignore
);
}
}
// Py3.7 returns a "const char*" for unicode strings
static
CYTHON_INLINE
const
char
*
__Pyx_PyObject_AsStringAndSize
(
PyObject
*
o
,
Py_ssize_t
*
length
)
{
#if CYTHON_COMPILING_IN_CPYTHON && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
#if CYTHON_COMPILING_IN_CPYTHON && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
if
(
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
__Pyx_sys_getdefaultencoding_not_ascii
&&
#endif
PyUnicode_Check
(
o
))
{
#if PY_VERSION_HEX < 0x03030000
#if PY_VERSION_HEX < 0x03030000
static
const
char
*
__Pyx_PyUnicode_AsStringAndSize
(
PyObject
*
o
,
Py_ssize_t
*
length
)
{
char
*
defenc_c
;
char
*
defenc_c
;
// borrowed reference, cached internally in 'o' by CPython
// borrowed reference, cached internally in 'o' by CPython
PyObject
*
defenc
=
_PyUnicode_AsDefaultEncodedString
(
o
,
NULL
);
PyObject
*
defenc
=
_PyUnicode_AsDefaultEncodedString
(
o
,
NULL
);
...
@@ -233,10 +227,14 @@ static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_
...
@@ -233,10 +227,14 @@ static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_
#endif
/*__PYX_DEFAULT_STRING_ENCODING_IS_ASCII*/
#endif
/*__PYX_DEFAULT_STRING_ENCODING_IS_ASCII*/
*
length
=
PyBytes_GET_SIZE
(
defenc
);
*
length
=
PyBytes_GET_SIZE
(
defenc
);
return
defenc_c
;
return
defenc_c
;
}
#else
/* PY_VERSION_HEX < 0x03030000 */
#else
/* PY_VERSION_HEX < 0x03030000 */
if
(
__Pyx_PyUnicode_READY
(
o
)
==
-
1
)
return
NULL
;
static
CYTHON_INLINE
const
char
*
__Pyx_PyUnicode_AsStringAndSize
(
PyObject
*
o
,
Py_ssize_t
*
length
)
{
if
(
unlikely
(
__Pyx_PyUnicode_READY
(
o
)
==
-
1
))
return
NULL
;
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
if
(
PyUnicode_IS_ASCII
(
o
))
{
if
(
likely
(
PyUnicode_IS_ASCII
(
o
)
))
{
// cached for the lifetime of the object
// cached for the lifetime of the object
*
length
=
PyUnicode_GET_LENGTH
(
o
);
*
length
=
PyUnicode_GET_LENGTH
(
o
);
return
PyUnicode_AsUTF8
(
o
);
return
PyUnicode_AsUTF8
(
o
);
...
@@ -248,7 +246,19 @@ static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_
...
@@ -248,7 +246,19 @@ static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_
#else
/* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */
#else
/* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */
return
PyUnicode_AsUTF8AndSize
(
o
,
length
);
return
PyUnicode_AsUTF8AndSize
(
o
,
length
);
#endif
/* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */
#endif
/* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */
}
#endif
/* PY_VERSION_HEX < 0x03030000 */
#endif
/* PY_VERSION_HEX < 0x03030000 */
#endif
// Py3.7 returns a "const char*" for unicode strings
static
CYTHON_INLINE
const
char
*
__Pyx_PyObject_AsStringAndSize
(
PyObject
*
o
,
Py_ssize_t
*
length
)
{
#if CYTHON_COMPILING_IN_CPYTHON && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
if
(
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
__Pyx_sys_getdefaultencoding_not_ascii
&&
#endif
PyUnicode_Check
(
o
))
{
return
__Pyx_PyUnicode_AsStringAndSize
(
o
,
length
);
}
else
}
else
#endif
/* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT */
#endif
/* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT */
...
...
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