#4122: On Windows, Py_UNICODE_ISSPACE cannot be used in an extension module:

compilation fails with "undefined reference to _Py_ascii_whitespace"

Will backport to 2.6.
This commit is contained in:
Amaury Forgeot d'Arc 2008-10-14 21:47:22 +00:00
parent 0ecbccad2d
commit 07d539d08b
3 changed files with 11 additions and 1 deletions

View File

@ -354,7 +354,7 @@ typedef PY_UNICODE_TYPE Py_UNICODE;
in most situations is solely ASCII whitespace, we optimize for the common in most situations is solely ASCII whitespace, we optimize for the common
case by using a quick look-up table with an inlined check. case by using a quick look-up table with an inlined check.
*/ */
extern const unsigned char _Py_ascii_whitespace[]; PyAPI_DATA(const unsigned char) _Py_ascii_whitespace[];
#define Py_UNICODE_ISSPACE(ch) \ #define Py_UNICODE_ISSPACE(ch) \
((ch) < 128U ? _Py_ascii_whitespace[(ch)] : _PyUnicode_IsWhitespace(ch)) ((ch) < 128U ? _Py_ascii_whitespace[(ch)] : _PyUnicode_IsWhitespace(ch))

View File

@ -36,6 +36,12 @@ Build
- Issue #3758: Add ``patchcheck`` build target to .PHONY. - Issue #3758: Add ``patchcheck`` build target to .PHONY.
C-API
-----
- Issue #4122: On Windows, fix a compilation error when using the
Py_UNICODE_ISSPACE macro in an extension module.
What's New in Python 2.6 final What's New in Python 2.6 final
============================== ==============================

View File

@ -484,6 +484,10 @@ test_u_code(PyObject *self)
Py_UNICODE *value; Py_UNICODE *value;
int len; int len;
/* issue4122: Undefined reference to _Py_ascii_whitespace on Windows */
/* Just use the macro and check that it compiles */
int x = Py_UNICODE_ISSPACE(25);
tuple = PyTuple_New(1); tuple = PyTuple_New(1);
if (tuple == NULL) if (tuple == NULL)
return NULL; return NULL;