[pypy-svn] r73687 - pypy/branch/cpython-extension/pypy/module/cpyext/include
xoraxax at codespeak.net
xoraxax at codespeak.net
Tue Apr 13 00:55:11 CEST 2010
Author: xoraxax
Date: Tue Apr 13 00:55:09 2010
New Revision: 73687
Modified:
pypy/branch/cpython-extension/pypy/module/cpyext/include/Python.h
Log:
Add new macros from pyport/pyconfig.
Modified: pypy/branch/cpython-extension/pypy/module/cpyext/include/Python.h
==============================================================================
--- pypy/branch/cpython-extension/pypy/module/cpyext/include/Python.h (original)
+++ pypy/branch/cpython-extension/pypy/module/cpyext/include/Python.h Tue Apr 13 00:55:09 2010
@@ -25,7 +25,8 @@
#define PY_SSIZE_T_MAX ((Py_ssize_t)(((size_t)-1)>>1))
#define PY_SSIZE_T_MIN (-PY_SSIZE_T_MAX-1)
#define Py_SAFE_DOWNCAST(VALUE, WIDE, NARROW) (NARROW)(VALUE)
-// obviously wrong
+
+#define Py_USING_UNICODE
// from pyport.h
#ifdef SIZE_MAX
@@ -33,6 +34,32 @@
#else
#define PY_SIZE_MAX ((size_t)-1)
#endif
+/* uintptr_t is the C9X name for an unsigned integral type such that a
+ * legitimate void* can be cast to uintptr_t and then back to void* again
+ * without loss of information. Similarly for intptr_t, wrt a signed
+ * integral type.
+ */
+#ifdef HAVE_UINTPTR_T
+typedef uintptr_t Py_uintptr_t;
+typedef intptr_t Py_intptr_t;
+
+#elif SIZEOF_VOID_P <= SIZEOF_INT
+typedef unsigned int Py_uintptr_t;
+typedef int Py_intptr_t;
+
+#elif SIZEOF_VOID_P <= SIZEOF_LONG
+typedef unsigned long Py_uintptr_t;
+typedef long Py_intptr_t;
+
+#elif defined(HAVE_LONG_LONG) && (SIZEOF_VOID_P <= SIZEOF_LONG_LONG)
+typedef unsigned PY_LONG_LONG Py_uintptr_t;
+typedef PY_LONG_LONG Py_intptr_t;
+
+#else
+# error "Python needs a typedef for Py_uintptr_t in pyport.h."
+#endif /* HAVE_UINTPTR_T */
+
+
/* Convert a possibly signed character to a nonnegative int */
/* XXX This assumes characters are 8 bits wide */
More information about the Pypy-commit
mailing list