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
69088108
Commit
69088108
authored
Apr 07, 2015
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make wraparound() and boundscheck() available in pure mode
parent
7703feab
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
1 deletion
+33
-1
CHANGES.rst
CHANGES.rst
+3
-0
Cython/Shadow.py
Cython/Shadow.py
+1
-1
tests/run/pure_py.py
tests/run/pure_py.py
+29
-0
No files found.
CHANGES.rst
View file @
69088108
...
...
@@ -27,6 +27,9 @@ Features added
* The ``PyTypeObject`` declaration in ``cpython.object`` was extended.
* ``wraparound()`` and ``boundscheck()`` are available as no-ops in pure
Python mode.
* ``NULL`` is allowed as default argument when embedding signatures.
This fixes ticket 843.
...
...
Cython/Shadow.py
View file @
69088108
...
...
@@ -97,7 +97,7 @@ class _EmptyDecoratorAndManager(object):
cclass
=
ccall
=
cfunc
=
_EmptyDecoratorAndManager
()
returns
=
lambda
type_
arg
:
_EmptyDecoratorAndManager
()
returns
=
wraparound
=
boundscheck
=
lambda
arg
:
_EmptyDecoratorAndManager
()
final
=
internal
=
type_version_tag
=
no_gc_clear
=
_empty_decorator
...
...
tests/run/pure_py.py
View file @
69088108
...
...
@@ -5,6 +5,7 @@ is_compiled = cython.compiled
NULL
=
5
_NULL
=
NULL
def
test_sizeof
():
"""
>>> test_sizeof()
...
...
@@ -24,6 +25,7 @@ def test_sizeof():
else
:
print
(
cython
.
sizeof
(
cython
.
char
)
==
1
)
def
test_declare
(
n
):
"""
>>> test_declare(100)
...
...
@@ -43,6 +45,7 @@ def test_declare(n):
ptr
=
cython
.
declare
(
cython
.
p_int
,
cython
.
address
(
y
))
return
y
,
ptr
[
0
]
@
cython
.
locals
(
x
=
cython
.
double
,
n
=
cython
.
int
)
def
test_cast
(
x
):
"""
...
...
@@ -52,6 +55,7 @@ def test_cast(x):
n
=
cython
.
cast
(
cython
.
int
,
x
)
return
n
@
cython
.
locals
(
x
=
cython
.
int
,
y
=
cython
.
p_int
)
def
test_address
(
x
):
"""
...
...
@@ -61,6 +65,30 @@ def test_address(x):
y
=
cython
.
address
(
x
)
return
y
[
0
]
@
cython
.
wraparound
(
False
)
def
test_wraparound
(
x
):
"""
>>> test_wraparound([1, 2, 3])
[1, 2, 1]
"""
with
cython
.
wraparound
(
True
):
x
[
-
1
]
=
x
[
0
]
return
x
@
cython
.
boundscheck
(
False
)
def
test_boundscheck
(
x
):
"""
>>> test_boundscheck([1, 2, 3])
3
>>> try: test_boundscheck([1, 2])
... except IndexError: pass
"""
with
cython
.
boundscheck
(
True
):
return
x
[
2
]
## CURRENTLY BROKEN - FIXME!!
## Is this test make sense? Implicit conversion in pure Python??
...
...
@@ -74,6 +102,7 @@ def test_address(x):
## y = x
## return y
def
test_with_nogil
(
nogil
):
"""
>>> raised = []
...
...
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