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:
...
@@ -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
* The ``.c`` file is compiled by a C compiler to a ``.so`` file (or a
``.pyd`` file on Windows)
``.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.
directives below.
Compiler directives
Compiler directives
====================
====================
Compiler directives are instructions which affect
which sort of code
Compiler directives are instructions which affect
the behavior of
Cython
generates. Here is the list
:
Cython
code. Here is the list of currently supported directives
:
``boundscheck`` (True / False)
``boundscheck`` (True / False)
If set to False, Cython is free to assume that indexing operations
If set to False, Cython is free to assume that indexing operations
([]-operator) in the code will not cause any IndexErrors to be
([]-operator) in the code will not cause any IndexErrors to be
raised. Currently this is only made use of for buffers, but lists
raised. Currently this is only made use of for buffers, lists and
and tuples could be affected in the future. Conditions which would
tuples, but could be affected other types in the future. Conditions
normally trigger an IndexError may instead cause segfaults or data
which would normally trigger an IndexError may instead cause
corruption if this is set to False. Default is True.
segfaults or data corruption if this is set to False.
Default is True.
``wraparound`` (True / False)
``wraparound`` (True / False)
In Python arrays can be indexed relative to the end. For example
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
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
not supported. If set to False, Cython will neither check for nor
indexing is not used. Default is True.
correctly handle negative indices, possibly causing segfaults or
data corruption.
Default is True.
``nonecheck`` (True / False)
``nonecheck`` (True / False)
If set to False, Cython is free to assume that native field
If set to False, Cython is free to assume that native field
...
@@ -55,7 +58,7 @@ Cython generates. Here is the list:
...
@@ -55,7 +58,7 @@ Cython generates. Here is the list:
If set to False, Cython will adjust the remainder and quotient
If set to False, Cython will adjust the remainder and quotient
operators C types to match those of Python ints (which differ when
operators C types to match those of Python ints (which differ when
the operands have opposite signs) and raise a
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
a 35% speed penalty. If set to True, no checks are performed. See
`CEP 516 <http://wiki.cython.org/enhancements/division>`_. Default
`CEP 516 <http://wiki.cython.org/enhancements/division>`_. Default
is False.
is False.
...
@@ -79,7 +82,8 @@ Cython generates. Here is the list:
...
@@ -79,7 +82,8 @@ Cython generates. Here is the list:
``infer_types`` (True / False)
``infer_types`` (True / False)
Infer types of untyped variables in function bodies. Default is
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
How to set directives
---------------------
---------------------
...
@@ -108,7 +112,6 @@ Locally
...
@@ -108,7 +112,6 @@ Locally
For local blocks, you need to cimport the special builtin ``cython``
For local blocks, you need to cimport the special builtin ``cython``
module::
module::
#!python
cimport cython
cimport cython
Then you can use the directives either as decorators or in a with
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