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
Kirill Smelkov
cython
Commits
c7a7c577
Commit
c7a7c577
authored
May 20, 2012
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
array fixes for py3
parent
008e1f62
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
Cython/Includes/cpython/array.pxd
Cython/Includes/cpython/array.pxd
+3
-4
Cython/Includes/cpython/ref.pxd
Cython/Includes/cpython/ref.pxd
+1
-0
No files found.
Cython/Includes/cpython/array.pxd
View file @
c7a7c577
...
@@ -50,7 +50,7 @@ from libc cimport stdlib
...
@@ -50,7 +50,7 @@ from libc cimport stdlib
from
libc.string
cimport
strcat
,
strncat
,
\
from
libc.string
cimport
strcat
,
strncat
,
\
memset
,
memchr
,
memcmp
,
memcpy
,
memmove
memset
,
memchr
,
memcmp
,
memcpy
,
memmove
from
cpython.ref
cimport
PyTypeObject
from
cpython.ref
cimport
PyTypeObject
,
Py_TYPE
from
cpython.exc
cimport
PyErr_BadArgument
from
cpython.exc
cimport
PyErr_BadArgument
cdef
extern
from
*
:
# Hard-coded utility code hack.
cdef
extern
from
*
:
# Hard-coded utility code hack.
...
@@ -67,7 +67,6 @@ cdef extern from *: # Hard-coded utility code hack.
...
@@ -67,7 +67,6 @@ cdef extern from *: # Hard-coded utility code hack.
cdef
__cythonbufferdefaults__
=
{
'ndim'
:
1
,
'mode'
:
'c'
}
cdef
__cythonbufferdefaults__
=
{
'ndim'
:
1
,
'mode'
:
'c'
}
cdef
:
cdef
:
PyTypeObject
*
ob_type
Py_ssize_t
length
# == ob_size (by union)
Py_ssize_t
length
# == ob_size (by union)
arraydescr
*
ob_descr
# struct arraydescr *ob_descr;
arraydescr
*
ob_descr
# struct arraydescr *ob_descr;
...
@@ -131,7 +130,7 @@ cdef inline array clone(array template, Py_ssize_t length, bint zero):
...
@@ -131,7 +130,7 @@ cdef inline array clone(array template, Py_ssize_t length, bint zero):
type will be same as template.
type will be same as template.
if zero is true, new array will be initialized with zeroes."""
if zero is true, new array will be initialized with zeroes."""
cdef
array
op
cdef
array
op
op
=
newarrayobject
(
template
.
ob_type
,
length
,
template
.
ob_descr
)
op
=
newarrayobject
(
Py_TYPE
(
template
)
,
length
,
template
.
ob_descr
)
if
zero
and
op
is
not
None
:
if
zero
and
op
is
not
None
:
memset
(
op
.
_c
,
0
,
length
*
op
.
ob_descr
.
itemsize
)
memset
(
op
.
_c
,
0
,
length
*
op
.
ob_descr
.
itemsize
)
return
op
return
op
...
@@ -139,7 +138,7 @@ cdef inline array clone(array template, Py_ssize_t length, bint zero):
...
@@ -139,7 +138,7 @@ cdef inline array clone(array template, Py_ssize_t length, bint zero):
cdef
inline
array
copy
(
array
self
):
cdef
inline
array
copy
(
array
self
):
""" make a copy of an array. """
""" make a copy of an array. """
cdef
array
op
cdef
array
op
op
=
newarrayobject
(
self
.
ob_type
,
self
.
length
,
self
.
ob_descr
)
op
=
newarrayobject
(
Py_TYPE
(
self
)
,
self
.
length
,
self
.
ob_descr
)
memcpy
(
op
.
_c
,
self
.
_c
,
op
.
length
*
op
.
ob_descr
.
itemsize
)
memcpy
(
op
.
_c
,
self
.
_c
,
op
.
length
*
op
.
ob_descr
.
itemsize
)
return
op
return
op
...
...
Cython/Includes/cpython/ref.pxd
View file @
c7a7c577
...
@@ -3,6 +3,7 @@ cdef extern from "Python.h":
...
@@ -3,6 +3,7 @@ cdef extern from "Python.h":
ctypedef
struct
PyObject
:
ctypedef
struct
PyObject
:
Py_ssize_t
ob_refcnt
Py_ssize_t
ob_refcnt
PyTypeObject
*
ob_type
PyTypeObject
*
ob_type
cdef
PyTypeObject
*
Py_TYPE
(
object
)
#####################################################################
#####################################################################
...
...
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