Cython Changelog
================
+0.29.13 (2019-07-26)
+====================
+
+Bugs fixed
+----------
+
+* A reference leak for ``None`` was fixed when converting a memoryview
+ to a Python object. (Github issue #3023)
+
+* The declaration of ``PyGILState_STATE`` in ``cpython.pystate`` was unusable.
+ Patch by Kirill Smelkov. (Github issue #2997)
+
+
+Other changes
+-------------
+
+* The declarations in ``posix.mman`` were extended.
+ Patches by Kirill Smelkov. (Github issues #2893, #2894, #3012)
+
+
0.29.12 (2019-07-07)
====================
#: Decref global variables in each module on exit for garbage collection.
#: 0: None, 1+: interned objects, 2+: cdef globals, 3+: types objects
-#: Mostly for reducing noise in Valgrind, only executes at process exit
+#: Mostly for reducing noise in Valgrind as it typically executes at process exit
#: (when all memory will be reclaimed anyways).
+#: Note that directly or indirectly executed cleanup code that makes use of global
+#: variables or types may no longer be safe when enabling the respective level since
+#: there is no guaranteed order in which the (reference counted) objects will
+#: be cleaned up. The order can change due to live references and reference cycles.
generate_cleanup_code = False
#: Should tp_clear() set object fields to None instead of clearing them to NULL?
# This is not actually a struct, but make sure it can never be coerced to
# an int or used in arithmetic expressions
- ctypedef struct PyGILState_STATE
+ ctypedef struct PyGILState_STATE:
+ pass
# The type of the trace function registered using PyEval_SetProfile() and
# PyEval_SetTrace().
enum: MAP_NOCORE # Typically available only on BSD
enum: MAP_NOSYNC
+ void *MAP_FAILED
+
void *mmap(void *addr, size_t Len, int prot, int flags, int fd, off_t off)
int munmap(void *addr, size_t Len)
int mprotect(void *addr, size_t Len, int prot)
int munlock(const void *addr, size_t Len)
int mlockall(int flags)
int munlockall()
+ # Linux-specific
+ enum: MLOCK_ONFAULT
+ enum: MCL_ONFAULT
+ int mlock2(const void *addr, size_t len, int flags)
int shm_open(const char *name, int oflag, mode_t mode)
int shm_unlink(const char *name)
# often available
- enum: MADV_REMOVE # pre-POSIX advice flags; often available
+ enum: MADV_NORMAL # pre-POSIX advice flags; should translate 1-1 to POSIX_*
+ enum: MADV_RANDOM # but in practice it is not always the same.
+ enum: MADV_SEQUENTIAL
+ enum: MADV_WILLNEED
+ enum: MADV_DONTNEED
+ enum: MADV_REMOVE # other pre-POSIX advice flags; often available
enum: MADV_DONTFORK
enum: MADV_DOFORK
enum: MADV_HWPOISON
enum: MADV_MERGEABLE,
enum: MADV_UNMERGEABLE
+ enum: MADV_SOFT_OFFLINE
+ enum: MADV_HUGEPAGE
+ enum: MADV_NOHUGEPAGE
+ enum: MADV_DONTDUMP
+ enum: MADV_DODUMP
+ enum: MADV_FREE
+ enum: MADV_WIPEONFORK
+ enum: MADV_KEEPONFORK
int madvise(void *addr, size_t Len, int advice)
# sometimes available
# cython.* namespace for pure mode.
from __future__ import absolute_import
-__version__ = "0.29.12"
+__version__ = "0.29.13"
try:
from __builtin__ import basestring
def __dealloc__(memoryview self):
if self.obj is not None:
__Pyx_ReleaseBuffer(&self.view)
+ elif (<__pyx_buffer *> &self.view).obj == Py_None:
+ # Undo the incref in __cinit__() above.
+ (<__pyx_buffer *> &self.view).obj = NULL
+ Py_DECREF(Py_None)
cdef int i
global __pyx_memoryview_thread_locks_used
buf = mslice
buf[1] = {3-2: 2+(2*4)-2}
+
+def test_pyview_of_memview(int[:] ints):
+ """
+ >>> A = IntMockBuffer(None, [1, 2, 3])
+ >>> len(test_pyview_of_memview(A))
+ 3
+ """
+ return ints
+
+
def test_generic_slicing(arg, indirect=False):
"""
Test simple slicing
# tag: c-api
from cpython cimport mem
+from cpython.pystate cimport PyGILState_Ensure, PyGILState_Release, PyGILState_STATE
def test_pymalloc():
mem.PyMem_RawFree(m)
assert m2
return retval
+
+
+def test_gilstate():
+ """
+ >>> test_gilstate()
+ 'ok'
+ """
+
+ # cython used to have invalid definition for PyGILState_STATE, which was
+ # making the following code fail to compile
+ cdef PyGILState_STATE gstate = PyGILState_Ensure()
+ # TODO assert that GIL is taken
+ PyGILState_Release(gstate)
+ return 'ok'