Commit 84311ceb authored by Stefan Behnel's avatar Stefan Behnel

removed dead code from buffer tests

--HG--
extra : transplant_source : m%879%8BW%7D%87%87%F5oYoA%ABl%88I%EF%92%FA
parent e995613b
...@@ -9,10 +9,14 @@ ...@@ -9,10 +9,14 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from cpython.object cimport PyObject
from cpython.ref cimport Py_INCREF, Py_DECREF
cimport cython
__test__ = {} __test__ = {}
import sys import sys
import re #import re
exclude = []#re.compile('object').search] exclude = []#re.compile('object').search]
def testcase(func): def testcase(func):
......
...@@ -10,6 +10,10 @@ u''' ...@@ -10,6 +10,10 @@ u'''
from cython.view cimport memoryview, array from cython.view cimport memoryview, array
from cython cimport view from cython cimport view
from cpython.object cimport PyObject
from cpython.ref cimport Py_INCREF, Py_DECREF
cimport cython
cdef extern from "Python.h": cdef extern from "Python.h":
cdef int PyBUF_C_CONTIGUOUS cdef int PyBUF_C_CONTIGUOUS
......
...@@ -4,6 +4,9 @@ ...@@ -4,6 +4,9 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from cpython.object cimport PyObject
from cpython.ref cimport Py_INCREF, Py_DECREF
cimport cython cimport cython
from cython cimport view from cython cimport view
from cython.view cimport array from cython.view cimport array
......
from libc cimport stdlib from libc cimport stdlib
from libc cimport stdio from libc cimport stdio
cimport cpython.buffer cimport cpython.buffer
cimport cython
from cpython cimport PyObject, Py_INCREF, Py_DECREF
import sys import sys
...@@ -231,16 +228,6 @@ cdef class ObjectMockBuffer(MockBuffer): ...@@ -231,16 +228,6 @@ cdef class ObjectMockBuffer(MockBuffer):
cdef get_itemsize(self): return sizeof(void*) cdef get_itemsize(self): return sizeof(void*)
cdef get_default_format(self): return b"@O" cdef get_default_format(self): return b"@O"
cdef extern from "Python.h":
ctypedef struct PyObject:
pass
ctypedef int (*visitproc)(PyObject *obj, void *arg)
ctypedef int (*inquiry)(PyObject *self)
void Py_VISIT(object)
void Py_CLEAR(object)
cdef class IntStridedMockBuffer(IntMockBuffer): cdef class IntStridedMockBuffer(IntMockBuffer):
cdef __cythonbufferdefaults__ = {"mode" : "strided"} cdef __cythonbufferdefaults__ = {"mode" : "strided"}
...@@ -288,7 +275,7 @@ cdef struct NestedPackedStruct: ...@@ -288,7 +275,7 @@ cdef struct NestedPackedStruct:
cdef class MyStructMockBuffer(MockBuffer): cdef class MyStructMockBuffer(MockBuffer):
cdef int write(self, char* buf, object value) except -1: cdef int write(self, char* buf, object value) except -1:
cdef MyStruct* s cdef MyStruct* s
s = <MyStruct*>buf; s = <MyStruct*>buf
s.a, s.b, s.c, s.d, s.e = value s.a, s.b, s.c, s.d, s.e = value
return 0 return 0
...@@ -298,7 +285,7 @@ cdef class MyStructMockBuffer(MockBuffer): ...@@ -298,7 +285,7 @@ cdef class MyStructMockBuffer(MockBuffer):
cdef class NestedStructMockBuffer(MockBuffer): cdef class NestedStructMockBuffer(MockBuffer):
cdef int write(self, char* buf, object value) except -1: cdef int write(self, char* buf, object value) except -1:
cdef NestedStruct* s cdef NestedStruct* s
s = <NestedStruct*>buf; s = <NestedStruct*>buf
s.x.a, s.x.b, s.y.a, s.y.b, s.z = value s.x.a, s.x.b, s.y.a, s.y.b, s.z = value
return 0 return 0
...@@ -308,7 +295,7 @@ cdef class NestedStructMockBuffer(MockBuffer): ...@@ -308,7 +295,7 @@ cdef class NestedStructMockBuffer(MockBuffer):
cdef class PackedStructMockBuffer(MockBuffer): cdef class PackedStructMockBuffer(MockBuffer):
cdef int write(self, char* buf, object value) except -1: cdef int write(self, char* buf, object value) except -1:
cdef PackedStruct* s cdef PackedStruct* s
s = <PackedStruct*>buf; s = <PackedStruct*>buf
s.a, s.b = value s.a, s.b = value
return 0 return 0
...@@ -318,7 +305,7 @@ cdef class PackedStructMockBuffer(MockBuffer): ...@@ -318,7 +305,7 @@ cdef class PackedStructMockBuffer(MockBuffer):
cdef class NestedPackedStructMockBuffer(MockBuffer): cdef class NestedPackedStructMockBuffer(MockBuffer):
cdef int write(self, char* buf, object value) except -1: cdef int write(self, char* buf, object value) except -1:
cdef NestedPackedStruct* s cdef NestedPackedStruct* s
s = <NestedPackedStruct*>buf; s = <NestedPackedStruct*>buf
s.a, s.b, s.sub.a, s.sub.b, s.c = value s.a, s.b, s.sub.a, s.sub.b, s.c = value
return 0 return 0
...@@ -332,7 +319,7 @@ cdef struct LongComplex: ...@@ -332,7 +319,7 @@ cdef struct LongComplex:
cdef class LongComplexMockBuffer(MockBuffer): cdef class LongComplexMockBuffer(MockBuffer):
cdef int write(self, char* buf, object value) except -1: cdef int write(self, char* buf, object value) except -1:
cdef LongComplex* s cdef LongComplex* s
s = <LongComplex*>buf; s = <LongComplex*>buf
s.real, s.imag = value s.real, s.imag = value
return 0 return 0
......
...@@ -7,6 +7,7 @@ Test slicing for memoryviews and memoryviewslices ...@@ -7,6 +7,7 @@ Test slicing for memoryviews and memoryviewslices
cimport numpy as np cimport numpy as np
import numpy as np import numpy as np
cimport cython
include "cythonarrayutil.pxi" include "cythonarrayutil.pxi"
include "mockbuffers.pxi" include "mockbuffers.pxi"
......
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