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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
0c9a42ce
Commit
0c9a42ce
authored
Dec 17, 2009
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added .pxd for legacy Python 2 buffer interface
parent
fb3beff4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
64 additions
and
0 deletions
+64
-0
Cython/Includes/python.pxd
Cython/Includes/python.pxd
+1
-0
Cython/Includes/python_oldbuffer.pxd
Cython/Includes/python_oldbuffer.pxd
+63
-0
No files found.
Cython/Includes/python.pxd
View file @
0c9a42ce
...
...
@@ -146,6 +146,7 @@ from python_getargs cimport *
# Python <= 2.x
from
python_cobject
cimport
*
from
python_oldbuffer
cimport
*
# Python >= 2.4
from
python_set
cimport
*
...
...
Cython/Includes/python_oldbuffer.pxd
0 → 100644
View file @
0c9a42ce
# Legacy Python 2 buffer interface.
#
# These functions are no longer available in Python 3, use the new
# buffer interface instead.
cdef
extern
from
"Python.h"
:
cdef
enum
_
:
Py_END_OF_BUFFER
# This constant may be passed as the size parameter to
# PyBuffer_FromObject() or PyBuffer_FromReadWriteObject(). It
# indicates that the new PyBufferObject should refer to base object
# from the specified offset to the end of its exported
# buffer. Using this enables the caller to avoid querying the base
# object for its length.
bint
PyBuffer_Check
(
object
p
)
# Return true if the argument has type PyBuffer_Type.
object
PyBuffer_FromObject
(
object
base
,
Py_ssize_t
offset
,
Py_ssize_t
size
)
# Return value: New reference.
#
# Return a new read-only buffer object. This raises TypeError if
# base doesn't support the read-only buffer protocol or doesn't
# provide exactly one buffer segment, or it raises ValueError if
# offset is less than zero. The buffer will hold a reference to the
# base object, and the buffer's contents will refer to the base
# object's buffer interface, starting as position offset and
# extending for size bytes. If size is Py_END_OF_BUFFER, then the
# new buffer's contents extend to the length of the base object's
# exported buffer data.
object
PyBuffer_FromReadWriteObject
(
object
base
,
Py_ssize_t
offset
,
Py_ssize_t
size
)
# Return value: New reference.
#
# Return a new writable buffer object. Parameters and exceptions
# are similar to those for PyBuffer_FromObject(). If the base
# object does not export the writeable buffer protocol, then
# TypeError is raised.
object
PyBuffer_FromMemory
(
void
*
ptr
,
Py_ssize_t
size
)
# Return value: New reference.
#
# Return a new read-only buffer object that reads from a specified
# location in memory, with a specified size. The caller is
# responsible for ensuring that the memory buffer, passed in as
# ptr, is not deallocated while the returned buffer object
# exists. Raises ValueError if size is less than zero. Note that
# Py_END_OF_BUFFER may not be passed for the size parameter;
# ValueError will be raised in that case.
object
PyBuffer_FromReadWriteMemory
(
void
*
ptr
,
Py_ssize_t
size
)
# Return value: New reference.
#
# Similar to PyBuffer_FromMemory(), but the returned buffer is
# writable.
object
PyBuffer_New
(
Py_ssize_t
size
)
# Return value: New reference.
#
# Return a new writable buffer object that maintains its own memory
# buffer of size bytes. ValueError is returned if size is not zero
# or positive. Note that the memory buffer (as returned by
# PyObject_AsWriteBuffer()) is not specifically aligned.
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