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
7e653adb
Commit
7e653adb
authored
Feb 25, 2018
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clarify the documented semantics of "wraparound(False)" when bounds checks are enabled.
parent
7de1010c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
7 deletions
+15
-7
docs/src/reference/compilation.rst
docs/src/reference/compilation.rst
+15
-7
No files found.
docs/src/reference/compilation.rst
View file @
7e653adb
...
@@ -451,17 +451,25 @@ Cython code. Here is the list of currently supported directives:
...
@@ -451,17 +451,25 @@ Cython code. Here is the list of currently supported directives:
([]-operator) in the code will not cause any IndexErrors to be
([]-operator) in the code will not cause any IndexErrors to be
raised. Lists, tuples, and strings are affected only if the index
raised. Lists, tuples, and strings are affected only if the index
can be determined to be non-negative (or if ``wraparound`` is False).
can be determined to be non-negative (or if ``wraparound`` is False).
Conditions
Conditions which would normally trigger an IndexError may instead cause
which would normally trigger an IndexError may instead cause
segfaults or data corruption if this is set to False.
segfaults or data corruption if this is set to False.
Default is True.
Default is True.
``wraparound`` (True / False)
``wraparound`` (True / False)
In Python arrays can be indexed relative to the end. For example
In Python, arrays and sequences can be indexed relative to the end.
A[-1] indexes the last value of a list. In C negative indexing is
For example, A[-1] indexes the last value of a list.
not supported. If set to False, Cython will neither check for nor
In C, negative indexing is not supported.
correctly handle negative indices, possibly causing segfaults or
If set to False, Cython is allowed to neither check for nor correctly
data corruption.
handle negative indices, possibly causing segfaults or data corruption.
If bounds checks are enabled (the default, see ``boundschecks`` above),
negative indexing will usually raise an ``IndexError`` for indices that
Cython evaluates itself.
However, these cases can be difficult to recognise in user code to
distinguish them from indexing or slicing that is evaluated by the
underlying Python array or sequence object and thus continues to support
wrap-around indices.
It is therefore safest to apply this option only to code that does not
process negative indices at all.
Default is True.
Default is True.
``initializedcheck`` (True / False)
``initializedcheck`` (True / False)
...
...
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