Skip to content

Commit a567541

Browse files
author
amaury.forgeotdarc
committed
#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. git-svn-id: http://svn.python.org/projects/python/trunk@66891 6015fed2-1504-0410-9fe1-9d1591cc4771
1 parent 2fe814e commit a567541

3 files changed

Lines changed: 11 additions & 1 deletion

File tree

Include/unicodeobject.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ typedef PY_UNICODE_TYPE Py_UNICODE;
354354
in most situations is solely ASCII whitespace, we optimize for the common
355355
case by using a quick look-up table with an inlined check.
356356
*/
357-
extern const unsigned char _Py_ascii_whitespace[];
357+
PyAPI_DATA(const unsigned char) _Py_ascii_whitespace[];
358358

359359
#define Py_UNICODE_ISSPACE(ch) \
360360
((ch) < 128U ? _Py_ascii_whitespace[(ch)] : _PyUnicode_IsWhitespace(ch))

Misc/NEWS

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ Build
3636

3737
- Issue #3758: Add ``patchcheck`` build target to .PHONY.
3838

39+
C-API
40+
-----
41+
42+
- Issue #4122: On Windows, fix a compilation error when using the
43+
Py_UNICODE_ISSPACE macro in an extension module.
44+
3945

4046
What's New in Python 2.6 final
4147
==============================

Modules/_testcapimodule.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,10 @@ test_u_code(PyObject *self)
484484
Py_UNICODE *value;
485485
int len;
486486

487+
/* issue4122: Undefined reference to _Py_ascii_whitespace on Windows */
488+
/* Just use the macro and check that it compiles */
489+
int x = Py_UNICODE_ISSPACE(25);
490+
487491
tuple = PyTuple_New(1);
488492
if (tuple == NULL)
489493
return NULL;

0 commit comments

Comments
 (0)