diff options
author | Armin Rigo <armin.rigo@gmail.com> | 2018-01-11 08:14:03 +0000 |
---|---|---|
committer | Armin Rigo <armin.rigo@gmail.com> | 2018-01-11 08:14:03 +0000 |
commit | b14d4e996aa0579675044304dd32bcef864295f7 (patch) | |
tree | 08923ae571649d3412cb07162824f5228bd98853 /doc | |
parent | deb869869a3a67e42644018621e60da3814eaa77 (diff) | |
parent | 588260c990e5e012575102b9d92618e0ada2f94e (diff) | |
download | cffi-b14d4e996aa0579675044304dd32bcef864295f7.tar.gz |
Merged in cosmo0920/cffi/fix-typo (pull request #84)
Fix typo
Diffstat (limited to 'doc')
-rw-r--r-- | doc/source/conf.py | 2 | ||||
-rw-r--r-- | doc/source/installation.rst | 8 | ||||
-rw-r--r-- | doc/source/overview.rst | 29 | ||||
-rw-r--r-- | doc/source/whatsnew.rst | 10 |
4 files changed, 35 insertions, 14 deletions
diff --git a/doc/source/conf.py b/doc/source/conf.py index 4163237..a9b1002 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -47,7 +47,7 @@ copyright = u'2012-2015, Armin Rigo, Maciej Fijalkowski' # The short X.Y version. version = '1.11' # The full version, including alpha/beta/rc tags. -release = '1.11.2' +release = '1.11.3' # 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 index 70c9f66..9016ccb 100644 --- a/doc/source/installation.rst +++ b/doc/source/installation.rst @@ -53,13 +53,13 @@ Download and Installation: * https://pypi.python.org/pypi/cffi -* Checksums of the "source" package version 1.11.2: +* Checksums of the "source" package version 1.11.3: - - MD5: a731487324b501c8295221b629d3f5f3 + - MD5: ... - - SHA: 04d2df85eb1921630b4f9206886737eb37200c19 + - SHA: ... - - SHA256: ab87dd91c0c4073758d07334c1e5f712ce8fe48f007b86f8238773963ee700a6 + - SHA256: ... * Or grab the most current version from the `Bitbucket page`_: ``hg clone https://bitbucket.org/cffi/cffi`` diff --git a/doc/source/overview.rst b/doc/source/overview.rst index e4d5d95..f36127e 100644 --- a/doc/source/overview.rst +++ b/doc/source/overview.rst @@ -45,8 +45,9 @@ arguments. In the above example it would be ``b"world"`` and ``b"hi there, %s!\n"``. In general it is ``somestring.encode(myencoding)``. *Python 3 on Windows:* ``ffi.dlopen(None)`` does not work. This problem -is messy and not really fixable. The example above could be fixed by -calling another function from a specific DLL that exists on your system. +is messy and not really fixable. The problem does not occur if you try +to call a fucntion from a specific DLL that exists on your system: then +you use ``ffi.dlopen("path.dll")``. *This example does not call any C compiler. It works in the so-called ABI mode, which means that it will crash if you call some function or @@ -76,20 +77,27 @@ Real example (API level, out-of-line) ffibuilder = FFI() ffibuilder.set_source("_example", - r""" // passed to the real C compiler + r""" // passed to the real C compiler, + // contains implementation of things declared in cdef() #include <sys/types.h> #include <pwd.h> + + struct passwd *get_pw_for_root(void) { + return getpwuid(0); + } """, libraries=[]) # or a list of libraries to link with # (more arguments like setup.py's Extension class: # include_dirs=[..], extra_objects=[..], and so on) - ffibuilder.cdef(""" // some declarations from the man page + ffibuilder.cdef(""" + // declarations that are shared between Python and C struct passwd { char *pw_name; ...; // literally dot-dot-dot }; - struct passwd *getpwuid(int uid); + struct passwd *getpwuid(int uid); // defined in <pwd.h> + struct passwd *get_pw_for_root(void); // defined in set_source() """) if __name__ == "__main__": @@ -113,15 +121,18 @@ Then, in your main program, you use: p = lib.getpwuid(0) assert ffi.string(p.pw_name) == b'root' + p = lib.get_pw_for_root() + assert ffi.string(p.pw_name) == b'root' Note that this works independently of the exact C layout of ``struct passwd`` (it is "API level", as opposed to "ABI level"). It requires a C compiler in order to run ``example_build.py``, but it is much more portable than trying to get the details of the fields of ``struct -passwd`` exactly right. Similarly, we declared ``getpwuid()`` as -taking an ``int`` argument. On some platforms this might be slightly -incorrect---but it does not matter. It is also faster than the ABI -mode. +passwd`` exactly right. Similarly, in the ``cdef()`` we declared +``getpwuid()`` as taking an ``int`` argument; on some platforms this +might be slightly incorrect---but it does not matter. + +Note also that at runtime, the API mode is faster than the ABI mode. To integrate it inside a ``setup.py`` distribution with Setuptools: diff --git a/doc/source/whatsnew.rst b/doc/source/whatsnew.rst index cc83529..9c4f342 100644 --- a/doc/source/whatsnew.rst +++ b/doc/source/whatsnew.rst @@ -3,6 +3,16 @@ What's New ====================== +v1.11.3 +======= + +* More Windows fixes: MSVC does not support large literal strings in C + code (from ``ffi.embedding_init_code(large_string)``); and a MSVC-only + issue with ``Py_LIMITED_API`` on CPython 3.x. + +* Other misc. issues and documentation improvements + + v1.11.2 ======= |