Author: Armin Rigo <ar...@tunes.org>
Branch: release-1.11
Changeset: r3046:59ead014cdee
Date: 2017-10-08 08:50 +0200
http://bitbucket.org/cffi/cffi/changeset/59ead014cdee/

Log:    hg merge default

diff --git a/c/_cffi_backend.c b/c/_cffi_backend.c
--- a/c/_cffi_backend.c
+++ b/c/_cffi_backend.c
@@ -2,7 +2,7 @@
 #include <Python.h>
 #include "structmember.h"
 
-#define CFFI_VERSION  "1.11.1"
+#define CFFI_VERSION  "1.11.2"
 
 #ifdef MS_WIN32
 #include <windows.h>
diff --git a/c/misc_thread_common.h b/c/misc_thread_common.h
--- a/c/misc_thread_common.h
+++ b/c/misc_thread_common.h
@@ -62,33 +62,35 @@
 #endif
 
 
-/* Seems that CPython 3.5.1 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.  We can use _PyThreadState_UncheckedGet() from 3.6,
-   though.  It was added in 3.5.2 but should never be used in 3.5.x
-   because it is not available in 3.5.0 or 3.5.1. */
-#if PY_VERSION_HEX >= 0x03060000
+/* MESS.  We can't use PyThreadState_GET(), because that calls
+   PyThreadState_Get() which fails an assert if the result is NULL.
+   
+   * in Python 2.7 and <= 3.4, the variable _PyThreadState_Current
+     is directly available, so use that.
+
+   * in Python 3.5, the variable is available too, but it might be
+     the case that the headers don't define it (this changed in 3.5.1).
+     In case we're compiling with 3.5.x with x >= 1, we need to
+     manually define this variable.
+
+   * in Python >= 3.6 there is _PyThreadState_UncheckedGet().
+     It was added in 3.5.2 but should never be used in 3.5.x
+     because it is not available in 3.5.0 or 3.5.1.
+*/
+#if PY_VERSION_HEX >= 0x03050100 && PY_VERSION_HEX < 0x03060000
+PyAPI_DATA(void *volatile) _PyThreadState_Current;
+#endif
+
 static PyThreadState *get_current_ts(void)
 {
+#if PY_VERSION_HEX >= 0x03060000
     return _PyThreadState_UncheckedGet();
+#elif defined(_Py_atomic_load_relaxed)
+    return (PyThreadState*)_Py_atomic_load_relaxed(&_PyThreadState_Current);
+#else
+    return (PyThreadState*)_PyThreadState_Current;  /* assume atomic read */
+#endif
 }
-#else
-#  if PY_MAJOR_VERSION >= 3 && !defined(_Py_atomic_load_relaxed)
-                             /* this was abruptly un-defined in 3.5.1 */
-extern 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 defined(_Py_atomic_load_relaxed)
-    return (PyThreadState*)_Py_atomic_load_relaxed(&_PyThreadState_Current);
-#  else
-    return _PyThreadState_Current;
-#  endif
-}
-#endif
 
 static PyGILState_STATE gil_ensure(void)
 {
diff --git a/c/test_c.py b/c/test_c.py
--- a/c/test_c.py
+++ b/c/test_c.py
@@ -12,7 +12,7 @@
 # ____________________________________________________________
 
 import sys
-assert __version__ == "1.11.1", ("This test_c.py file is for testing a version"
+assert __version__ == "1.11.2", ("This test_c.py file is for testing a version"
                                  " of cffi that differs from the one that we"
                                  " get from 'import _cffi_backend'")
 if sys.version_info < (3,):
diff --git a/cffi/__init__.py b/cffi/__init__.py
--- a/cffi/__init__.py
+++ b/cffi/__init__.py
@@ -4,8 +4,8 @@
 from .api import FFI
 from .error import CDefError, FFIError, VerificationError, VerificationMissing
 
-__version__ = "1.11.1"
-__version_info__ = (1, 11, 1)
+__version__ = "1.11.2"
+__version_info__ = (1, 11, 2)
 
 # The verifier module file names are based on the CRC32 of a string that
 # contains the following version number.  It may be older than __version__
diff --git a/cffi/_embedding.h b/cffi/_embedding.h
--- a/cffi/_embedding.h
+++ b/cffi/_embedding.h
@@ -247,7 +247,7 @@
 
         if (f != NULL && f != Py_None) {
             PyFile_WriteString("\nFrom: " _CFFI_MODULE_NAME
-                               "\ncompiled with cffi version: 1.11.1"
+                               "\ncompiled with cffi version: 1.11.2"
                                "\n_cffi_backend module: ", f);
             modules = PyImport_GetModuleDict();
             mod = PyDict_GetItemString(modules, "_cffi_backend");
diff --git a/doc/source/conf.py b/doc/source/conf.py
--- a/doc/source/conf.py
+++ b/doc/source/conf.py
@@ -47,7 +47,7 @@
 # The short X.Y version.
 version = '1.11'
 # The full version, including alpha/beta/rc tags.
-release = '1.11.1'
+release = '1.11.2'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
diff --git a/doc/source/installation.rst b/doc/source/installation.rst
--- a/doc/source/installation.rst
+++ b/doc/source/installation.rst
@@ -53,13 +53,13 @@
 
 * https://pypi.python.org/pypi/cffi
 
-* Checksums of the "source" package version 1.11.1:
+* Checksums of the "source" package version 1.11.2:
 
-   - MD5: 89dfa1bb3b3e28eafb5da3e345a19f56
+   - MD5: ...
 
-   - SHA: f3a61a3b53b482a7d05704344e0f055d4672fa01
+   - SHA: ...
 
-   - SHA256: 4c40817cc0f71b5351eb0bdd0b585db4a285c2bcc03fbcb961b79bb8086b7576
+   - SHA256: ...
 
 * Or grab the most current version from the `Bitbucket page`_:
   ``hg clone https://bitbucket.org/cffi/cffi``
diff --git a/doc/source/whatsnew.rst b/doc/source/whatsnew.rst
--- a/doc/source/whatsnew.rst
+++ b/doc/source/whatsnew.rst
@@ -3,6 +3,12 @@
 ======================
 
 
+v1.11.2
+=======
+
+* Fix Windows issue with managing the thread-state on CPython 3.0 to 3.5
+
+
 v1.11.1
 =======
 
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -186,7 +186,7 @@
 
 `Mailing list <https://groups.google.com/forum/#!forum/python-cffi>`_
 """,
-        version='1.11.1',
+        version='1.11.2',
         packages=['cffi'] if cpython else [],
         package_data={'cffi': ['_cffi_include.h', 'parse_c_type.h', 
                                '_embedding.h', '_cffi_errors.h']}
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to