[pypy-commit] cffi default: fixes

arigo pypy.commits at gmail.com
Thu Dec 17 07:50:27 EST 2015


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r2481:935bf011a8cf
Date: 2015-12-17 13:50 +0100
http://bitbucket.org/cffi/cffi/changeset/935bf011a8cf/

Log:	fixes

diff --git a/c/commontypes.c b/c/commontypes.c
--- a/c/commontypes.c
+++ b/c/commontypes.c
@@ -199,7 +199,8 @@
 
 static PyObject *b__get_common_types(PyObject *self, PyObject *arg)
 {
-    int i, err;
+    int err;
+    size_t i;
     for (i = 0; i < num_common_simple_types; i++) {
         const char *s = common_simple_types[i];
         PyObject *o = PyText_FromString(s + strlen(s) + 1);
diff --git a/c/misc_thread_posix.h b/c/misc_thread_posix.h
--- a/c/misc_thread_posix.h
+++ b/c/misc_thread_posix.h
@@ -100,6 +100,17 @@
 #endif
 
 
+/* Seems that CPython 3.5 made our job harder.  Did not find out how
+   to do that without these hacks.  We can't use PyThreadState_GET(),
+   because that calls PyThreadState_Get() which fails an assert if the
+   result is NULL. */
+#if (PY_MAJOR_VERSION * 1000 + PY_MINOR_VERSION) >= 3005
+void *volatile _PyThreadState_Current;
+   /* XXX simple volatile access is assumed atomic */
+#  define _Py_atomic_load_relaxed(pp)  (*(pp))
+#endif
+
+
 static PyThreadState *get_current_ts(void)
 {
 #if PY_MAJOR_VERSION >= 3


More information about the pypy-commit mailing list