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
01a31397
Commit
01a31397
authored
Apr 07, 2011
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor directive edits
parent
84836476
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
12 deletions
+15
-12
docs/src/reference/compilation.rst
docs/src/reference/compilation.rst
+15
-12
No files found.
docs/src/reference/compilation.rst
View file @
01a31397
...
...
@@ -13,28 +13,31 @@ Cython code, unlike Python, must be compiled. This happens in two stages:
* The ``.c`` file is compiled by a C compiler to a ``.so`` file (or a
``.pyd`` file on Windows)
You can tailor the behavio
u
r of the Cython compiler by specifying the
You can tailor the behavior of the Cython compiler by specifying the
directives below.
Compiler directives
====================
Compiler directives are instructions which affect
which sort of code
Cython
generates. Here is the list
:
Compiler directives are instructions which affect
the behavior of
Cython
code. Here is the list of currently supported directives
:
``boundscheck`` (True / False)
If set to False, Cython is free to assume that indexing operations
([]-operator) in the code will not cause any IndexErrors to be
raised. Currently this is only made use of for buffers, but lists
and tuples could be affected in the future. Conditions which would
normally trigger an IndexError may instead cause segfaults or data
corruption if this is set to False. Default is True.
raised. Currently this is only made use of for buffers, lists and
tuples, but could be affected other types in the future. Conditions
which would normally trigger an IndexError may instead cause
segfaults or data corruption if this is set to False.
Default is True.
``wraparound`` (True / False)
In Python arrays can be indexed relative to the end. For example
A[-1] indexes the last value of a list. In C negative indexing is
not supported. If set to False, Cython will not ensure that python
indexing is not used. Default is True.
not supported. If set to False, Cython will neither check for nor
correctly handle negative indices, possibly causing segfaults or
data corruption.
Default is True.
``nonecheck`` (True / False)
If set to False, Cython is free to assume that native field
...
...
@@ -55,7 +58,7 @@ Cython generates. Here is the list:
If set to False, Cython will adjust the remainder and quotient
operators C types to match those of Python ints (which differ when
the operands have opposite signs) and raise a
``ZeroDivisionError`` when the right operand is 0. This has
about
``ZeroDivisionError`` when the right operand is 0. This has
up to
a 35% speed penalty. If set to True, no checks are performed. See
`CEP 516 <http://wiki.cython.org/enhancements/division>`_. Default
is False.
...
...
@@ -79,7 +82,8 @@ Cython generates. Here is the list:
``infer_types`` (True / False)
Infer types of untyped variables in function bodies. Default is
False.
None, indicating that on safe (semantically-unchanging) inferences
are allowed.
How to set directives
---------------------
...
...
@@ -108,7 +112,6 @@ Locally
For local blocks, you need to cimport the special builtin ``cython``
module::
#!python
cimport cython
Then you can use the directives either as decorators or in a with
...
...
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