Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
cython
Commits
3a6b9856
Commit
3a6b9856
authored
Apr 07, 2013
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove dead Py2.7+ code in <Py2.6 only code blocks and clean them up a bit
parent
553bed86
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
41 deletions
+26
-41
Cython/Utility/Buffer.c
Cython/Utility/Buffer.c
+26
-41
No files found.
Cython/Utility/Buffer.c
View file @
3a6b9856
...
...
@@ -107,8 +107,6 @@ typedef struct {
/////////////// GetAndReleaseBuffer ///////////////
#if PY_MAJOR_VERSION < 3
static
int
__Pyx_GetBuffer
(
PyObject
*
obj
,
Py_buffer
*
view
,
int
flags
)
{
CYTHON_UNUSED
PyObject
*
getbuffer_cobj
;
#if PY_VERSION_HEX >= 0x02060000
if
(
PyObject_CheckBuffer
(
obj
))
return
PyObject_GetBuffer
(
obj
,
view
,
flags
);
#endif
...
...
@@ -120,16 +118,11 @@ static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
{{
endfor
}}
#if PY_VERSION_HEX < 0x02060000
if
(
obj
->
ob_type
->
tp_dict
&&
(
getbuffer_cobj
=
PyObject_GetItem
(
obj
->
ob_type
->
tp_dict
,
PYIDENT
(
"__pyx_getbuffer"
))))
{
getbufferproc
func
;
#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0)
func
=
(
getbufferproc
)
PyCapsule_GetPointer
(
getbuffer_cobj
,
"getbuffer(obj, view, flags)"
);
#else
func
=
(
getbufferproc
)
PyCObject_AsVoidPtr
(
getbuffer_cobj
);
#endif
if
(
obj
->
ob_type
->
tp_dict
)
{
PyObject
*
getbuffer_cobj
=
PyObject_GetItem
(
obj
->
ob_type
->
tp_dict
,
PYIDENT
(
"__pyx_getbuffer"
));
if
(
getbuffer_cobj
)
{
getbufferproc
func
=
(
getbufferproc
)
PyCObject_AsVoidPtr
(
getbuffer_cobj
);
Py_DECREF
(
getbuffer_cobj
);
if
(
!
func
)
goto
fail
;
...
...
@@ -138,6 +131,7 @@ static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
}
else
{
PyErr_Clear
();
}
}
#endif
PyErr_Format
(
PyExc_TypeError
,
"'%100s' does not have the buffer interface"
,
Py_TYPE
(
obj
)
->
tp_name
);
...
...
@@ -151,8 +145,6 @@ fail:
static
void
__Pyx_ReleaseBuffer
(
Py_buffer
*
view
)
{
PyObject
*
obj
=
view
->
obj
;
CYTHON_UNUSED
PyObject
*
releasebuffer_cobj
;
if
(
!
obj
)
return
;
#if PY_VERSION_HEX >= 0x02060000
...
...
@@ -169,27 +161,20 @@ static void __Pyx_ReleaseBuffer(Py_buffer *view) {
{{
endfor
}}
#if PY_VERSION_HEX < 0x02060000
if
(
obj
->
ob_type
->
tp_dict
&&
(
releasebuffer_cobj
=
PyObject_GetItem
(
obj
->
ob_type
->
tp_dict
,
PYIDENT
(
"__pyx_releasebuffer"
))))
{
releasebufferproc
func
;
#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0)
func
=
(
releasebufferproc
)
PyCapsule_GetPointer
(
releasebuffer_cobj
,
"releasebuffer(obj, view)"
);
#else
func
=
(
releasebufferproc
)
PyCObject_AsVoidPtr
(
releasebuffer_cobj
);
#endif
if
(
obj
->
ob_type
->
tp_dict
)
{
PyObject
*
releasebuffer_cobj
=
PyObject_GetItem
(
obj
->
ob_type
->
tp_dict
,
PYIDENT
(
"__pyx_releasebuffer"
));
if
(
releasebuffer_cobj
)
{
releasebufferproc
func
=
(
releasebufferproc
)
PyCObject_AsVoidPtr
(
releasebuffer_cobj
);
Py_DECREF
(
releasebuffer_cobj
);
if
(
!
func
)
goto
fail
;
func
(
obj
,
view
);
return
;
}
else
{
PyErr_Clear
();
}
}
#endif
goto
nofail
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment