Commit 518cbac8 authored by da-woods's avatar da-woods Committed by GitHub

Remove obselete memoryview getbuffer fallback code (GH-4685)

It appears to have been be used for Python < 2.6 (which didn't have the new buffer protocol).
Most of the mechanism had already been removed, but the capsule attributes that it relied on were still generated.

Also removed some utility code that was only used for this feature.
parent 7846cbbc
......@@ -852,7 +852,7 @@ view_utility_code = load_memview_cy_utility(
is_contig_utility,
overlapping_utility,
copy_contents_new_utility,
ModuleNode.capsule_utility_code],
],
)
view_utility_allowlist = ('array', 'memoryview', 'array_cwrapper',
'generic', 'strided', 'indirect', 'contiguous',
......
......@@ -3918,5 +3918,3 @@ packed_struct_utility_code = UtilityCode(proto="""
#define __Pyx_PACKED
#endif
""", impl="", proto_block='utility_code_proto_before_types')
capsule_utility_code = UtilityCode.load("Capsule", "Capsule.c")
//////////////// Capsule.proto ////////////////
/* Todo: wrap the rest of the functionality in similar functions */
static CYTHON_INLINE PyObject *__pyx_capsule_create(void *p, const char *sig);
//////////////// Capsule ////////////////
static CYTHON_INLINE PyObject *
__pyx_capsule_create(void *p, const char *sig)
{
return PyCapsule_New(p, sig, NULL);
}
......@@ -78,10 +78,6 @@ cdef extern from *:
ctypedef struct __Pyx_TypeInfo:
pass
cdef object capsule "__pyx_capsule_create" (void *p, char *sig)
cdef int __pyx_array_getbuffer(PyObject *obj, Py_buffer view, int flags)
cdef int __pyx_memoryview_getbuffer(PyObject *obj, Py_buffer view, int flags)
cdef extern from *:
ctypedef int __pyx_atomic_int
{{memviewslice_name}} slice_copy_contig "__pyx_memoryview_copy_new_contig"(
......@@ -202,8 +198,6 @@ cdef class array:
info.format = self.format if flags & PyBUF_FORMAT else NULL
info.obj = self
__pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
def __dealloc__(array self):
if self.callback_free_data != NULL:
self.callback_free_data(self.data)
......@@ -560,8 +554,6 @@ cdef class memoryview:
info.readonly = self.view.readonly
info.obj = self
__pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")
# Some properties that have the same semantics as in NumPy
@property
def T(self):
......@@ -1004,8 +996,6 @@ cdef class _memoryviewslice(memoryview):
cdef _get_base(self):
return self.from_object
__pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")
@cname('__pyx_memoryview_fromslice')
cdef memoryview_fromslice({{memviewslice_name}} memviewslice,
......
......@@ -27,12 +27,12 @@ _WARNINGS = """
36:10: 'cpdef_cname_method' redeclared
# from MemoryView.pyx
329:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
329:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
987:29: Ambiguous exception value, same as default return value: 0
987:29: Ambiguous exception value, same as default return value: 0
1014:46: Ambiguous exception value, same as default return value: 0
1014:46: Ambiguous exception value, same as default return value: 0
1104:29: Ambiguous exception value, same as default return value: 0
1104:29: Ambiguous exception value, same as default return value: 0
323:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
323:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
979:29: Ambiguous exception value, same as default return value: 0
979:29: Ambiguous exception value, same as default return value: 0
1004:46: Ambiguous exception value, same as default return value: 0
1004:46: Ambiguous exception value, same as default return value: 0
1094:29: Ambiguous exception value, same as default return value: 0
1094:29: Ambiguous exception value, same as default return value: 0
"""
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment