use '%lld' format for Py_ssize_t on Win64+MSVC if supported
authorStefan Behnel <stefan_ml@behnel.de>
Fri, 31 Aug 2012 05:10:36 +0000 (07:10 +0200)
committerStefan Behnel <stefan_ml@behnel.de>
Fri, 31 Aug 2012 05:10:36 +0000 (07:10 +0200)
Cython/Utility/ModuleSetupCode.c

index 4094249..ef3f6d2 100644 (file)
 #endif
 
 #if defined(_WIN64) && defined(_MSC_VER)
+  // CPython misdefines the format as "I", but the
+  // "ll" prefix is only supported in Py2.7 and later
+  #if PY_VERSION_HEX >= 0x02070000
+  #define CYTHON_FORMAT_SSIZE_T "ll"
+  #else
   #define CYTHON_FORMAT_SSIZE_T "z"
+  #endif
 #else
   #define CYTHON_FORMAT_SSIZE_T PY_FORMAT_SIZE_T
 #endif