Author: Armin Rigo <ar...@tunes.org>
Branch: release-1.12
Changeset: r3233:2c4239852fde
Date: 2019-02-26 16:00 +0100
http://bitbucket.org/cffi/cffi/changeset/2c4239852fde/

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.12.1"
+#define CFFI_VERSION  "1.12.2"
 
 #ifdef MS_WIN32
 #include <windows.h>
diff --git a/c/call_python.c b/c/call_python.c
--- a/c/call_python.c
+++ b/c/call_python.c
@@ -1,3 +1,9 @@
+#if PY_VERSION_HEX >= 0x03080000
+# define Py_BUILD_CORE
+/* for access to the fields of PyInterpreterState */
+#  include "internal/pycore_pystate.h"
+# undef Py_BUILD_CORE
+#endif
 
 static PyObject *_get_interpstate_dict(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.12.1", ("This test_c.py file is for testing a version"
+assert __version__ == "1.12.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
@@ -5,8 +5,8 @@
 from .error import CDefError, FFIError, VerificationError, VerificationMissing
 from .error import PkgConfigError
 
-__version__ = "1.12.1"
-__version_info__ = (1, 12, 1)
+__version__ = "1.12.2"
+__version_info__ = (1, 12, 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
@@ -221,7 +221,7 @@
 
         if (f != NULL && f != Py_None) {
             PyFile_WriteString("\nFrom: " _CFFI_MODULE_NAME
-                               "\ncompiled with cffi version: 1.12.1"
+                               "\ncompiled with cffi version: 1.12.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.12'
 # The full version, including alpha/beta/rc tags.
-release = '1.12.1'
+release = '1.12.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
@@ -52,13 +52,13 @@
 
 * https://pypi.python.org/pypi/cffi
 
-* Checksums of the "source" package version 1.12.1:
+* Checksums of the "source" package version 1.12.2:
 
-   - MD5: d6d5c4805bbce844cf1368702b056e3c
+   - MD5: ...
 
-   - SHA: b4d8d74a22d0574cb056502daa2c377898f0a910
+   - SHA: ...
 
-   - SHA256: 9b6f7ba4e78c52c1a291d0c0c0bd745d19adde1a9e1c03cb899f0c6efd6f8033
+   - SHA256: ...
 
 * Or grab the most current version from the `Bitbucket page`_:
   ``hg clone https://bitbucket.org/cffi/cffi``
diff --git a/doc/source/ref.rst b/doc/source/ref.rst
--- a/doc/source/ref.rst
+++ b/doc/source/ref.rst
@@ -146,36 +146,43 @@
 +++++++++++++++++++++++++++++++
 
 **ffi.buffer(cdata, [size])**: return a buffer object that references
-the raw C data pointed to by the given 'cdata', of 'size' bytes.  The
-'cdata' must be a pointer or an array.  If unspecified, the size of the
+the raw C data pointed to by the given 'cdata', of 'size' bytes.  What
+Python calls "a buffer", or more precisely "an object supporting the
+buffer interface", is an object that represents some raw memory and
+that can be passed around to various built-in or extension functions;
+these built-in functions read from or write to the raw memory directly,
+without needing an extra copy.
+
+The 'cdata' argument
+must be a pointer or an array.  If unspecified, the size of the
 buffer is either the size of what ``cdata`` points to, or the whole size
-of the array.  Getting a buffer is useful because you can read from it
-without an extra copy, or write into it to change the original value.
+of the array.
 
 Here are a few examples of where buffer() would be useful:
 
 -  use ``file.write()`` and ``file.readinto()`` with
    such a buffer (for files opened in binary mode)
 
--  use ``ffi.buffer(mystruct[0])[:] = socket.recv(len(buffer))`` to read
-   into a struct over a socket, rewriting the contents of mystruct[0]
+-  overwrite the content of a struct: if ``p`` is a cdata pointing to
+   it, use ``ffi.buffer(p)[:] = newcontent``, where ``newcontent`` is
+   a bytes object (``str`` in Python 2).
 
 Remember that like in C, you can use ``array + index`` to get the pointer
 to the index'th item of an array.  (In C you might more naturally write
 ``&array[index]``, but that is equivalent.)
 
-The returned object is not a built-in buffer nor memoryview object,
-because these objects' API changes too much across Python versions.
-Instead it has the following Python API (a subset of Python 2's
-``buffer``):
+The returned object's type is not the builtin ``buffer`` nor ``memoryview``
+types, because these types' API changes too much across Python versions.
+Instead it has the following Python API (a subset of Python 2's ``buffer``)
+in addition to supporting the buffer interface:
 
-- ``buf[:]`` or ``bytes(buf)``: fetch a copy as a regular byte string (or
-  ``buf[start:end]`` for a part)
+- ``buf[:]`` or ``bytes(buf)``: copy data out of the buffer, returning a
+  regular byte string (or ``buf[start:end]`` for a part)
 
-- ``buf[:] = newstr``: change the original content (or ``buf[start:end]
+- ``buf[:] = newstr``: copy data into the buffer (or ``buf[start:end]
   = newstr``)
 
-- ``len(buf), buf[index], buf[index] = newchar``: access as a sequence
+- ``len(buf)``, ``buf[index]``, ``buf[index] = newchar``: access as a sequence
   of characters.
 
 The buffer object returned by ``ffi.buffer(cdata)`` keeps alive the
@@ -193,9 +200,11 @@
 **ffi.from_buffer([cdecl,] python_buffer, require_writable=False)**:
 return an array cdata (by default a ``<cdata 'char[]'>``) that
 points to the data of the given Python object, which must support the
-buffer interface.  This is the opposite of ``ffi.buffer()``.  It gives
-a reference to the existing data, not a copy.
-It is meant to be used on objects
+buffer interface.  Note that ``ffi.from_buffer()`` turns a generic
+Python buffer object into a cdata object, whereas ``ffi.buffer()`` does
+the opposite conversion.  Both calls don't actually copy any data.
+
+``ffi.from_buffer()`` is meant to be used on objects
 containing large quantities of raw data, like bytearrays
 or ``array.array`` or numpy
 arrays.  It supports both the old *buffer* API (in Python 2.x) and the
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.12.2
+=======
+
+* Added temporary workaround to compile on CPython 3.8.0a2.
+
+
 v1.12.1
 =======
 
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -198,7 +198,7 @@
 
 `Mailing list <https://groups.google.com/forum/#!forum/python-cffi>`_
 """,
-        version='1.12.1',
+        version='1.12.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