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
Gwenaël Samain
cython
Commits
4f237620
Commit
4f237620
authored
Oct 17, 2017
by
Unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Trivial typo fixes
Most are non-user facing. Found using: `codespell -d -q 3`
parent
01e9ff88
Changes
31
Hide whitespace changes
Inline
Side-by-side
Showing
31 changed files
with
44 additions
and
44 deletions
+44
-44
Cython/CodeWriter.py
Cython/CodeWriter.py
+1
-1
Cython/Compiler/Buffer.py
Cython/Compiler/Buffer.py
+3
-3
Cython/Compiler/CodeGeneration.py
Cython/Compiler/CodeGeneration.py
+1
-1
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+2
-2
Cython/Compiler/FusedNode.py
Cython/Compiler/FusedNode.py
+2
-2
Cython/Compiler/Main.py
Cython/Compiler/Main.py
+2
-2
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+2
-2
Cython/Compiler/ParseTreeTransforms.py
Cython/Compiler/ParseTreeTransforms.py
+2
-2
Cython/Compiler/Scanning.py
Cython/Compiler/Scanning.py
+1
-1
Cython/Compiler/UtilNodes.py
Cython/Compiler/UtilNodes.py
+1
-1
Cython/Debugger/libpython.py
Cython/Debugger/libpython.py
+1
-1
Cython/Includes/Deprecated/python2.5.pxd
Cython/Includes/Deprecated/python2.5.pxd
+1
-1
Cython/Includes/cpython/__init__.pxd
Cython/Includes/cpython/__init__.pxd
+2
-2
Cython/Includes/cpython/array.pxd
Cython/Includes/cpython/array.pxd
+2
-2
Cython/Includes/numpy/__init__.pxd
Cython/Includes/numpy/__init__.pxd
+1
-1
Cython/Parser/Grammar
Cython/Parser/Grammar
+1
-1
Cython/Tests/TestCodeWriter.py
Cython/Tests/TestCodeWriter.py
+1
-1
Cython/Utility/MemoryView.pyx
Cython/Utility/MemoryView.pyx
+1
-1
Cython/Utility/Overflow.c
Cython/Utility/Overflow.c
+1
-1
Demos/freeze/README.txt
Demos/freeze/README.txt
+1
-1
Tools/rules.bzl
Tools/rules.bzl
+1
-1
Tools/site_scons/site_tools/pyext.py
Tools/site_scons/site_tools/pyext.py
+1
-1
appveyor.yml
appveyor.yml
+1
-1
docs/src/userguide/wrapping_CPlusPlus.rst
docs/src/userguide/wrapping_CPlusPlus.rst
+2
-2
pyximport/pyximport.py
pyximport/pyximport.py
+2
-2
runtests.py
runtests.py
+2
-2
tests/buffers/bufaccess.pyx
tests/buffers/bufaccess.pyx
+1
-1
tests/memoryview/memoryview.pyx
tests/memoryview/memoryview.pyx
+1
-1
tests/memoryview/memslice.pyx
tests/memoryview/memslice.pyx
+1
-1
tests/run/arithmetic_analyse_types_helper.h
tests/run/arithmetic_analyse_types_helper.h
+1
-1
tests/run/overflow_check.pxi
tests/run/overflow_check.pxi
+2
-2
No files found.
Cython/CodeWriter.py
View file @
4f237620
...
@@ -363,7 +363,7 @@ class CodeWriter(DeclarationWriter):
...
@@ -363,7 +363,7 @@ class CodeWriter(DeclarationWriter):
self
.
dedent
()
self
.
dedent
()
def
visit_IfStatNode
(
self
,
node
):
def
visit_IfStatNode
(
self
,
node
):
# The IfClauseNode is handled directly without a sep
e
rate match
# The IfClauseNode is handled directly without a sep
a
rate match
# for clariy.
# for clariy.
self
.
startline
(
u"if "
)
self
.
startline
(
u"if "
)
self
.
visit
(
node
.
if_clauses
[
0
].
condition
)
self
.
visit
(
node
.
if_clauses
[
0
].
condition
)
...
...
Cython/Compiler/Buffer.py
View file @
4f237620
...
@@ -326,7 +326,7 @@ def put_acquire_arg_buffer(entry, code, pos):
...
@@ -326,7 +326,7 @@ def put_acquire_arg_buffer(entry, code, pos):
code
.
putln
(
"__Pyx_BufFmt_StackElem __pyx_stack[%d];"
%
entry
.
type
.
dtype
.
struct_nesting_depth
())
code
.
putln
(
"__Pyx_BufFmt_StackElem __pyx_stack[%d];"
%
entry
.
type
.
dtype
.
struct_nesting_depth
())
code
.
putln
(
code
.
error_goto_if
(
"%s == -1"
%
getbuffer
,
pos
))
code
.
putln
(
code
.
error_goto_if
(
"%s == -1"
%
getbuffer
,
pos
))
code
.
putln
(
"}"
)
code
.
putln
(
"}"
)
# An exception raised in arg parsing cannot be ca
tched
, so no
# An exception raised in arg parsing cannot be ca
ught
, so no
# need to care about the buffer then.
# need to care about the buffer then.
put_unpack_buffer_aux_into_scope
(
entry
,
code
)
put_unpack_buffer_aux_into_scope
(
entry
,
code
)
...
@@ -617,7 +617,7 @@ class GetAndReleaseBufferUtilityCode(object):
...
@@ -617,7 +617,7 @@ class GetAndReleaseBufferUtilityCode(object):
def
mangle_dtype_name
(
dtype
):
def
mangle_dtype_name
(
dtype
):
# Use prefixes to sep
e
rate user defined types from builtins
# Use prefixes to sep
a
rate user defined types from builtins
# (consider "typedef float unsigned_int")
# (consider "typedef float unsigned_int")
if
dtype
.
is_pyobject
:
if
dtype
.
is_pyobject
:
return
"object"
return
"object"
...
@@ -636,7 +636,7 @@ def get_type_information_cname(code, dtype, maxdepth=None):
...
@@ -636,7 +636,7 @@ def get_type_information_cname(code, dtype, maxdepth=None):
and return the name of the type info struct.
and return the name of the type info struct.
Structs with two floats of the same size are encoded as complex numbers.
Structs with two floats of the same size are encoded as complex numbers.
One can sep
e
rate between complex numbers declared as struct or with native
One can sep
a
rate between complex numbers declared as struct or with native
encoding by inspecting to see if the fields field of the type is
encoding by inspecting to see if the fields field of the type is
filled in.
filled in.
"""
"""
...
...
Cython/Compiler/CodeGeneration.py
View file @
4f237620
...
@@ -12,7 +12,7 @@ class ExtractPxdCode(VisitorTransform):
...
@@ -12,7 +12,7 @@ class ExtractPxdCode(VisitorTransform):
The result is a tuple (StatListNode, ModuleScope), i.e.
The result is a tuple (StatListNode, ModuleScope), i.e.
everything that is needed from the pxd after it is processed.
everything that is needed from the pxd after it is processed.
A purer approach would be to sep
e
rately compile the pxd code,
A purer approach would be to sep
a
rately compile the pxd code,
but the result would have to be slightly more sophisticated
but the result would have to be slightly more sophisticated
than pure strings (functions + wanted interned strings +
than pure strings (functions + wanted interned strings +
wanted utility code + wanted cached objects) so for now this
wanted utility code + wanted cached objects) so for now this
...
...
Cython/Compiler/ExprNodes.py
View file @
4f237620
...
@@ -4185,7 +4185,7 @@ class BufferIndexNode(_IndexingBaseNode):
...
@@ -4185,7 +4185,7 @@ class BufferIndexNode(_IndexingBaseNode):
if
is_pythran_expr
(
base_type
)
and
is_pythran_supported_type
(
rhs
.
type
):
if
is_pythran_expr
(
base_type
)
and
is_pythran_supported_type
(
rhs
.
type
):
obj
=
code
.
funcstate
.
allocate_temp
(
PythranExpr
(
pythran_type
(
self
.
base
.
type
)),
manage_ref
=
False
)
obj
=
code
.
funcstate
.
allocate_temp
(
PythranExpr
(
pythran_type
(
self
.
base
.
type
)),
manage_ref
=
False
)
# We have got to do this because we have to declare pythran objects
# We have got to do this because we have to declare pythran objects
# at the beg
gi
ning of the functions.
# at the beg
in
ning of the functions.
# Indeed, Cython uses "goto" statement for error management, and
# Indeed, Cython uses "goto" statement for error management, and
# RAII doesn't work with that kind of construction.
# RAII doesn't work with that kind of construction.
# Moreover, the way Pythran expressions are made is that they don't
# Moreover, the way Pythran expressions are made is that they don't
...
@@ -10427,7 +10427,7 @@ class CythonArrayNode(ExprNode):
...
@@ -10427,7 +10427,7 @@ class CythonArrayNode(ExprNode):
def
allocate_temp_result
(
self
,
code
):
def
allocate_temp_result
(
self
,
code
):
if
self
.
temp_code
:
if
self
.
temp_code
:
raise
RuntimeError
(
"temp allocated mul
it
ple times"
)
raise
RuntimeError
(
"temp allocated mul
ti
ple times"
)
self
.
temp_code
=
code
.
funcstate
.
allocate_temp
(
self
.
type
,
True
)
self
.
temp_code
=
code
.
funcstate
.
allocate_temp
(
self
.
type
,
True
)
...
...
Cython/Compiler/FusedNode.py
View file @
4f237620
...
@@ -225,7 +225,7 @@ class FusedCFuncDefNode(StatListNode):
...
@@ -225,7 +225,7 @@ class FusedCFuncDefNode(StatListNode):
"""
"""
Create a new local scope for the copied node and append it to
Create a new local scope for the copied node and append it to
self.nodes. A new local scope is needed because the arguments with the
self.nodes. A new local scope is needed because the arguments with the
fused types are aready in the local scope, and we need the specialized
fused types are a
l
ready in the local scope, and we need the specialized
entries created after analyse_declarations on each specialized version
entries created after analyse_declarations on each specialized version
of the (CFunc)DefNode.
of the (CFunc)DefNode.
f2s is a dict mapping each fused type to its specialized version
f2s is a dict mapping each fused type to its specialized version
...
@@ -438,7 +438,7 @@ class FusedCFuncDefNode(StatListNode):
...
@@ -438,7 +438,7 @@ class FusedCFuncDefNode(StatListNode):
if dtype is not None:
if dtype is not None:
itemsize = dtype.itemsize
itemsize = dtype.itemsize
kind = ord(dtype.kind)
kind = ord(dtype.kind)
# We only support the endianess of the current compiler
# We only support the endian
n
ess of the current compiler
byteorder = dtype.byteorder
byteorder = dtype.byteorder
if byteorder == "<" and not __Pyx_Is_Little_Endian():
if byteorder == "<" and not __Pyx_Is_Little_Endian():
arg_is_pythran_compatible = False
arg_is_pythran_compatible = False
...
...
Cython/Compiler/Main.py
View file @
4f237620
...
@@ -356,7 +356,7 @@ class Context(object):
...
@@ -356,7 +356,7 @@ class Context(object):
from
..Parser
import
ConcreteSyntaxTree
from
..Parser
import
ConcreteSyntaxTree
except
ImportError
:
except
ImportError
:
raise
RuntimeError
(
raise
RuntimeError
(
"Formal gramm
e
r can only be used with compiled Cython with an available pgen."
)
"Formal gramm
a
r can only be used with compiled Cython with an available pgen."
)
ConcreteSyntaxTree
.
p_module
(
source_filename
)
ConcreteSyntaxTree
.
p_module
(
source_filename
)
except
UnicodeDecodeError
as
e
:
except
UnicodeDecodeError
as
e
:
#import traceback
#import traceback
...
@@ -683,7 +683,7 @@ def compile(source, options = None, full_module_name = None, **kwds):
...
@@ -683,7 +683,7 @@ def compile(source, options = None, full_module_name = None, **kwds):
compile(source [, options], [, <option> = <value>]...)
compile(source [, options], [, <option> = <value>]...)
Compile one or more Pyrex implementation files, with optional timestamp
Compile one or more Pyrex implementation files, with optional timestamp
checking and recursing on dependecies. The source argument may be a string
checking and recursing on depende
n
cies. The source argument may be a string
or a sequence of strings If it is a string and no recursion or timestamp
or a sequence of strings If it is a string and no recursion or timestamp
checking is requested, a CompilationResult is returned, otherwise a
checking is requested, a CompilationResult is returned, otherwise a
CompilationResultSet is returned.
CompilationResultSet is returned.
...
...
Cython/Compiler/Nodes.py
View file @
4f237620
...
@@ -1927,7 +1927,7 @@ class FuncDefNode(StatNode, BlockNode):
...
@@ -1927,7 +1927,7 @@ class FuncDefNode(StatNode, BlockNode):
code
.
put_var_incref
(
entry
)
code
.
put_var_incref
(
entry
)
# Note: defaults are always incref-ed. For def functions, we
# Note: defaults are always incref-ed. For def functions, we
# we aquire arguments from object converstion, so we have
# we a
c
quire arguments from object converstion, so we have
# new references. If we are a cdef function, we need to
# new references. If we are a cdef function, we need to
# incref our arguments
# incref our arguments
elif
is_cdef
and
entry
.
type
.
is_memoryviewslice
and
len
(
entry
.
cf_assignments
)
>
1
:
elif
is_cdef
and
entry
.
type
.
is_memoryviewslice
and
len
(
entry
.
cf_assignments
)
>
1
:
...
@@ -4234,7 +4234,7 @@ class GeneratorBodyDefNode(DefNode):
...
@@ -4234,7 +4234,7 @@ class GeneratorBodyDefNode(DefNode):
class
OverrideCheckNode
(
StatNode
):
class
OverrideCheckNode
(
StatNode
):
# A Node for dispatching to the def method if it
# A Node for dispatching to the def method if it
# is overriden.
# is overrid
d
en.
#
#
# py_func
# py_func
#
#
...
...
Cython/Compiler/ParseTreeTransforms.py
View file @
4f237620
...
@@ -1877,7 +1877,7 @@ if VALUE is not None:
...
@@ -1877,7 +1877,7 @@ if VALUE is not None:
def
visit_FuncDefNode
(
self
,
node
):
def
visit_FuncDefNode
(
self
,
node
):
"""
"""
Analyse a function and its body, as that hasn't happend yet. Also
Analyse a function and its body, as that hasn't happen
e
d yet. Also
analyse the directive_locals set by @cython.locals().
analyse the directive_locals set by @cython.locals().
Then, if we are a function with fused arguments, replace the function
Then, if we are a function with fused arguments, replace the function
...
@@ -2066,7 +2066,7 @@ if VALUE is not None:
...
@@ -2066,7 +2066,7 @@ if VALUE is not None:
# Some nodes are no longer needed after declaration
# Some nodes are no longer needed after declaration
# analysis and can be dropped. The analysis was performed
# analysis and can be dropped. The analysis was performed
# on these nodes in a sep
e
rate recursive process from the
# on these nodes in a sep
a
rate recursive process from the
# enclosing function or module, so we can simply drop them.
# enclosing function or module, so we can simply drop them.
def
visit_CDeclaratorNode
(
self
,
node
):
def
visit_CDeclaratorNode
(
self
,
node
):
# necessary to ensure that all CNameDeclaratorNodes are visited.
# necessary to ensure that all CNameDeclaratorNodes are visited.
...
...
Cython/Compiler/Scanning.py
View file @
4f237620
...
@@ -168,7 +168,7 @@ class SourceDescriptor(object):
...
@@ -168,7 +168,7 @@ class SourceDescriptor(object):
if
self
.
_escaped_description
is
None
:
if
self
.
_escaped_description
is
None
:
esc_desc
=
\
esc_desc
=
\
self
.
get_description
().
encode
(
'ASCII'
,
'replace'
).
decode
(
"ASCII"
)
self
.
get_description
().
encode
(
'ASCII'
,
'replace'
).
decode
(
"ASCII"
)
# Use for
e
ward slashes on Windows since these paths
# Use forward slashes on Windows since these paths
# will be used in the #line directives in the C/C++ files.
# will be used in the #line directives in the C/C++ files.
self
.
_escaped_description
=
esc_desc
.
replace
(
'
\
\
'
,
'/'
)
self
.
_escaped_description
=
esc_desc
.
replace
(
'
\
\
'
,
'/'
)
return
self
.
_escaped_description
return
self
.
_escaped_description
...
...
Cython/Compiler/UtilNodes.py
View file @
4f237620
#
#
# Nodes used as utilities and support for transforms etc.
# Nodes used as utilities and support for transforms etc.
# These often make up sets including both Nodes and ExprNodes
# These often make up sets including both Nodes and ExprNodes
# so it is convenient to have them in a sep
e
rate module.
# so it is convenient to have them in a sep
a
rate module.
#
#
from
__future__
import
absolute_import
from
__future__
import
absolute_import
...
...
Cython/Debugger/libpython.py
View file @
4f237620
...
@@ -2596,7 +2596,7 @@ class PythonCodeExecutor(object):
...
@@ -2596,7 +2596,7 @@ class PythonCodeExecutor(object):
inferior.
inferior.
Of course, executing any code in the inferior may be dangerous and may
Of course, executing any code in the inferior may be dangerous and may
leave the debuggee in an unsafe state or terminate it al
l
together.
leave the debuggee in an unsafe state or terminate it altogether.
"""
"""
if
'
\
0
'
in
code
:
if
'
\
0
'
in
code
:
raise
gdb
.
GdbError
(
"String contains NUL byte."
)
raise
gdb
.
GdbError
(
"String contains NUL byte."
)
...
...
Cython/Includes/Deprecated/python2.5.pxd
View file @
4f237620
...
@@ -213,7 +213,7 @@ cdef extern from "Python.h":
...
@@ -213,7 +213,7 @@ cdef extern from "Python.h":
object
PyList_AsTuple
(
object
)
object
PyList_AsTuple
(
object
)
int
PyList_Check
(
object
)
# Always succeeds.
int
PyList_Check
(
object
)
# Always succeeds.
int
PyList_CheckExact
(
object
)
# Always succeeds.
int
PyList_CheckExact
(
object
)
# Always succeeds.
int
PyList_GET_SIZE
(
object
)
# Always suceeds.
int
PyList_GET_SIZE
(
object
)
# Always suc
c
eeds.
object
PyList_GetSlice
(
object
,
Py_ssize_t
,
Py_ssize_t
)
object
PyList_GetSlice
(
object
,
Py_ssize_t
,
Py_ssize_t
)
int
PyList_Insert
(
object
,
Py_ssize_t
,
object
)
except
-
1
int
PyList_Insert
(
object
,
Py_ssize_t
,
object
)
except
-
1
object
PyList_New
(
Py_ssize_t
)
object
PyList_New
(
Py_ssize_t
)
...
...
Cython/Includes/cpython/__init__.pxd
View file @
4f237620
...
@@ -10,13 +10,13 @@
...
@@ -10,13 +10,13 @@
# Read http://docs.python.org/api/refcounts.html which is so
# Read http://docs.python.org/api/refcounts.html which is so
# important I've copied it below.
# important I've copied it below.
#
#
# For all the declaration below, whenver the Py_ function returns
# For all the declaration below, when
e
ver the Py_ function returns
# a *new reference* to a PyObject*, the return type is "object".
# a *new reference* to a PyObject*, the return type is "object".
# When the function returns a borrowed reference, the return
# When the function returns a borrowed reference, the return
# type is PyObject*. When Cython sees "object" as a return type
# type is PyObject*. When Cython sees "object" as a return type
# it doesn't increment the reference count. When it sees PyObject*
# it doesn't increment the reference count. When it sees PyObject*
# in order to use the result you must explicitly cast to <object>,
# in order to use the result you must explicitly cast to <object>,
# and when you do that Cython increments the reference count wether
# and when you do that Cython increments the reference count w
h
ether
# you want it to or not, forcing you to an explicit DECREF (or leak memory).
# you want it to or not, forcing you to an explicit DECREF (or leak memory).
# To avoid this we make the above convention. Note, you can
# To avoid this we make the above convention. Note, you can
# always locally override this convention by putting something like
# always locally override this convention by putting something like
...
...
Cython/Includes/cpython/array.pxd
View file @
4f237620
...
@@ -92,7 +92,7 @@ cdef extern from *: # Hard-coded utility code hack.
...
@@ -92,7 +92,7 @@ cdef extern from *: # Hard-coded utility code hack.
def
__getbuffer__
(
self
,
Py_buffer
*
info
,
int
flags
):
def
__getbuffer__
(
self
,
Py_buffer
*
info
,
int
flags
):
# This implementation of getbuffer is geared towards Cython
# This implementation of getbuffer is geared towards Cython
# requirements, and does not yet ful
l
fill the PEP.
# requirements, and does not yet fulfill the PEP.
# In particular strided access is always provided regardless
# In particular strided access is always provided regardless
# of flags
# of flags
item_count
=
Py_SIZE
(
self
)
item_count
=
Py_SIZE
(
self
)
...
@@ -143,7 +143,7 @@ cdef inline array copy(array self):
...
@@ -143,7 +143,7 @@ cdef inline array copy(array self):
return
op
return
op
cdef
inline
int
extend_buffer
(
array
self
,
char
*
stuff
,
Py_ssize_t
n
)
except
-
1
:
cdef
inline
int
extend_buffer
(
array
self
,
char
*
stuff
,
Py_ssize_t
n
)
except
-
1
:
""" efficent appending of new stuff of same type
""" effic
i
ent appending of new stuff of same type
(e.g. of same array type)
(e.g. of same array type)
n: number of elements (not number of bytes!) """
n: number of elements (not number of bytes!) """
cdef
Py_ssize_t
itemsize
=
self
.
ob_descr
.
itemsize
cdef
Py_ssize_t
itemsize
=
self
.
ob_descr
.
itemsize
...
...
Cython/Includes/numpy/__init__.pxd
View file @
4f237620
...
@@ -213,7 +213,7 @@ cdef extern from "numpy/arrayobject.h":
...
@@ -213,7 +213,7 @@ cdef extern from "numpy/arrayobject.h":
# -- the details of this may change.
# -- the details of this may change.
def
__getbuffer__
(
ndarray
self
,
Py_buffer
*
info
,
int
flags
):
def
__getbuffer__
(
ndarray
self
,
Py_buffer
*
info
,
int
flags
):
# This implementation of getbuffer is geared towards Cython
# This implementation of getbuffer is geared towards Cython
# requirements, and does not yet ful
l
fill the PEP.
# requirements, and does not yet fulfill the PEP.
# In particular strided access is always provided regardless
# In particular strided access is always provided regardless
# of flags
# of flags
...
...
Cython/Parser/Grammar
View file @
4f237620
...
@@ -127,7 +127,7 @@ arglist: argument (',' argument)* [',']
...
@@ -127,7 +127,7 @@ arglist: argument (',' argument)* [',']
# to our LL(1) parser. Even though 'test' includes '*expr' in star_expr,
# to our LL(1) parser. Even though 'test' includes '*expr' in star_expr,
# we explicitly match '*' here, too, to give it proper precedence.
# we explicitly match '*' here, too, to give it proper precedence.
# Illegal combinations and orderings are blocked in ast.c:
# Illegal combinations and orderings are blocked in ast.c:
# multiple (test comp_for) argu
e
ments are blocked; keyword unpackings
# multiple (test comp_for) arguments are blocked; keyword unpackings
# that precede iterable unpackings are blocked; etc.
# that precede iterable unpackings are blocked; etc.
argument: ( test [comp_for] |
argument: ( test [comp_for] |
test '=' test |
test '=' test |
...
...
Cython/Tests/TestCodeWriter.py
View file @
4f237620
...
@@ -4,7 +4,7 @@ class TestCodeWriter(CythonTest):
...
@@ -4,7 +4,7 @@ class TestCodeWriter(CythonTest):
# CythonTest uses the CodeWriter heavily, so do some checking by
# CythonTest uses the CodeWriter heavily, so do some checking by
# roundtripping Cython code through the test framework.
# roundtripping Cython code through the test framework.
# Note that this test is depend
a
nt upon the normal Cython parser
# Note that this test is depend
e
nt upon the normal Cython parser
# to generate the input trees to the CodeWriter. This save *a lot*
# to generate the input trees to the CodeWriter. This save *a lot*
# of time; better to spend that time writing other tests than perfecting
# of time; better to spend that time writing other tests than perfecting
# this one...
# this one...
...
...
Cython/Utility/MemoryView.pyx
View file @
4f237620
...
@@ -1340,7 +1340,7 @@ cdef void broadcast_leading({{memviewslice_name}} *mslice,
...
@@ -1340,7 +1340,7 @@ cdef void broadcast_leading({{memviewslice_name}} *mslice,
mslice
.
suboffsets
[
i
]
=
-
1
mslice
.
suboffsets
[
i
]
=
-
1
#
#
### Take care of refcounting the objects in slices. Do this sep
e
rately from any copying,
### Take care of refcounting the objects in slices. Do this sep
a
rately from any copying,
### to minimize acquiring the GIL
### to minimize acquiring the GIL
#
#
...
...
Cython/Utility/Overflow.c
View file @
4f237620
/*
/*
These functions provide integer arithmetic with integer checking. They do not
These functions provide integer arithmetic with integer checking. They do not
actually raise an exception when an overflow is detected, but rather set a bit
actually raise an exception when an overflow is detected, but rather set a bit
in the overflow parameter. (This parameter may be re-used ac
c
ross several
in the overflow parameter. (This parameter may be re-used across several
arithmetic operations, so should be or-ed rather than assigned to.)
arithmetic operations, so should be or-ed rather than assigned to.)
The implementation is divided into two parts, the signed and unsigned basecases,
The implementation is divided into two parts, the signed and unsigned basecases,
...
...
Demos/freeze/README.txt
View file @
4f237620
...
@@ -17,7 +17,7 @@ DESCRIPTION
...
@@ -17,7 +17,7 @@ DESCRIPTION
with one or more Cython modules built in. This allows one to create a single
with one or more Cython modules built in. This allows one to create a single
executable from Cython code, without having to have separate shared objects
executable from Cython code, without having to have separate shared objects
for each Cython module. A major advantage of this approach is that it allows
for each Cython module. A major advantage of this approach is that it allows
debuging with gprof(1), which does not work with shared objects.
debug
g
ing with gprof(1), which does not work with shared objects.
Unless ``-p`` is given, the first module's ``__name__`` is set to
Unless ``-p`` is given, the first module's ``__name__`` is set to
``"__main__"`` and is imported on startup; if ``-p`` is given, a normal Python
``"__main__"`` and is imported on startup; if ``-p`` is given, a normal Python
...
...
Tools/rules.bzl
View file @
4f237620
...
@@ -48,7 +48,7 @@ def pyx_library(
...
@@ -48,7 +48,7 @@ def pyx_library(
[
"-s '%s=%s'"
%
x
for
x
in
cython_options
])
[
"-s '%s=%s'"
%
x
for
x
in
cython_options
])
# TODO(robertwb): It might be better to only generate the C files,
# TODO(robertwb): It might be better to only generate the C files,
# letting cc_library (or similar) handle the rest, but there isn't yet
# letting cc_library (or similar) handle the rest, but there isn't yet
# suport compiling Python C extensions from bazel.
# sup
p
ort compiling Python C extensions from bazel.
native
.
genrule
(
native
.
genrule
(
name
=
name
+
"_cythonize"
,
name
=
name
+
"_cythonize"
,
srcs
=
pyx_srcs
,
srcs
=
pyx_srcs
,
...
...
Tools/site_scons/site_tools/pyext.py
View file @
4f237620
...
@@ -116,7 +116,7 @@ def pyext_coms(platform):
...
@@ -116,7 +116,7 @@ def pyext_coms(platform):
return
pyext_cccom
,
pyext_cxxcom
,
pyext_linkcom
return
pyext_cccom
,
pyext_cxxcom
,
pyext_linkcom
def
set_basic_vars
(
env
):
def
set_basic_vars
(
env
):
# Set construction variables which are independ
a
nt on whether we are using
# Set construction variables which are independ
e
nt on whether we are using
# distutils or not.
# distutils or not.
env
[
'PYEXTCPPPATH'
]
=
SCons
.
Util
.
CLVar
(
'$PYEXTINCPATH'
)
env
[
'PYEXTCPPPATH'
]
=
SCons
.
Util
.
CLVar
(
'$PYEXTINCPATH'
)
...
...
appveyor.yml
View file @
4f237620
...
@@ -4,7 +4,7 @@ environment:
...
@@ -4,7 +4,7 @@ environment:
global
:
global
:
# SDK v7.0 MSVC Express 2008's SetEnv.cmd script will fail if the
# SDK v7.0 MSVC Express 2008's SetEnv.cmd script will fail if the
# /E:ON and /V:ON options are not enabled in the batch script intepreter
# /E:ON and /V:ON options are not enabled in the batch script inte
r
preter
# See: http://stackoverflow.com/a/13751649/163740
# See: http://stackoverflow.com/a/13751649/163740
WITH_ENV
:
"
cmd
/E:ON
/V:ON
/C
.
\\
appveyor
\\
run_with_env.cmd"
WITH_ENV
:
"
cmd
/E:ON
/V:ON
/C
.
\\
appveyor
\\
run_with_env.cmd"
...
...
docs/src/userguide/wrapping_CPlusPlus.rst
View file @
4f237620
...
@@ -273,7 +273,7 @@ attribute access, you could just implement some properties::
...
@@ -273,7 +273,7 @@ attribute access, you could just implement some properties::
Cython initializes C++ class attributes of a cdef class using the nullary constructor.
Cython initializes C++ class attributes of a cdef class using the nullary constructor.
If the class you're wrapping does not have a nullary constructor, you must store a pointer
If the class you're wrapping does not have a nullary constructor, you must store a pointer
to the wrapped class and manually allocate and deallocate it.
to the wrapped class and manually allocate and deallocate it.
A conv
i
enient and safe place to do so is in the `__cinit__` and `__dealloc__` methods
A convenient and safe place to do so is in the `__cinit__` and `__dealloc__` methods
which are guaranteed to be called exactly once upon creation and deletion of the Python
which are guaranteed to be called exactly once upon creation and deletion of the Python
instance.
instance.
...
@@ -645,7 +645,7 @@ e.g.::
...
@@ -645,7 +645,7 @@ e.g.::
cdef vector[int] v = ...
cdef vector[int] v = ...
it = v.begin()
it = v.begin()
(Though of course the ``for .. in`` syntax is prefered for objects supporting
(Though of course the ``for .. in`` syntax is prefer
r
ed for objects supporting
the iteration protocol.)
the iteration protocol.)
RTTI and typeid()
RTTI and typeid()
...
...
pyximport/pyximport.py
View file @
4f237620
...
@@ -502,11 +502,11 @@ def install(pyximport=True, pyimport=False, build_dir=None, build_in_temp=True,
...
@@ -502,11 +502,11 @@ def install(pyximport=True, pyimport=False, build_dir=None, build_in_temp=True,
``build_in_temp=False`` will produce the C files locally. Working
``build_in_temp=False`` will produce the C files locally. Working
with complex dependencies and debugging becomes more easy. This
with complex dependencies and debugging becomes more easy. This
can principally interfere with existing files of the same name.
can principally interfere with existing files of the same name.
build_in_temp can be overriden by <modulename>.pyxbld/make_setup_args()
build_in_temp can be overrid
d
en by <modulename>.pyxbld/make_setup_args()
by a dict item of 'build_in_temp'
by a dict item of 'build_in_temp'
``setup_args``: dict of arguments for Distribution - see
``setup_args``: dict of arguments for Distribution - see
distutils.core.setup() . They are extended/overriden by those of
distutils.core.setup() . They are extended/overrid
d
en by those of
<modulename>.pyxbld/make_setup_args()
<modulename>.pyxbld/make_setup_args()
``reload_support``: Enables support for dynamic
``reload_support``: Enables support for dynamic
...
...
runtests.py
View file @
4f237620
...
@@ -94,7 +94,7 @@ def _cleanup_files():
...
@@ -94,7 +94,7 @@ def _cleanup_files():
def
get_distutils_distro
(
_cache
=
[]):
def
get_distutils_distro
(
_cache
=
[]):
if
_cache
:
if
_cache
:
return
_cache
[
0
]
return
_cache
[
0
]
# late import to accomodate for setuptools override
# late import to accom
m
odate for setuptools override
from
distutils.dist
import
Distribution
from
distutils.dist
import
Distribution
distutils_distro
=
Distribution
()
distutils_distro
=
Distribution
()
...
@@ -1765,7 +1765,7 @@ def main():
...
@@ -1765,7 +1765,7 @@ def main():
help="do not delete the generated C files (allows passing --no-cython on next run)")
help="do not delete the generated C files (allows passing --no-cython on next run)")
parser.add_option("--no-cleanup-sharedlibs", dest="cleanup_sharedlibs",
parser.add_option("--no-cleanup-sharedlibs", dest="cleanup_sharedlibs",
action="store_false", default=True,
action="store_false", default=True,
help="do not delete the generated shared libary files (allows manual module experimentation)")
help="do not delete the generated shared lib
r
ary files (allows manual module experimentation)")
parser.add_option("--no-cleanup-failures", dest="cleanup_failures",
parser.add_option("--no-cleanup-failures", dest="cleanup_failures",
action="store_false", default=True,
action="store_false", default=True,
help="enable --no-cleanup and --no-cleanup-sharedlibs for failed tests only")
help="enable --no-cleanup and --no-cleanup-sharedlibs for failed tests only")
...
...
tests/buffers/bufaccess.pyx
View file @
4f237620
...
@@ -649,7 +649,7 @@ def c_contig(object[int, ndim=1, mode='c'] buf):
...
@@ -649,7 +649,7 @@ def c_contig(object[int, ndim=1, mode='c'] buf):
@
testcase
@
testcase
def
c_contig_2d
(
object
[
int
,
ndim
=
2
,
mode
=
'c'
]
buf
):
def
c_contig_2d
(
object
[
int
,
ndim
=
2
,
mode
=
'c'
]
buf
):
"""
"""
Multi-dim has sep
e
rate implementation
Multi-dim has sep
a
rate implementation
>>> A = IntMockBuffer(None, range(12), shape=(3,4))
>>> A = IntMockBuffer(None, range(12), shape=(3,4))
>>> c_contig_2d(A)
>>> c_contig_2d(A)
...
...
tests/memoryview/memoryview.pyx
View file @
4f237620
...
@@ -452,7 +452,7 @@ def c_contig(int[::1] mslice):
...
@@ -452,7 +452,7 @@ def c_contig(int[::1] mslice):
def
c_contig_2d
(
int
[:,
::
1
]
mslice
):
def
c_contig_2d
(
int
[:,
::
1
]
mslice
):
"""
"""
Multi-dim has sep
e
rate implementation
Multi-dim has sep
a
rate implementation
>>> A = IntMockBuffer(None, range(12), shape=(3,4))
>>> A = IntMockBuffer(None, range(12), shape=(3,4))
>>> c_contig_2d(A)
>>> c_contig_2d(A)
...
...
tests/memoryview/memslice.pyx
View file @
4f237620
...
@@ -662,7 +662,7 @@ def c_contig(int[::1] buf):
...
@@ -662,7 +662,7 @@ def c_contig(int[::1] buf):
@
testcase
@
testcase
def
c_contig_2d
(
int
[:,
::
1
]
buf
):
def
c_contig_2d
(
int
[:,
::
1
]
buf
):
"""
"""
Multi-dim has sep
e
rate implementation
Multi-dim has sep
a
rate implementation
>>> A = IntMockBuffer(None, range(12), shape=(3,4))
>>> A = IntMockBuffer(None, range(12), shape=(3,4))
>>> c_contig_2d(A)
>>> c_contig_2d(A)
...
...
tests/run/arithmetic_analyse_types_helper.h
View file @
4f237620
/* A set of mutually incompat
a
ble return types. */
/* A set of mutually incompat
i
ble return types. */
struct
short_return
{
char
*
msg
;
};
struct
short_return
{
char
*
msg
;
};
struct
int_return
{
char
*
msg
;
};
struct
int_return
{
char
*
msg
;
};
...
...
tests/run/overflow_check.pxi
View file @
4f237620
...
@@ -30,9 +30,9 @@ cpdef check(func, op, a, b):
...
@@ -30,9 +30,9 @@ cpdef check(func, op, a, b):
op_res
=
op
(
a
,
b
)
op_res
=
op
(
a
,
b
)
except
OverflowError
:
except
OverflowError
:
assign_overflow
=
True
assign_overflow
=
True
assert
func_overflow
==
assign_overflow
,
"Inconsist
a
nt overflow: %s(%s, %s)"
%
(
func
,
a
,
b
)
assert
func_overflow
==
assign_overflow
,
"Inconsist
e
nt overflow: %s(%s, %s)"
%
(
func
,
a
,
b
)
if
not
func_overflow
:
if
not
func_overflow
:
assert
res
==
op_res
,
"Inconsist
a
nt values: %s(%s, %s) == %s != %s"
%
(
func
,
a
,
b
,
res
,
op_res
)
assert
res
==
op_res
,
"Inconsist
e
nt values: %s(%s, %s) == %s != %s"
%
(
func
,
a
,
b
,
res
,
op_res
)
medium_values
=
(
max_value_
/
2
,
max_value_
/
3
,
min_value_
/
2
,
<
INT
>
sqrt
(
<
long
double
>
max_value_
)
-
<
INT
>
1
,
<
INT
>
sqrt
(
<
long
double
>
max_value_
)
+
1
)
medium_values
=
(
max_value_
/
2
,
max_value_
/
3
,
min_value_
/
2
,
<
INT
>
sqrt
(
<
long
double
>
max_value_
)
-
<
INT
>
1
,
<
INT
>
sqrt
(
<
long
double
>
max_value_
)
+
1
)
def
run_test
(
func
,
op
):
def
run_test
(
func
,
op
):
...
...
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