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
Boxiang Sun
cython
Commits
9eb978cc
Commit
9eb978cc
authored
Jun 24, 2017
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add necessary cast for Py3.7
see
https://bugs.python.org/issue28769
parent
b906eb87
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
Cython/Utility/TypeConversion.c
Cython/Utility/TypeConversion.c
+6
-2
No files found.
Cython/Utility/TypeConversion.c
View file @
9eb978cc
...
@@ -228,14 +228,18 @@ static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_
...
@@ -228,14 +228,18 @@ static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_
if
(
PyUnicode_IS_ASCII
(
o
))
{
if
(
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
);
// Py3.7 returns a "const char*", need to cast to "char*" for backwards compatibility
// see https://bugs.python.org/issue28769
return
(
char
*
)
PyUnicode_AsUTF8
(
o
);
}
else
{
}
else
{
// raise the error
// raise the error
PyUnicode_AsASCIIString
(
o
);
PyUnicode_AsASCIIString
(
o
);
return
NULL
;
return
NULL
;
}
}
#else
/* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */
#else
/* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */
return
PyUnicode_AsUTF8AndSize
(
o
,
length
);
// Py3.7 returns a "const char*", need to cast to "char*" for backwards compatibility
// see https://bugs.python.org/issue28769
return
(
char
*
)
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 */
}
else
}
else
...
...
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