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
3bd45ec2
Commit
3bd45ec2
authored
May 19, 2012
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
arrayarray utility code hack
parent
c2101ebc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
10 deletions
+17
-10
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+10
-0
Cython/Includes/cpython/array.pxd
Cython/Includes/cpython/array.pxd
+2
-6
Cython/Utility/arrayarray.h
Cython/Utility/arrayarray.h
+5
-4
No files found.
Cython/Compiler/Nodes.py
View file @
3bd45ec2
...
@@ -6390,6 +6390,10 @@ class CImportStatNode(StatNode):
...
@@ -6390,6 +6390,10 @@ class CImportStatNode(StatNode):
else
:
else
:
name
=
self
.
as_name
or
self
.
module_name
name
=
self
.
as_name
or
self
.
module_name
env
.
declare_module
(
name
,
module_scope
,
self
.
pos
)
env
.
declare_module
(
name
,
module_scope
,
self
.
pos
)
if
self
.
module_name
==
"cpython.array"
:
# TODO: Consider a generic user-level mechanism for importing
# utility code (or inlining c) in a pxd (or pyx) file.
env
.
use_utility_code
(
UtilityCode
.
load
(
"ArrayAPI"
,
"arrayarray.h"
))
def
analyse_expressions
(
self
,
env
):
def
analyse_expressions
(
self
,
env
):
pass
pass
...
@@ -6440,6 +6444,12 @@ class FromCImportStatNode(StatNode):
...
@@ -6440,6 +6444,12 @@ class FromCImportStatNode(StatNode):
if
entry
:
if
entry
:
local_name
=
as_name
or
name
local_name
=
as_name
or
name
env
.
add_imported_entry
(
local_name
,
entry
,
pos
)
env
.
add_imported_entry
(
local_name
,
entry
,
pos
)
if
self
.
module_name
==
"cpython"
:
# TODO: Consider a generic user-level mechanism for importing
# utility code (or inlining c) in a pxd (or pyx) file.
for
_
,
name
,
_
,
_
in
self
.
imported_names
:
if
name
==
"array"
:
env
.
use_utility_code
(
UtilityCode
.
load
(
"ArrayAPI"
,
"arrayarray.h"
))
def
declaration_matches
(
self
,
entry
,
kind
):
def
declaration_matches
(
self
,
entry
,
kind
):
if
not
entry
.
is_type
:
if
not
entry
.
is_type
:
...
...
Cython/Includes/cpython/array.pxd
View file @
3bd45ec2
...
@@ -41,14 +41,10 @@
...
@@ -41,14 +41,10 @@
mem.leaks; seamless Python compatibility, buffer() optional
mem.leaks; seamless Python compatibility, buffer() optional
IMPORTANT: arrayarray.h (arrayobject, arraydescr) is not part of
the official Python C-API so far; arrayarray.h is located
next to this file copy it to PythonXX/include or local or
somewhere on your -I path
last changes: 2009-05-15 rk
last changes: 2009-05-15 rk
: 2009-12-06 bp
: 2009-12-06 bp
: 2012-05-02 andreasvc
: 2012-05-02 andreasvc
: (see revision control)
"""
"""
from
libc
cimport
stdlib
from
libc
cimport
stdlib
from
libc.string
cimport
strcat
,
strncat
,
\
from
libc.string
cimport
strcat
,
strncat
,
\
...
@@ -57,7 +53,7 @@ from libc.string cimport strcat, strncat, \
...
@@ -57,7 +53,7 @@ from libc.string cimport strcat, strncat, \
from
cpython.ref
cimport
PyTypeObject
from
cpython.ref
cimport
PyTypeObject
from
cpython.exc
cimport
PyErr_BadArgument
from
cpython.exc
cimport
PyErr_BadArgument
cdef
extern
from
"arrayarray.h"
:
cdef
extern
from
*
:
# Hard-coded utility code hack.
ctypedef
class
array
.
array
[
object
arrayobject
]
ctypedef
class
array
.
array
[
object
arrayobject
]
ctypedef
object
GETF
(
array
a
,
Py_ssize_t
ix
)
ctypedef
object
GETF
(
array
a
,
Py_ssize_t
ix
)
ctypedef
object
SETF
(
array
a
,
Py_ssize_t
ix
,
object
o
)
ctypedef
object
SETF
(
array
a
,
Py_ssize_t
ix
,
object
o
)
...
...
Cython/
Includes/cpython
/arrayarray.h
→
Cython/
Utility
/arrayarray.h
View file @
3bd45ec2
/////////////// ArrayAPI.proto ///////////////
/* arrayarray.h
/* arrayarray.h
artificial C-API for Python's
Artificial C-API for Python's <array.array> type,
<array.array> type.
used by array.pxd
copy this file to your -I path, e.g. .../pythonXX/include
See array.pxd next to this file
last changes: 2009-05-15 rk
last changes: 2009-05-15 rk
2012-05-02 andreasvc
2012-05-02 andreasvc
(see revision control)
*/
*/
...
...
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