]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
#4122: On Windows, Py_UNICODE_ISSPACE cannot be used in an extension module:
authorAmaury Forgeot d'Arc <amauryfa@gmail.com>
Tue, 14 Oct 2008 21:47:22 +0000 (21:47 +0000)
committerAmaury Forgeot d'Arc <amauryfa@gmail.com>
Tue, 14 Oct 2008 21:47:22 +0000 (21:47 +0000)
compilation fails with "undefined reference to _Py_ascii_whitespace"

Will backport to 2.6.

Include/unicodeobject.h
Misc/NEWS
Modules/_testcapimodule.c

index 057f770539562cc156bb04f18f129ced75e85939..ee9fec16fe77021139830bd0b803685139bcf3de 100644 (file)
@@ -354,7 +354,7 @@ typedef PY_UNICODE_TYPE Py_UNICODE;
    in most situations is solely ASCII whitespace, we optimize for the common
    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) \
        ((ch) < 128U ? _Py_ascii_whitespace[(ch)] : _PyUnicode_IsWhitespace(ch))
index 3cfdc06dd48122a8236a4d62e11509d5136aea8a..e583ff1174e656c23346b3a411d4ec6978a1642b 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -36,6 +36,12 @@ Build
 
 - 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
 ==============================
index f3a9f5ce9d043db57f752c75141d3df859ea13f6..adb04c0bb8757366fdcacc9e4306c48a83e72b4f 100644 (file)
@@ -484,6 +484,10 @@ test_u_code(PyObject *self)
        Py_UNICODE *value;
        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);
         if (tuple == NULL)
                return NULL;