1====================== 2What's New 3====================== 4 5v1.15.0 6======= 7 8* Fixed MANIFEST.in to include missing file for Windows arm64 support 9 10* Fixed Linux wheel build to use gcc default ISA for libffi 11 12* Updated setup.py Python trove specifiers to currently-tested Python versions 13 14* CPython 3.10 support (including wheels) 15 16* MacOS arm64 support (including wheels) 17 18* Initial Windows arm64 support 19 20* Misc. doc and test updates 21 22v1.14.6 23======= 24 25* Test fixes for CPython 3.10.0b3 26 27* Support for `sys.unraisablehook()` on Python >= 3.8 28 29* Fix two minor memory leaks (thanks Sebastian!) 30 31* Like many projects that had an IRC channel on freenode, we moved it to 32 ``irc.libera.chat``. 33 34v1.14.5 35======= 36 37* Source fix for old gcc versions 38 39* This and future releases should include wheels on more platforms, 40 thanks to our new release managers Matt and Matt! 41 42v1.14.4 43======= 44 45Release done for pip reasons. 46 47v1.14.3 48======= 49 50Release done for pip reasons. 51 52v1.14.2 53======= 54 55* CPython 3 on Windows: we again try to compile with ``Py_LIMITED_API`` 56 by default. This flag is not added if you run the compilation with 57 CPython 3.4, as it only works with CPython >= 3.5, but by now this 58 version of Python is quite old (and we no longer distribute cffi 59 wheels for it). 60 61 This may require that you upgrade ``virtualenv`` (requires version 16 62 or newer) or at least copy manually ``python3.dll`` into your existing 63 virtualenvs. For distributing wheels with your cffi modules, you may 64 also need to upgrade ``wheel`` to the just-released version 0.35. 65 66 You can manually disable ``Py_LIMITED_API`` by calling 67 ``ffi.set_source(..., py_limited_api=False)``. 68 69 70v1.14.1 71======= 72 73* CFFI source code is now `hosted on Heptapod`_. 74 75* Improved support for ``typedef int my_array_t[...];`` with an explicit 76 dot-dot-dot in API mode (`issue #453`_) 77 78* Windows (32 and 64 bits): multiple fixes for ABI-mode call to functions 79 that return a structure. 80 81* Experimental support for MacOS 11 on aarch64. 82 83* and a few other minor changes and bug fixes. 84 85.. _`hosted on Heptapod`: https://foss.heptapod.net/pypy/cffi/ 86.. _`issue #453`: https://foss.heptapod.net/pypy/cffi/issues/453 87 88 89v1.14 90===== 91 92* ``ffi.dlopen()`` can now be called with a handle (as a ``void *``) to an 93 already-opened C library. 94 95* CPython only: fixed a stack overflow issue for calls like 96 ``lib.myfunc([large list])``. If the function is declared as taking a 97 ``float *`` argument, for example, then the array is temporarily converted 98 into a C array of floats---however, the code used to use ``alloca()`` for 99 this temporary storage, no matter how large. This is now fixed. 100 101 The fix concerns all modes: in-line/out-of-line API/ABI. Also note that your 102 API-mode C extension modules need to be regenerated with cffi 1.14 in order 103 to get the fix; i.e. for API mode, the fix is in the generated C sources. 104 (The C sources generated from cffi 1.14 should also work when running in 105 a different environment in which we have an older version of cffi. Also, 106 this change makes no difference on PyPy.) 107 108 As a workaround that works on all versions of cffi, you can write 109 ``lib.myfunc(ffi.new("float[]", [large list]))``, which is 110 equivalent but explicity builds the intermediate array as a regular 111 Python object on the heap. 112 113* fixed a memory leak inside ``ffi.getwinerror()`` on CPython 3.x. 114 115 116v1.13.2 117======= 118 119* re-release because the Linux wheels came with an attached version of libffi 120 that was very old and buggy (`issue #432`_). 121 122.. _`issue #432`: https://foss.heptapod.net/pypy/cffi/-/issues/432 123 124 125 126v1.13.1 127======= 128 129* deprecate the way to declare in ``cdef()`` a global variable with only 130 ``void *foo;``. You should always use a storage class, like ``extern void 131 *foo;`` or maybe ``static void *foo;``. These are all equivalent for 132 the purposes of ``cdef()``, but the reason for deprecating the bare version 133 is that (as far as I know) it would always be mistake in a real C header. 134 135* fix the regression ``RuntimeError: found a situation in which we try 136 to build a type recursively`` (`issue #429`_). 137 138* fixed `issue #427`_ where a multithreading mistake in the embedding logic 139 initialization code would cause deadlocks on CPython 3.7. 140 141.. _`issue #429`: https://foss.heptapod.net/pypy/cffi/-/issues/429 142.. _`issue #427`: https://foss.heptapod.net/pypy/cffi/-/issues/427 143 144 145v1.13 146===== 147 148* ``ffi.from_buffer("type *", ..)`` is now supported, in addition to 149 ``"type[]"``. You can then write ``p.field`` to access the items, instead 150 of only ``p[0].field``. Be careful that no bounds checking is performed, so 151 ``p[n]`` might access data out of bounds. 152 153* fix for structs containing unnamed bitfields like ``int : 1;``. 154 155* when calling cdata of "function pointer" type, give a RuntimeError instead 156 of a crash if the pointer happens to be NULL 157 158* support some more binary operations between constants in enum definitions 159 (PR #96) 160 161* silence a warning incorrectly emitted if you use a quote in a preprocessor 162 line 163 164* detect a corner case that would throw the C code into an infinite 165 recursion, with ``ffi.cdef("""struct X { void(*fnptr)(struct X); };""")`` 166 167 168Older Versions 169============== 170 171v1.12.3 172------- 173 174* Fix for nested struct types that end in a var-sized array (#405). 175 176* Add support for using ``U`` and ``L`` characters at the end of integer 177 constants in ``ffi.cdef()`` (thanks Guillaume). 178 179* More 3.8 fixes. 180 181 182v1.12.2 183------- 184 185* Added temporary workaround to compile on CPython 3.8.0a2. 186 187 188v1.12.1 189------- 190 191* CPython 3 on Windows: we again no longer compile with ``Py_LIMITED_API`` 192 by default because such modules *still* cannot be used with virtualenv. 193 The problem is that it doesn't work in CPython <= 3.4, and for 194 technical reason we can't enable this flag automatically based on the 195 version of Python. 196 197 Like before, `Issue #350`_ mentions a workaround if you still want 198 the ``Py_LIMITED_API`` flag and *either* you are not concerned about 199 virtualenv *or* you are sure your module will not be used on CPython 200 <= 3.4: pass ``define_macros=[("Py_LIMITED_API", None)]`` as a keyword to the 201 ``ffibuilder.set_source()`` call. 202 203 204v1.12 205----- 206 207* `Direct support for pkg-config`__. 208 209* ``ffi.from_buffer()`` takes a new optional *first* argument that gives 210 the array type of the result. It also takes an optional keyword argument 211 ``require_writable`` to refuse read-only Python buffers. 212 213* ``ffi.new()``, ``ffi.gc()`` or ``ffi.from_buffer()`` cdata objects 214 can now be released at known times, either by using the ``with`` 215 keyword or by calling the new ``ffi.release()``. 216 217* Windows, CPython 3.x: cffi modules are linked with ``python3.dll`` 218 again. This makes them independant on the exact CPython version, 219 like they are on other platforms. **It requires virtualenv 16.0.0.** 220 221* Accept an expression like ``ffi.new("int[4]", p)`` if ``p`` is itself 222 another cdata ``int[4]``. 223 224* CPython 2.x: ``ffi.dlopen()`` failed with non-ascii file names on Posix 225 226* CPython: if a thread is started from C and then runs Python code (with 227 callbacks or with the embedding solution), then previous versions of 228 cffi would contain possible crashes and/or memory leaks. Hopefully, 229 this has been fixed (see `issue #362`_). 230 231* Support for ``ffi.cdef(..., pack=N)`` where N is a power of two. 232 Means to emulate ``#pragma pack(N)`` on MSVC. Also, the default on 233 Windows is now ``pack=8``, like on MSVC. This might make a difference 234 in corner cases, although I can't think of one in the context of CFFI. 235 The old way ``ffi.cdef(..., packed=True)`` remains and is equivalent 236 to ``pack=1`` (saying e.g. that fields like ``int`` should be aligned 237 to 1 byte instead of 4). 238 239.. __: cdef.html#pkgconfig 240.. _`issue #362`: https://foss.heptapod.net/pypy/cffi/-/issues/362 241 242 243v1.11.5 244------- 245 246* `Issue #357`_: fix ``ffi.emit_python_code()`` which generated a buggy 247 Python file if you are using a ``struct`` with an anonymous ``union`` 248 field or vice-versa. 249 250* Windows: ``ffi.dlopen()`` should now handle unicode filenames. 251 252* ABI mode: implemented ``ffi.dlclose()`` for the in-line case (it used 253 to be present only in the out-of-line case). 254 255* Fixed a corner case for ``setup.py install --record=xx --root=yy`` 256 with an out-of-line ABI module. Also fixed `Issue #345`_. 257 258* More hacks on Windows for running CFFI's own ``setup.py``. 259 260* `Issue #358`_: in embedding, to protect against (the rare case of) 261 Python initialization from several threads in parallel, we have to use 262 a spin-lock. On CPython 3 it is worse because it might spin-lock for 263 a long time (execution of ``Py_InitializeEx()``). Sadly, recent 264 changes to CPython make that solution needed on CPython 2 too. 265 266* CPython 3 on Windows: we no longer compile with ``Py_LIMITED_API`` 267 by default because such modules cannot be used with virtualenv. 268 `Issue #350`_ mentions a workaround if you still want that and are not 269 concerned about virtualenv: pass ``define_macros=[("Py_LIMITED_API", 270 None)]`` as a keyword to the ``ffibuilder.set_source()`` call. 271 272.. _`Issue #345`: https://foss.heptapod.net/pypy/cffi/-/issues/345 273.. _`Issue #350`: https://foss.heptapod.net/pypy/cffi/-/issues/350 274.. _`Issue #358`: https://foss.heptapod.net/pypy/cffi/-/issues/358 275.. _`Issue #357`: https://foss.heptapod.net/pypy/cffi/-/issues/357 276 277 278v1.11.4 279------- 280 281* Windows: reverted linking with ``python3.dll``, because 282 virtualenv does not make this DLL available to virtual environments 283 for now. See `Issue #355`_. On Windows only, the C extension 284 modules created by cffi follow for now the standard naming scheme 285 ``foo.cp36-win32.pyd``, to make it clear that they are regular 286 CPython modules depending on ``python36.dll``. 287 288.. _`Issue #355`: https://foss.heptapod.net/pypy/cffi/-/issues/355 289 290 291v1.11.3 292------- 293 294* Fix on CPython 3.x: reading the attributes ``__loader__`` or 295 ``__spec__`` from the cffi-generated lib modules gave a buggy 296 SystemError. (These attributes are always None, and provided only to 297 help compatibility with tools that expect them in all modules.) 298 299* More Windows fixes: workaround for MSVC not supporting large 300 literal strings in C code (from 301 ``ffi.embedding_init_code(large_string)``); and an issue with 302 ``Py_LIMITED_API`` linking with ``python35.dll/python36.dll`` instead 303 of ``python3.dll``. 304 305* Small documentation improvements. 306 307 308v1.11.2 309------- 310 311* Fix Windows issue with managing the thread-state on CPython 3.0 to 3.5 312 313 314v1.11.1 315------- 316 317* Fix tests, remove deprecated C API usage 318 319* Fix (hack) for 3.6.0/3.6.1/3.6.2 giving incompatible binary extensions 320 (cpython issue `#29943`_) 321 322* Fix for 3.7.0a1+ 323 324.. _`#29943`: https://bugs.python.org/issue29943 325 326 327v1.11 328----- 329 330* Support the modern standard types ``char16_t`` and ``char32_t``. 331 These work like ``wchar_t``: they represent one unicode character, or 332 when used as ``charN_t *`` or ``charN_t[]`` they represent a unicode 333 string. The difference with ``wchar_t`` is that they have a known, 334 fixed size. They should work at all places that used to work with 335 ``wchar_t`` (please report an issue if I missed something). Note 336 that with ``set_source()``, you need to make sure that these types are 337 actually defined by the C source you provide (if used in ``cdef()``). 338 339* Support the C99 types ``float _Complex`` and ``double _Complex``. 340 Note that libffi doesn't support them, which means that in the ABI 341 mode you still cannot call C functions that take complex numbers 342 directly as arguments or return type. 343 344* Fixed a rare race condition when creating multiple ``FFI`` instances 345 from multiple threads. (Note that you aren't meant to create many 346 ``FFI`` instances: in inline mode, you should write ``ffi = 347 cffi.FFI()`` at module level just after ``import cffi``; and in 348 out-of-line mode you don't instantiate ``FFI`` explicitly at all.) 349 350* Windows: using callbacks can be messy because the CFFI internal error 351 messages show up to stderr---but stderr goes nowhere in many 352 applications. This makes it particularly hard to get started with the 353 embedding mode. (Once you get started, you can at least use 354 ``@ffi.def_extern(onerror=...)`` and send the error logs where it 355 makes sense for your application, or record them in log files, and so 356 on.) So what is new in CFFI is that now, on Windows CFFI will try to 357 open a non-modal MessageBox (in addition to sending raw messages to 358 stderr). The MessageBox is only visible if the process stays alive: 359 typically, console applications that crash close immediately, but that 360 is also the situation where stderr should be visible anyway. 361 362* Progress on support for `callbacks in NetBSD`__. 363 364* Functions returning booleans would in some case still return 0 or 1 365 instead of False or True. Fixed. 366 367* `ffi.gc()`__ now takes an optional third parameter, which gives an 368 estimate of the size (in bytes) of the object. So far, this is only 369 used by PyPy, to make the next GC occur more quickly (`issue #320`__). 370 In the future, this might have an effect on CPython too (provided 371 the CPython `issue 31105`__ is addressed). 372 373* Add a note to the documentation: the ABI mode gives function objects 374 that are *slower* to call than the API mode does. For some reason it 375 is often thought to be faster. It is not! 376 377.. __: https://foss.heptapod.net/pypy/cffi/-/issues/321 378.. __: ref.html#ffi-gc 379.. __: https://foss.heptapod.net/pypy/cffi/-/issues/320 380.. __: http://bugs.python.org/issue31105 381 382 383v1.10.1 384------- 385 386(only released inside PyPy 5.8.0) 387 388* Fixed the line numbers reported in case of ``cdef()`` errors. 389 Also, I just noticed, but pycparser always supported the preprocessor 390 directive ``# 42 "foo.h"`` to mean "from the next line, we're in file 391 foo.h starting from line 42", which it puts in the error messages. 392 393 394v1.10 395----- 396 397* Issue #295: use calloc() directly instead of 398 PyObject_Malloc()+memset() to handle ffi.new() with a default 399 allocator. Speeds up ``ffi.new(large-array)`` where most of the time 400 you never touch most of the array. 401 402* Some OS/X build fixes ("only with Xcode but without CLT"). 403 404* Improve a couple of error messages: when getting mismatched versions 405 of cffi and its backend; and when calling functions which cannot be 406 called with libffi because an argument is a struct that is "too 407 complicated" (and not a struct *pointer*, which always works). 408 409* Add support for some unusual compilers (non-msvc, non-gcc, non-icc, 410 non-clang) 411 412* Implemented the remaining cases for ``ffi.from_buffer``. Now all 413 buffer/memoryview objects can be passed. The one remaining check is 414 against passing unicode strings in Python 2. (They support the buffer 415 interface, but that gives the raw bytes behind the UTF16/UCS4 storage, 416 which is most of the times not what you expect. In Python 3 this has 417 been fixed and the unicode strings don't support the memoryview 418 interface any more.) 419 420* The C type ``_Bool`` or ``bool`` now converts to a Python boolean 421 when reading, instead of the content of the byte as an integer. The 422 potential incompatibility here is what occurs if the byte contains a 423 value different from 0 and 1. Previously, it would just return it; 424 with this change, CFFI raises an exception in this case. But this 425 case means "undefined behavior" in C; if you really have to interface 426 with a library relying on this, don't use ``bool`` in the CFFI side. 427 Also, it is still valid to use a byte string as initializer for a 428 ``bool[]``, but now it must only contain ``\x00`` or ``\x01``. As an 429 aside, ``ffi.string()`` no longer works on ``bool[]`` (but it never 430 made much sense, as this function stops at the first zero). 431 432* ``ffi.buffer`` is now the name of cffi's buffer type, and 433 ``ffi.buffer()`` works like before but is the constructor of that type. 434 435* ``ffi.addressof(lib, "name")`` now works also in in-line mode, not 436 only in out-of-line mode. This is useful for taking the address of 437 global variables. 438 439* Issue #255: ``cdata`` objects of a primitive type (integers, floats, 440 char) are now compared and ordered by value. For example, ``<cdata 441 'int' 42>`` compares equal to ``42`` and ``<cdata 'char' b'A'>`` 442 compares equal to ``b'A'``. Unlike C, ``<cdata 'int' -1>`` does not 443 compare equal to ``ffi.cast("unsigned int", -1)``: it compares 444 smaller, because ``-1 < 4294967295``. 445 446* PyPy: ``ffi.new()`` and ``ffi.new_allocator()()`` did not record 447 "memory pressure", causing the GC to run too infrequently if you call 448 ``ffi.new()`` very often and/or with large arrays. Fixed in PyPy 5.7. 449 450* Support in ``ffi.cdef()`` for numeric expressions with ``+`` or 451 ``-``. Assumes that there is no overflow; it should be fixed first 452 before we add more general support for arbitrary arithmetic on 453 constants. 454 455 456v1.9 457---- 458 459* Structs with variable-sized arrays as their last field: now we track 460 the length of the array after ``ffi.new()`` is called, just like we 461 always tracked the length of ``ffi.new("int[]", 42)``. This lets us 462 detect out-of-range accesses to array items. This also lets us 463 display a better ``repr()``, and have the total size returned by 464 ``ffi.sizeof()`` and ``ffi.buffer()``. Previously both functions 465 would return a result based on the size of the declared structure 466 type, with an assumed empty array. (Thanks andrew for starting this 467 refactoring.) 468 469* Add support in ``cdef()/set_source()`` for unspecified-length arrays 470 in typedefs: ``typedef int foo_t[...];``. It was already supported 471 for global variables or structure fields. 472 473* I turned in v1.8 a warning from ``cffi/model.py`` into an error: 474 ``'enum xxx' has no values explicitly defined: refusing to guess which 475 integer type it is meant to be (unsigned/signed, int/long)``. Now I'm 476 turning it back to a warning again; it seems that guessing that the 477 enum has size ``int`` is a 99%-safe bet. (But not 100%, so it stays 478 as a warning.) 479 480* Fix leaks in the code handling ``FILE *`` arguments. In CPython 3 481 there is a remaining issue that is hard to fix: if you pass a Python 482 file object to a ``FILE *`` argument, then ``os.dup()`` is used and 483 the new file descriptor is only closed when the GC reclaims the Python 484 file object---and not at the earlier time when you call ``close()``, 485 which only closes the original file descriptor. If this is an issue, 486 you should avoid this automatic convertion of Python file objects: 487 instead, explicitly manipulate file descriptors and call ``fdopen()`` 488 from C (...via cffi). 489 490 491v1.8.3 492------ 493 494* When passing a ``void *`` argument to a function with a different 495 pointer type, or vice-versa, the cast occurs automatically, like in C. 496 The same occurs for initialization with ``ffi.new()`` and a few other 497 places. However, I thought that ``char *`` had the same 498 property---but I was mistaken. In C you get the usual warning if you 499 try to give a ``char *`` to a ``char **`` argument, for example. 500 Sorry about the confusion. This has been fixed in CFFI by giving for 501 now a warning, too. It will turn into an error in a future version. 502 503 504v1.8.2 505------ 506 507* Issue #283: fixed ``ffi.new()`` on structures/unions with nested 508 anonymous structures/unions, when there is at least one union in 509 the mix. When initialized with a list or a dict, it should now 510 behave more closely like the ``{ }`` syntax does in GCC. 511 512 513v1.8.1 514------ 515 516* CPython 3.x: experimental: the generated C extension modules now use 517 the "limited API", which means that, as a compiled .so/.dll, it should 518 work directly on any version of CPython >= 3.2. The name produced by 519 distutils is still version-specific. To get the version-independent 520 name, you can rename it manually to ``NAME.abi3.so``, or use the very 521 recent setuptools 26. 522 523* Added ``ffi.compile(debug=...)``, similar to ``python setup.py build 524 --debug`` but defaulting to True if we are running a debugging 525 version of Python itself. 526 527 528v1.8 529---- 530 531* Removed the restriction that ``ffi.from_buffer()`` cannot be used on 532 byte strings. Now you can get a ``char *`` out of a byte string, 533 which is valid as long as the string object is kept alive. (But 534 don't use it to *modify* the string object! If you need this, use 535 ``bytearray`` or other official techniques.) 536 537* PyPy 5.4 can now pass a byte string directly to a ``char *`` 538 argument (in older versions, a copy would be made). This used to be 539 a CPython-only optimization. 540 541 542v1.7 543---- 544 545* ``ffi.gc(p, None)`` removes the destructor on an object previously 546 created by another call to ``ffi.gc()`` 547 548* ``bool(ffi.cast("primitive type", x))`` now returns False if the 549 value is zero (including ``-0.0``), and True otherwise. Previously 550 this would only return False for cdata objects of a pointer type when 551 the pointer is NULL. 552 553* bytearrays: ``ffi.from_buffer(bytearray-object)`` is now supported. 554 (The reason it was not supported was that it was hard to do in PyPy, 555 but it works since PyPy 5.3.) To call a C function with a ``char *`` 556 argument from a buffer object---now including bytearrays---you write 557 ``lib.foo(ffi.from_buffer(x))``. Additionally, this is now supported: 558 ``p[0:length] = bytearray-object``. The problem with this was that a 559 iterating over bytearrays gives *numbers* instead of *characters*. 560 (Now it is implemented with just a memcpy, of course, not actually 561 iterating over the characters.) 562 563* C++: compiling the generated C code with C++ was supposed to work, 564 but failed if you make use the ``bool`` type (because that is rendered 565 as the C ``_Bool`` type, which doesn't exist in C++). 566 567* ``help(lib)`` and ``help(lib.myfunc)`` now give useful information, 568 as well as ``dir(p)`` where ``p`` is a struct or pointer-to-struct. 569 570 571v1.6 572---- 573 574* `ffi.list_types()`_ 575 576* `ffi.unpack()`_ 577 578* `extern "Python+C"`_ 579 580* in API mode, ``lib.foo.__doc__`` contains the C signature now. On 581 CPython you can say ``help(lib.foo)``, but for some reason 582 ``help(lib)`` (or ``help(lib.foo)`` on PyPy) is still useless; I 583 haven't yet figured out the hacks needed to convince ``pydoc`` to 584 show more. (You can use ``dir(lib)`` but it is not most helpful.) 585 586* Yet another attempt at robustness of ``ffi.def_extern()`` against 587 CPython's interpreter shutdown logic. 588 589.. _`ffi.list_types()`: ref.html#ffi-list-types 590.. _`ffi.unpack()`: ref.html#ffi-unpack 591.. _`extern "Python+C"`: using.html#extern-python-c 592 593 594v1.5.2 595------ 596 597* Fix 1.5.1 for Python 2.6. 598 599 600v1.5.1 601------ 602 603* A few installation-time tweaks (thanks Stefano!) 604 605* Issue #245: Win32: ``__stdcall`` was never generated for 606 ``extern "Python"`` functions 607 608* Issue #246: trying to be more robust against CPython's fragile 609 interpreter shutdown logic 610 611 612v1.5.0 613------ 614 615* Support for `using CFFI for embedding`__. 616 617.. __: embedding.html 618 619 620v1.4.2 621------ 622 623Nothing changed from v1.4.1. 624 625 626v1.4.1 627------ 628 629* Fix the compilation failure of cffi on CPython 3.5.0. (3.5.1 works; 630 some detail changed that makes some underscore-starting macros 631 disappear from view of extension modules, and I worked around it, 632 thinking it changed in all 3.5 versions---but no: it was only in 633 3.5.1.) 634 635 636v1.4.0 637------ 638 639* A `better way to do callbacks`__ has been added (faster and more 640 portable, and usually cleaner). It is a mechanism for the 641 out-of-line API mode that replaces the dynamic creation of callback 642 objects (i.e. C functions that invoke Python) with the static 643 declaration in ``cdef()`` of which callbacks are needed. This is 644 more C-like, in that you have to structure your code around the idea 645 that you get a fixed number of function pointers, instead of 646 creating them on-the-fly. 647 648* ``ffi.compile()`` now takes an optional ``verbose`` argument. When 649 ``True``, distutils prints the calls to the compiler. 650 651* ``ffi.compile()`` used to fail if given ``sources`` with a path that 652 includes ``".."``. Fixed. 653 654* ``ffi.init_once()`` added. See docs__. 655 656* ``dir(lib)`` now works on libs returned by ``ffi.dlopen()`` too. 657 658* Cleaned up and modernized the content of the ``demo`` subdirectory 659 in the sources (thanks matti!). 660 661* ``ffi.new_handle()`` is now guaranteed to return unique ``void *`` 662 values, even if called twice on the same object. Previously, in 663 that case, CPython would return two ``cdata`` objects with the same 664 ``void *`` value. This change is useful to add and remove handles 665 from a global dict (or set) without worrying about duplicates. 666 It already used to work like that on PyPy. 667 *This change can break code that used to work on CPython by relying 668 on the object to be kept alive by other means than keeping the 669 result of ffi.new_handle() alive.* (The corresponding `warning in 670 the docs`__ of ``ffi.new_handle()`` has been here since v0.8!) 671 672.. __: using.html#extern-python 673.. __: ref.html#ffi-init-once 674.. __: ref.html#ffi-new-handle 675 676 677v1.3.1 678------ 679 680* The optional typedefs (``bool``, ``FILE`` and all Windows types) were 681 not always available from out-of-line FFI objects. 682 683* Opaque enums are phased out from the cdefs: they now give a warning, 684 instead of (possibly wrongly) being assumed equal to ``unsigned int``. 685 Please report if you get a reasonable use case for them. 686 687* Some parsing details, notably ``volatile`` is passed along like 688 ``const`` and ``restrict``. Also, older versions of pycparser 689 mis-parse some pointer-to-pointer types like ``char * const *``: the 690 "const" ends up at the wrong place. Added a workaround. 691 692 693v1.3.0 694------ 695 696* Added `ffi.memmove()`_. 697 698* Pull request #64: out-of-line API mode: we can now declare 699 floating-point types with ``typedef float... foo_t;``. This only 700 works if ``foo_t`` is a float or a double, not ``long double``. 701 702* Issue #217: fix possible unaligned pointer manipulation, which crashes 703 on some architectures (64-bit, non-x86). 704 705* Issues #64 and #126: when using ``set_source()`` or ``verify()``, 706 the ``const`` and ``restrict`` keywords are copied from the cdef 707 to the generated C code; this fixes warnings by the C compiler. 708 It also fixes corner cases like ``typedef const int T; T a;`` 709 which would previously not consider ``a`` as a constant. (The 710 cdata objects themselves are never ``const``.) 711 712* Win32: support for ``__stdcall``. For callbacks and function 713 pointers; regular C functions still don't need to have their `calling 714 convention`_ declared. 715 716* Windows: CPython 2.7 distutils doesn't work with Microsoft's official 717 Visual Studio for Python, and I'm told this is `not a bug`__. For 718 ffi.compile(), we `removed a workaround`__ that was inside cffi but 719 which had unwanted side-effects. Try saying ``import setuptools`` 720 first, which patches distutils... 721 722.. _`ffi.memmove()`: ref.html#ffi-memmove 723.. __: https://bugs.python.org/issue23246 724.. __: https://bitbucket.org/cffi/cffi/pull-requests/65/remove-_hack_at_distutils-which-imports/diff 725.. _`calling convention`: using.html#windows-calling-conventions 726 727 728v1.2.1 729------ 730 731Nothing changed from v1.2.0. 732 733 734v1.2.0 735------ 736 737* Out-of-line mode: ``int a[][...];`` can be used to declare a structure 738 field or global variable which is, simultaneously, of total length 739 unknown to the C compiler (the ``a[]`` part) and each element is 740 itself an array of N integers, where the value of N *is* known to the 741 C compiler (the ``int`` and ``[...]`` parts around it). Similarly, 742 ``int a[5][...];`` is supported (but probably less useful: remember 743 that in C it means ``int (a[5])[...];``). 744 745* PyPy: the ``lib.some_function`` objects were missing the attributes 746 ``__name__``, ``__module__`` and ``__doc__`` that are expected e.g. by 747 some decorators-management functions from ``functools``. 748 749* Out-of-line API mode: you can now do ``from _example.lib import x`` 750 to import the name ``x`` from ``_example.lib``, even though the 751 ``lib`` object is not a standard module object. (Also works in ``from 752 _example.lib import *``, but this is even more of a hack and will fail 753 if ``lib`` happens to declare a name called ``__all__``. Note that 754 ``*`` excludes the global variables; only the functions and constants 755 make sense to import like this.) 756 757* ``lib.__dict__`` works again and gives you a copy of the 758 dict---assuming that ``lib`` has got no symbol called precisely 759 ``__dict__``. (In general, it is safer to use ``dir(lib)``.) 760 761* Out-of-line API mode: global variables are now fetched on demand at 762 every access. It fixes issue #212 (Windows DLL variables), and also 763 allows variables that are defined as dynamic macros (like ``errno``) 764 or ``__thread`` -local variables. (This change might also tighten 765 the C compiler's check on the variables' type.) 766 767* Issue #209: dereferencing NULL pointers now raises RuntimeError 768 instead of segfaulting. Meant as a debugging aid. The check is 769 only for NULL: if you dereference random or dead pointers you might 770 still get segfaults. 771 772* Issue #152: callbacks__: added an argument ``ffi.callback(..., 773 onerror=...)``. If the main callback function raises an exception 774 and ``onerror`` is provided, then ``onerror(exception, exc_value, 775 traceback)`` is called. This is similar to writing a ``try: 776 except:`` in the main callback function, but in some cases (e.g. a 777 signal) an exception can occur at the very start of the callback 778 function---before it had time to enter the ``try: except:`` block. 779 780* Issue #115: added ``ffi.new_allocator()``, which officializes 781 support for `alternative allocators`__. 782 783.. __: using.html#callbacks 784.. __: ref.html#ffi-new-allocator 785 786 787v1.1.2 788------ 789 790* ``ffi.gc()``: fixed a race condition in multithreaded programs 791 introduced in 1.1.1 792 793 794v1.1.1 795------ 796 797* Out-of-line mode: ``ffi.string()``, ``ffi.buffer()`` and 798 ``ffi.getwinerror()`` didn't accept their arguments as keyword 799 arguments, unlike their in-line mode equivalent. (It worked in PyPy.) 800 801* Out-of-line ABI mode: documented a restriction__ of ``ffi.dlopen()`` 802 when compared to the in-line mode. 803 804* ``ffi.gc()``: when called several times with equal pointers, it was 805 accidentally registering only the last destructor, or even none at 806 all depending on details. (It was correctly registering all of them 807 only in PyPy, and only with the out-of-line FFIs.) 808 809.. __: cdef.html#dlopen-note 810 811 812v1.1.0 813------ 814 815* Out-of-line API mode: we can now declare integer types with 816 ``typedef int... foo_t;``. The exact size and signedness of ``foo_t`` 817 is figured out by the compiler. 818 819* Out-of-line API mode: we can now declare multidimensional arrays 820 (as fields or as globals) with ``int n[...][...]``. Before, only the 821 outermost dimension would support the ``...`` syntax. 822 823* Out-of-line ABI mode: we now support any constant declaration, 824 instead of only integers whose value is given in the cdef. Such "new" 825 constants, i.e. either non-integers or without a value given in the 826 cdef, must correspond to actual symbols in the lib. At runtime they 827 are looked up the first time we access them. This is useful if the 828 library defines ``extern const sometype somename;``. 829 830* ``ffi.addressof(lib, "func_name")`` now returns a regular cdata object 831 of type "pointer to function". You can use it on any function from a 832 library in API mode (in ABI mode, all functions are already regular 833 cdata objects). To support this, you need to recompile your cffi 834 modules. 835 836* Issue #198: in API mode, if you declare constants of a ``struct`` 837 type, what you saw from lib.CONSTANT was corrupted. 838 839* Issue #196: ``ffi.set_source("package._ffi", None)`` would 840 incorrectly generate the Python source to ``package._ffi.py`` instead 841 of ``package/_ffi.py``. Also fixed: in some cases, if the C file was 842 in ``build/foo.c``, the .o file would be put in ``build/build/foo.o``. 843 844 845v1.0.3 846------ 847 848* Same as 1.0.2, apart from doc and test fixes on some platforms. 849 850 851v1.0.2 852------ 853 854* Variadic C functions (ending in a "..." argument) were not supported 855 in the out-of-line ABI mode. This was a bug---there was even a 856 (non-working) example__ doing exactly that! 857 858.. __: overview.html#out-of-line-abi-level 859 860 861v1.0.1 862------ 863 864* ``ffi.set_source()`` crashed if passed a ``sources=[..]`` argument. 865 Fixed by chrippa on pull request #60. 866 867* Issue #193: if we use a struct between the first cdef() where it is 868 declared and another cdef() where its fields are defined, then this 869 definition was ignored. 870 871* Enums were buggy if you used too many "..." in their definition. 872 873 874v1.0.0 875------ 876 877* The main news item is out-of-line module generation: 878 879 * `for ABI level`_, with ``ffi.dlopen()`` 880 881 * `for API level`_, which used to be with ``ffi.verify()``, now deprecated 882 883* (this page will list what is new from all versions from 1.0.0 884 forward.) 885 886.. _`for ABI level`: overview.html#out-of-line-abi-level 887.. _`for API level`: overview.html#out-of-line-api-level 888