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
a8af26e0
Commit
a8af26e0
authored
Mar 28, 2016
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '0.24.x'
parents
9ef17d2e
642b09e7
Changes
12
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
679 additions
and
743 deletions
+679
-743
Cython/CodeWriter.py
Cython/CodeWriter.py
+3
-3
Cython/Compiler/AutoDocTransforms.py
Cython/Compiler/AutoDocTransforms.py
+2
-2
Cython/Compiler/Code.py
Cython/Compiler/Code.py
+18
-21
Cython/Compiler/ModuleNode.py
Cython/Compiler/ModuleNode.py
+187
-202
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+406
-457
Cython/Compiler/Options.py
Cython/Compiler/Options.py
+17
-8
Cython/Compiler/Scanning.py
Cython/Compiler/Scanning.py
+5
-6
Cython/Compiler/UtilityCode.py
Cython/Compiler/UtilityCode.py
+19
-24
Cython/Compiler/Visitor.py
Cython/Compiler/Visitor.py
+5
-8
Cython/Shadow.py
Cython/Shadow.py
+11
-8
Cython/__init__.py
Cython/__init__.py
+5
-3
pylintrc
pylintrc
+1
-1
No files found.
Cython/CodeWriter.py
View file @
a8af26e0
...
@@ -32,7 +32,7 @@ class DeclarationWriter(TreeVisitor):
...
@@ -32,7 +32,7 @@ class DeclarationWriter(TreeVisitor):
indent_string
=
u" "
indent_string
=
u" "
def
__init__
(
self
,
result
=
None
):
def
__init__
(
self
,
result
=
None
):
super
(
DeclarationWriter
,
self
).
__init__
()
super
(
DeclarationWriter
,
self
).
__init__
()
if
result
is
None
:
if
result
is
None
:
result
=
LinesResult
()
result
=
LinesResult
()
...
@@ -51,7 +51,7 @@ class DeclarationWriter(TreeVisitor):
...
@@ -51,7 +51,7 @@ class DeclarationWriter(TreeVisitor):
def
dedent
(
self
):
def
dedent
(
self
):
self
.
numindents
-=
1
self
.
numindents
-=
1
def
startline
(
self
,
s
=
u""
):
def
startline
(
self
,
s
=
u""
):
self
.
result
.
put
(
self
.
indent_string
*
self
.
numindents
+
s
)
self
.
result
.
put
(
self
.
indent_string
*
self
.
numindents
+
s
)
def
put
(
self
,
s
):
def
put
(
self
,
s
):
...
@@ -60,7 +60,7 @@ class DeclarationWriter(TreeVisitor):
...
@@ -60,7 +60,7 @@ class DeclarationWriter(TreeVisitor):
def
putline
(
self
,
s
):
def
putline
(
self
,
s
):
self
.
result
.
putline
(
self
.
indent_string
*
self
.
numindents
+
s
)
self
.
result
.
putline
(
self
.
indent_string
*
self
.
numindents
+
s
)
def
endline
(
self
,
s
=
u""
):
def
endline
(
self
,
s
=
u""
):
self
.
result
.
putline
(
s
)
self
.
result
.
putline
(
s
)
def
line
(
self
,
s
):
def
line
(
self
,
s
):
...
...
Cython/Compiler/AutoDocTransforms.py
View file @
a8af26e0
...
@@ -70,7 +70,7 @@ class EmbedSignature(CythonTransform):
...
@@ -70,7 +70,7 @@ class EmbedSignature(CythonTransform):
except
Exception
:
except
Exception
:
try
:
try
:
return
self
.
_fmt_expr_node
(
default_val
)
return
self
.
_fmt_expr_node
(
default_val
)
except
AttributeError
as
e
:
except
AttributeError
:
return
'<???>'
return
'<???>'
def
_fmt_arg
(
self
,
arg
):
def
_fmt_arg
(
self
,
arg
):
...
...
Cython/Compiler/Code.py
View file @
a8af26e0
...
@@ -40,7 +40,7 @@ try:
...
@@ -40,7 +40,7 @@ try:
except
ImportError
:
except
ImportError
:
from
builtins
import
str
as
basestring
from
builtins
import
str
as
basestring
KEYWORDS_MUST_BE_BYTES
=
sys
.
version_info
<
(
2
,
7
)
KEYWORDS_MUST_BE_BYTES
=
sys
.
version_info
<
(
2
,
7
)
non_portable_builtins_map
=
{
non_portable_builtins_map
=
{
...
@@ -481,7 +481,7 @@ class UtilityCode(UtilityCodeBase):
...
@@ -481,7 +481,7 @@ class UtilityCode(UtilityCodeBase):
is_specialised1, impl = self.inject_string_constants(impl, output)
is_specialised1, impl = self.inject_string_constants(impl, output)
is_specialised2, impl = self.inject_unbound_methods(impl, output)
is_specialised2, impl = self.inject_unbound_methods(impl, output)
writer = output['
utility_code_def
']
writer = output['
utility_code_def
']
writer.putln("/* %s */" % self.name)
;
writer.putln("/* %s */" % self.name)
if not (is_specialised1 or is_specialised2):
if not (is_specialised1 or is_specialised2):
# no module specific adaptations => can be reused
# no module specific adaptations => can be reused
writer.put_or_include(impl, '
%
s_impl
' % self.name)
writer.put_or_include(impl, '
%
s_impl
' % self.name)
...
@@ -849,7 +849,7 @@ class StringConst(object):
...
@@ -849,7 +849,7 @@ class StringConst(object):
def add_py_version(self, version):
def add_py_version(self, version):
if not version:
if not version:
self.py_versions = [2,3]
self.py_versions = [2,
3]
elif version not in self.py_versions:
elif version not in self.py_versions:
self.py_versions.append(version)
self.py_versions.append(version)
...
@@ -1280,8 +1280,8 @@ class GlobalState(object):
...
@@ -1280,8 +1280,8 @@ class GlobalState(object):
self
.
generate_object_constant_decls
()
self
.
generate_object_constant_decls
()
def
generate_object_constant_decls
(
self
):
def
generate_object_constant_decls
(
self
):
consts
=
[
(
len
(
c
.
cname
),
c
.
cname
,
c
)
consts
=
[(
len
(
c
.
cname
),
c
.
cname
,
c
)
for
c
in
self
.
py_constants
]
for
c
in
self
.
py_constants
]
consts
.
sort
()
consts
.
sort
()
decls_writer
=
self
.
parts
[
'decls'
]
decls_writer
=
self
.
parts
[
'decls'
]
for
_
,
cname
,
c
in
consts
:
for
_
,
cname
,
c
in
consts
:
...
@@ -1345,8 +1345,7 @@ class GlobalState(object):
...
@@ -1345,8 +1345,7 @@ class GlobalState(object):
py_strings
.
sort
()
py_strings
.
sort
()
w
=
self
.
parts
[
'pystring_table'
]
w
=
self
.
parts
[
'pystring_table'
]
w
.
putln
(
""
)
w
.
putln
(
""
)
w
.
putln
(
"static __Pyx_StringTabEntry %s[] = {"
%
w
.
putln
(
"static __Pyx_StringTabEntry %s[] = {"
%
Naming
.
stringtab_cname
)
Naming
.
stringtab_cname
)
for
c_cname
,
_
,
py_string
in
py_strings
:
for
c_cname
,
_
,
py_string
in
py_strings
:
if
not
py_string
.
is_str
or
not
py_string
.
encoding
or
\
if
not
py_string
.
is_str
or
not
py_string
.
encoding
or
\
py_string
.
encoding
in
(
'ASCII'
,
'USASCII'
,
'US-ASCII'
,
py_string
.
encoding
in
(
'ASCII'
,
'USASCII'
,
'US-ASCII'
,
...
@@ -1359,8 +1358,7 @@ class GlobalState(object):
...
@@ -1359,8 +1358,7 @@ class GlobalState(object):
"static PyObject *%s;"
%
py_string
.
cname
)
"static PyObject *%s;"
%
py_string
.
cname
)
if
py_string
.
py3str_cstring
:
if
py_string
.
py3str_cstring
:
w
.
putln
(
"#if PY_MAJOR_VERSION >= 3"
)
w
.
putln
(
"#if PY_MAJOR_VERSION >= 3"
)
w
.
putln
(
w
.
putln
(
"{&%s, %s, sizeof(%s), %s, %d, %d, %d},"
%
(
"{&%s, %s, sizeof(%s), %s, %d, %d, %d},"
%
(
py_string
.
cname
,
py_string
.
cname
,
py_string
.
py3str_cstring
.
cname
,
py_string
.
py3str_cstring
.
cname
,
py_string
.
py3str_cstring
.
cname
,
py_string
.
py3str_cstring
.
cname
,
...
@@ -1368,8 +1366,7 @@ class GlobalState(object):
...
@@ -1368,8 +1366,7 @@ class GlobalState(object):
py_string
.
intern
py_string
.
intern
))
))
w
.
putln
(
"#else"
)
w
.
putln
(
"#else"
)
w
.
putln
(
w
.
putln
(
"{&%s, %s, sizeof(%s), %s, %d, %d, %d},"
%
(
"{&%s, %s, sizeof(%s), %s, %d, %d, %d},"
%
(
py_string
.
cname
,
py_string
.
cname
,
c_cname
,
c_cname
,
c_cname
,
c_cname
,
...
...
Cython/Compiler/ModuleNode.py
View file @
a8af26e0
This diff is collapsed.
Click to expand it.
Cython/Compiler/Nodes.py
View file @
a8af26e0
This diff is collapsed.
Click to expand it.
Cython/Compiler/Options.py
View file @
a8af26e0
...
@@ -263,6 +263,7 @@ directive_scopes = { # defaults to available everywhere
...
@@ -263,6 +263,7 @@ directive_scopes = { # defaults to available everywhere
'language_level'
:
(
'module'
,),
'language_level'
:
(
'module'
,),
}
}
def
parse_directive_value
(
name
,
value
,
relaxed_bool
=
False
):
def
parse_directive_value
(
name
,
value
,
relaxed_bool
=
False
):
"""
"""
Parses value as an option value for the given name and returns
Parses value as an option value for the given name and returns
...
@@ -292,16 +293,21 @@ def parse_directive_value(name, value, relaxed_bool=False):
...
@@ -292,16 +293,21 @@ def parse_directive_value(name, value, relaxed_bool=False):
ValueError: c_string_type directive must be one of ('bytes', 'bytearray', 'str', 'unicode'), got 'unnicode'
ValueError: c_string_type directive must be one of ('bytes', 'bytearray', 'str', 'unicode'), got 'unnicode'
"""
"""
type
=
directive_types
.
get
(
name
)
type
=
directive_types
.
get
(
name
)
if
not
type
:
return
None
if
not
type
:
return
None
orig_value
=
value
orig_value
=
value
if
type
is
bool
:
if
type
is
bool
:
value
=
str
(
value
)
value
=
str
(
value
)
if
value
==
'True'
:
return
True
if
value
==
'True'
:
if
value
==
'False'
:
return
False
return
True
if
value
==
'False'
:
return
False
if
relaxed_bool
:
if
relaxed_bool
:
value
=
value
.
lower
()
value
=
value
.
lower
()
if
value
in
(
"true"
,
"yes"
):
return
True
if
value
in
(
"true"
,
"yes"
):
elif
value
in
(
"false"
,
"no"
):
return
False
return
True
elif
value
in
(
"false"
,
"no"
):
return
False
raise
ValueError
(
"%s directive must be set to True or False, got '%s'"
%
(
raise
ValueError
(
"%s directive must be set to True or False, got '%s'"
%
(
name
,
orig_value
))
name
,
orig_value
))
elif
type
is
int
:
elif
type
is
int
:
...
@@ -317,6 +323,7 @@ def parse_directive_value(name, value, relaxed_bool=False):
...
@@ -317,6 +323,7 @@ def parse_directive_value(name, value, relaxed_bool=False):
else
:
else
:
assert
False
assert
False
def
parse_directive_list
(
s
,
relaxed_bool
=
False
,
ignore_unknown
=
False
,
def
parse_directive_list
(
s
,
relaxed_bool
=
False
,
ignore_unknown
=
False
,
current_settings
=
None
):
current_settings
=
None
):
"""
"""
...
@@ -352,9 +359,11 @@ def parse_directive_list(s, relaxed_bool=False, ignore_unknown=False,
...
@@ -352,9 +359,11 @@ def parse_directive_list(s, relaxed_bool=False, ignore_unknown=False,
result
=
current_settings
result
=
current_settings
for
item
in
s
.
split
(
','
):
for
item
in
s
.
split
(
','
):
item
=
item
.
strip
()
item
=
item
.
strip
()
if
not
item
:
continue
if
not
item
:
if
not
'='
in
item
:
raise
ValueError
(
'Expected "=" in option "%s"'
%
item
)
continue
name
,
value
=
[
s
.
strip
()
for
s
in
item
.
strip
().
split
(
'='
,
1
)
]
if
not
'='
in
item
:
raise
ValueError
(
'Expected "=" in option "%s"'
%
item
)
name
,
value
=
[
s
.
strip
()
for
s
in
item
.
strip
().
split
(
'='
,
1
)]
if
name
not
in
directive_defaults
:
if
name
not
in
directive_defaults
:
found
=
False
found
=
False
if
name
.
endswith
(
'.all'
):
if
name
.
endswith
(
'.all'
):
...
...
Cython/Compiler/Scanning.py
View file @
a8af26e0
...
@@ -68,7 +68,7 @@ class Method(object):
...
@@ -68,7 +68,7 @@ class Method(object):
class
CompileTimeScope
(
object
):
class
CompileTimeScope
(
object
):
def
__init__
(
self
,
outer
=
None
):
def
__init__
(
self
,
outer
=
None
):
self
.
entries
=
{}
self
.
entries
=
{}
self
.
outer
=
outer
self
.
outer
=
outer
...
@@ -97,8 +97,7 @@ class CompileTimeScope(object):
...
@@ -97,8 +97,7 @@ class CompileTimeScope(object):
def
initial_compile_time_env
():
def
initial_compile_time_env
():
benv
=
CompileTimeScope
()
benv
=
CompileTimeScope
()
names
=
(
'UNAME_SYSNAME'
,
'UNAME_NODENAME'
,
'UNAME_RELEASE'
,
names
=
(
'UNAME_SYSNAME'
,
'UNAME_NODENAME'
,
'UNAME_RELEASE'
,
'UNAME_VERSION'
,
'UNAME_MACHINE'
)
'UNAME_VERSION'
,
'UNAME_MACHINE'
)
for
name
,
value
in
zip
(
names
,
platform
.
uname
()):
for
name
,
value
in
zip
(
names
,
platform
.
uname
()):
benv
.
declare
(
name
,
value
)
benv
.
declare
(
name
,
value
)
try
:
try
:
...
@@ -272,8 +271,8 @@ class StringSourceDescriptor(SourceDescriptor):
...
@@ -272,8 +271,8 @@ class StringSourceDescriptor(SourceDescriptor):
if
not
encoding
:
if
not
encoding
:
return
self
.
codelines
return
self
.
codelines
else
:
else
:
return
[
line
.
encode
(
encoding
,
error_handling
).
decode
(
encoding
)
return
[
line
.
encode
(
encoding
,
error_handling
).
decode
(
encoding
)
for
line
in
self
.
codelines
]
for
line
in
self
.
codelines
]
def
get_description
(
self
):
def
get_description
(
self
):
return
self
.
name
return
self
.
name
...
@@ -487,7 +486,7 @@ class PyrexScanner(Scanner):
...
@@ -487,7 +486,7 @@ class PyrexScanner(Scanner):
else
:
else
:
self
.
expected
(
what
,
message
)
self
.
expected
(
what
,
message
)
def
expected
(
self
,
what
,
message
=
None
):
def
expected
(
self
,
what
,
message
=
None
):
if
message
:
if
message
:
self
.
error
(
message
)
self
.
error
(
message
)
else
:
else
:
...
...
Cython/Compiler/UtilityCode.py
View file @
a8af26e0
...
@@ -17,8 +17,7 @@ class NonManglingModuleScope(Symtab.ModuleScope):
...
@@ -17,8 +17,7 @@ class NonManglingModuleScope(Symtab.ModuleScope):
def
add_imported_entry
(
self
,
name
,
entry
,
pos
):
def
add_imported_entry
(
self
,
name
,
entry
,
pos
):
entry
.
used
=
True
entry
.
used
=
True
return
super
(
NonManglingModuleScope
,
self
).
add_imported_entry
(
return
super
(
NonManglingModuleScope
,
self
).
add_imported_entry
(
name
,
entry
,
pos
)
name
,
entry
,
pos
)
def
mangle
(
self
,
prefix
,
name
=
None
):
def
mangle
(
self
,
prefix
,
name
=
None
):
if
name
:
if
name
:
...
@@ -137,26 +136,22 @@ class CythonUtilityCode(Code.UtilityCodeBase):
...
@@ -137,26 +136,22 @@ class CythonUtilityCode(Code.UtilityCodeBase):
pipeline
=
Pipeline
.
insert_into_pipeline
(
pipeline
,
transform
,
pipeline
=
Pipeline
.
insert_into_pipeline
(
pipeline
,
transform
,
before
=
before
)
before
=
before
)
if
self
.
from_scope
:
def
merge_scope
(
scope
)
:
def
scope_transform
(
module_node
):
def
merge_
scope_transform
(
module_node
):
module_node
.
scope
.
merge_in
(
s
elf
.
from_s
cope
)
module_node
.
scope
.
merge_in
(
scope
)
return
module_node
return
module_node
return
merge_scope_transform
transform
=
ParseTreeTransforms
.
AnalyseDeclarationsTransform
if
self
.
from_scope
:
pipeline
=
Pipeline
.
insert_into_pipeline
(
pipeline
,
scope_transform
,
pipeline
=
Pipeline
.
insert_into_pipeline
(
before
=
transform
)
pipeline
,
merge_scope
(
self
.
from_scope
),
before
=
ParseTreeTransforms
.
AnalyseDeclarationsTransform
)
for
dep
in
self
.
requires
:
for
dep
in
self
.
requires
:
if
(
isinstance
(
dep
,
CythonUtilityCode
)
if
isinstance
(
dep
,
CythonUtilityCode
)
and
hasattr
(
dep
,
'tree'
)
and
not
cython_scope
:
and
hasattr
(
dep
,
'tree'
)
pipeline
=
Pipeline
.
insert_into_pipeline
(
and
not
cython_scope
):
pipeline
,
merge_scope
(
dep
.
tree
.
scope
),
def
scope_transform
(
module_node
):
before
=
ParseTreeTransforms
.
AnalyseDeclarationsTransform
)
module_node
.
scope
.
merge_in
(
dep
.
tree
.
scope
)
return
module_node
transform
=
ParseTreeTransforms
.
AnalyseDeclarationsTransform
pipeline
=
Pipeline
.
insert_into_pipeline
(
pipeline
,
scope_transform
,
before
=
transform
)
if
self
.
outer_module_scope
:
if
self
.
outer_module_scope
:
# inject outer module between utility code module and builtin module
# inject outer module between utility code module and builtin module
...
@@ -164,9 +159,9 @@ class CythonUtilityCode(Code.UtilityCodeBase):
...
@@ -164,9 +159,9 @@ class CythonUtilityCode(Code.UtilityCodeBase):
module_node
.
scope
.
outer_scope
=
self
.
outer_module_scope
module_node
.
scope
.
outer_scope
=
self
.
outer_module_scope
return
module_node
return
module_node
transform
=
ParseTreeTransforms
.
AnalyseDeclarationsTransform
pipeline
=
Pipeline
.
insert_into_pipeline
(
pipeline
=
Pipeline
.
insert_into_pipeline
(
pipeline
,
scope_transform
,
pipeline
,
scope_transform
,
before
=
t
ransform
)
before
=
ParseTreeTransforms
.
AnalyseDeclarationsT
ransform
)
(
err
,
tree
)
=
Pipeline
.
run_pipeline
(
pipeline
,
tree
,
printtree
=
False
)
(
err
,
tree
)
=
Pipeline
.
run_pipeline
(
pipeline
,
tree
,
printtree
=
False
)
assert
not
err
,
err
assert
not
err
,
err
...
@@ -199,13 +194,12 @@ class CythonUtilityCode(Code.UtilityCodeBase):
...
@@ -199,13 +194,12 @@ class CythonUtilityCode(Code.UtilityCodeBase):
entries
.
pop
(
'__builtins__'
)
entries
.
pop
(
'__builtins__'
)
entries
.
pop
(
'__doc__'
)
entries
.
pop
(
'__doc__'
)
for
name
,
entry
in
entries
.
item
s
():
for
entry
in
entries
.
value
s
():
entry
.
utility_code_definition
=
self
entry
.
utility_code_definition
=
self
entry
.
used
=
used
entry
.
used
=
used
original_scope
=
tree
.
scope
original_scope
=
tree
.
scope
dest_scope
.
merge_in
(
original_scope
,
merge_unused
=
True
,
dest_scope
.
merge_in
(
original_scope
,
merge_unused
=
True
,
whitelist
=
whitelist
)
whitelist
=
whitelist
)
tree
.
scope
=
dest_scope
tree
.
scope
=
dest_scope
for
dep
in
self
.
requires
:
for
dep
in
self
.
requires
:
...
@@ -214,6 +208,7 @@ class CythonUtilityCode(Code.UtilityCodeBase):
...
@@ -214,6 +208,7 @@ class CythonUtilityCode(Code.UtilityCodeBase):
return
original_scope
return
original_scope
def
declare_declarations_in_scope
(
declaration_string
,
env
,
private_type
=
True
,
def
declare_declarations_in_scope
(
declaration_string
,
env
,
private_type
=
True
,
*
args
,
**
kwargs
):
*
args
,
**
kwargs
):
"""
"""
...
...
Cython/Compiler/Visitor.py
View file @
a8af26e0
...
@@ -77,9 +77,8 @@ class TreeVisitor(object):
...
@@ -77,9 +77,8 @@ class TreeVisitor(object):
self
.
access_path
=
[]
self
.
access_path
=
[]
def
dump_node
(
self
,
node
,
indent
=
0
):
def
dump_node
(
self
,
node
,
indent
=
0
):
ignored
=
list
(
node
.
child_attrs
or
[])
+
[
u'child_attrs'
,
u'pos'
,
ignored
=
list
(
node
.
child_attrs
or
[])
+
[
u'gil_message'
,
u'cpp_message'
,
u'child_attrs'
,
u'pos'
,
u'gil_message'
,
u'cpp_message'
,
u'subexprs'
]
u'subexprs'
]
values
=
[]
values
=
[]
pos
=
getattr
(
node
,
'pos'
,
None
)
pos
=
getattr
(
node
,
'pos'
,
None
)
if
pos
:
if
pos
:
...
@@ -93,7 +92,7 @@ class TreeVisitor(object):
...
@@ -93,7 +92,7 @@ class TreeVisitor(object):
for
attr
in
attribute_names
:
for
attr
in
attribute_names
:
if
attr
in
ignored
:
if
attr
in
ignored
:
continue
continue
if
attr
.
startswith
(
u'_'
)
or
attr
.
endswith
(
u
'_'
):
if
attr
.
startswith
(
'_'
)
or
attr
.
endswith
(
'_'
):
continue
continue
try
:
try
:
value
=
getattr
(
node
,
attr
)
value
=
getattr
(
node
,
attr
)
...
@@ -108,8 +107,7 @@ class TreeVisitor(object):
...
@@ -108,8 +107,7 @@ class TreeVisitor(object):
else
:
else
:
value
=
repr
(
value
)
value
=
repr
(
value
)
values
.
append
(
u'%s = %s'
%
(
attr
,
value
))
values
.
append
(
u'%s = %s'
%
(
attr
,
value
))
return
u'%s(%s)'
%
(
node
.
__class__
.
__name__
,
return
u'%s(%s)'
%
(
node
.
__class__
.
__name__
,
u',
\
n
'
.
join
(
values
))
u',
\
n
'
.
join
(
values
))
def
_find_node_path
(
self
,
stacktrace
):
def
_find_node_path
(
self
,
stacktrace
):
import
os.path
import
os.path
...
@@ -129,7 +127,6 @@ class TreeVisitor(object):
...
@@ -129,7 +127,6 @@ class TreeVisitor(object):
return
(
last_traceback
,
nodes
)
return
(
last_traceback
,
nodes
)
def
_raise_compiler_error
(
self
,
child
,
e
):
def
_raise_compiler_error
(
self
,
child
,
e
):
import
sys
trace
=
[
''
]
trace
=
[
''
]
for
parent
,
attribute
,
index
in
self
.
access_path
:
for
parent
,
attribute
,
index
in
self
.
access_path
:
node
=
getattr
(
parent
,
attribute
)
node
=
getattr
(
parent
,
attribute
)
...
@@ -389,7 +386,7 @@ class EnvTransform(CythonTransform):
...
@@ -389,7 +386,7 @@ class EnvTransform(CythonTransform):
def
visit_CArgDeclNode
(
self
,
node
):
def
visit_CArgDeclNode
(
self
,
node
):
# default arguments are evaluated in the outer scope
# default arguments are evaluated in the outer scope
if
node
.
default
:
if
node
.
default
:
attrs
=
[
attr
for
attr
in
node
.
child_attrs
if
attr
!=
'default'
]
attrs
=
[
attr
for
attr
in
node
.
child_attrs
if
attr
!=
'default'
]
self
.
visitchildren
(
node
,
attrs
)
self
.
visitchildren
(
node
,
attrs
)
self
.
enter_scope
(
node
,
self
.
current_env
().
outer_scope
)
self
.
enter_scope
(
node
,
self
.
current_env
().
outer_scope
)
self
.
visitchildren
(
node
,
(
'default'
,))
self
.
visitchildren
(
node
,
(
'default'
,))
...
...
Cython/Shadow.py
View file @
a8af26e0
...
@@ -110,7 +110,7 @@ cclass = ccall = cfunc = _EmptyDecoratorAndManager()
...
@@ -110,7 +110,7 @@ cclass = ccall = cfunc = _EmptyDecoratorAndManager()
returns
=
wraparound
=
boundscheck
=
initializedcheck
=
nonecheck
=
\
returns
=
wraparound
=
boundscheck
=
initializedcheck
=
nonecheck
=
\
overflowcheck
=
embedsignature
=
cdivision
=
cdivision_warnings
=
\
overflowcheck
=
embedsignature
=
cdivision
=
cdivision_warnings
=
\
always_allows_keywords
=
profile
=
linetrace
=
infer_type
=
\
always_allows_keywords
=
profile
=
linetrace
=
infer_type
=
\
type_version_tag
=
unraisable_tracebacks
=
freelist
=
\
unraisable_tracebacks
=
freelist
=
\
lambda
arg
:
_EmptyDecoratorAndManager
()
lambda
arg
:
_EmptyDecoratorAndManager
()
optimization
=
_Optimization
()
optimization
=
_Optimization
()
...
@@ -120,6 +120,7 @@ overflowcheck.fold = optimization.use_switch = \
...
@@ -120,6 +120,7 @@ overflowcheck.fold = optimization.use_switch = \
final
=
internal
=
type_version_tag
=
no_gc_clear
=
_empty_decorator
final
=
internal
=
type_version_tag
=
no_gc_clear
=
_empty_decorator
def
inline
(
f
,
*
args
,
**
kwds
):
def
inline
(
f
,
*
args
,
**
kwds
):
if
isinstance
(
f
,
basestring
):
if
isinstance
(
f
,
basestring
):
from
Cython.Build.Inline
import
cython_inline
from
Cython.Build.Inline
import
cython_inline
...
@@ -128,10 +129,12 @@ def inline(f, *args, **kwds):
...
@@ -128,10 +129,12 @@ def inline(f, *args, **kwds):
assert
len
(
args
)
==
len
(
kwds
)
==
0
assert
len
(
args
)
==
len
(
kwds
)
==
0
return
f
return
f
def
compile
(
f
):
def
compile
(
f
):
from
Cython.Build.Inline
import
RuntimeCompiledFunction
from
Cython.Build.Inline
import
RuntimeCompiledFunction
return
RuntimeCompiledFunction
(
f
)
return
RuntimeCompiledFunction
(
f
)
# Special functions
# Special functions
def
cdiv
(
a
,
b
):
def
cdiv
(
a
,
b
):
...
...
Cython/__init__.py
View file @
a8af26e0
from
Cython.Shadow
import
__version__
from
__future__
import
absolute_import
from
.Shadow
import
__version__
# Void cython.* directives (for case insensitive operating systems).
# Void cython.* directives (for case insensitive operating systems).
from
Cython
.Shadow
import
*
from
.Shadow
import
*
def
load_ipython_extension
(
ip
):
def
load_ipython_extension
(
ip
):
"""Load the extension in IPython."""
"""Load the extension in IPython."""
from
Cython
.Build.IpythonMagic
import
CythonMagics
# pylint: disable=cyclic-import
from
.Build.IpythonMagic
import
CythonMagics
# pylint: disable=cyclic-import
ip
.
register_magics
(
CythonMagics
)
ip
.
register_magics
(
CythonMagics
)
pylintrc
View file @
a8af26e0
...
@@ -103,7 +103,7 @@ function-rgx=[a-z_][a-z0-9_]{2,30}$
...
@@ -103,7 +103,7 @@ function-rgx=[a-z_][a-z0-9_]{2,30}$
method-rgx=[a-z_][a-z0-9_]{2,30}|visit_[A-Za-z]+$
method-rgx=[a-z_][a-z0-9_]{2,30}|visit_[A-Za-z]+$
# Regular expression which should only match correct instance attribute names
# Regular expression which should only match correct instance attribute names
attr-rgx=[a-z_][a-z0-9_]{2,30}$
attr-rgx=[a-z_][a-z0-9_]{2,30}
|sy
$
# Regular expression which should only match correct argument names
# Regular expression which should only match correct argument names
argument-rgx=[a-z_][a-z0-9_]{0,30}$
argument-rgx=[a-z_][a-z0-9_]{0,30}$
...
...
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