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
Gwenaël Samain
cython
Commits
0da92b56
Commit
0da92b56
authored
Aug 11, 2018
by
scoder
Committed by
GitHub
Aug 11, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2537 from jakirkham/extern_py_raw_mem
Add Python Raw memory helper functions
parents
0f3ec28f
fb158252
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
0 deletions
+11
-0
Cython/Includes/cpython/mem.pxd
Cython/Includes/cpython/mem.pxd
+5
-0
Cython/Utility/ModuleSetupCode.c
Cython/Utility/ModuleSetupCode.c
+6
-0
No files found.
Cython/Includes/cpython/mem.pxd
View file @
0da92b56
from
cpython.version
cimport
PY_VERSION_HEX
cdef
extern
from
"Python.h"
:
#####################################################################
...
...
@@ -27,6 +29,7 @@ cdef extern from "Python.h":
# available for allocating and releasing memory from the Python
# heap:
void
*
PyMem_RawMalloc
(
size_t
n
)
nogil
void
*
PyMem_Malloc
(
size_t
n
)
# Allocates n bytes and returns a pointer of type void* to the
# allocated memory, or NULL if the request fails. Requesting zero
...
...
@@ -34,6 +37,7 @@ cdef extern from "Python.h":
# PyMem_Malloc(1) had been called instead. The memory will not
# have been initialized in any way.
void
*
PyMem_RawRealloc
(
void
*
p
,
size_t
n
)
nogil
void
*
PyMem_Realloc
(
void
*
p
,
size_t
n
)
# Resizes the memory block pointed to by p to n bytes. The
# contents will be unchanged to the minimum of the old and the new
...
...
@@ -43,6 +47,7 @@ cdef extern from "Python.h":
# NULL, it must have been returned by a previous call to
# PyMem_Malloc() or PyMem_Realloc().
void
PyMem_RawFree
(
void
*
p
)
nogil
void
PyMem_Free
(
void
*
p
)
# Frees the memory block pointed to by p, which must have been
# returned by a previous call to PyMem_Malloc() or
...
...
Cython/Utility/ModuleSetupCode.c
View file @
0da92b56
...
...
@@ -439,6 +439,12 @@ class __Pyx_FakeReference {
#define PyObject_Realloc(p) PyMem_Realloc(p)
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
#define PyMem_RawMalloc(n) PyMem_Malloc(n)
#define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n)
#define PyMem_RawFree(p) PyMem_Free(p)
#endif
#if CYTHON_COMPILING_IN_PYSTON
// special C-API functions only in Pyston
#define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co)
...
...
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