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
958593e9
Commit
958593e9
authored
Jul 25, 2015
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '2to3' of
https://github.com/encukou/cython
into 2to3
parents
511e7a79
319814a0
Changes
26
Show whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
54 additions
and
65 deletions
+54
-65
2to3-fixers.txt
2to3-fixers.txt
+0
-16
Cython/Build/Dependencies.py
Cython/Build/Dependencies.py
+1
-1
Cython/Build/Inline.py
Cython/Build/Inline.py
+6
-1
Cython/Compiler/AutoDocTransforms.py
Cython/Compiler/AutoDocTransforms.py
+1
-1
Cython/Compiler/CmdLine.py
Cython/Compiler/CmdLine.py
+1
-1
Cython/Compiler/Code.py
Cython/Compiler/Code.py
+1
-1
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+16
-16
Cython/Compiler/Main.py
Cython/Compiler/Main.py
+2
-2
Cython/Compiler/ModuleNode.py
Cython/Compiler/ModuleNode.py
+1
-1
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+2
-2
Cython/Compiler/ParseTreeTransforms.py
Cython/Compiler/ParseTreeTransforms.py
+1
-1
Cython/Compiler/Parsing.py
Cython/Compiler/Parsing.py
+1
-1
Cython/Compiler/Pipeline.py
Cython/Compiler/Pipeline.py
+3
-3
Cython/Compiler/Symtab.py
Cython/Compiler/Symtab.py
+1
-1
Cython/Compiler/Visitor.py
Cython/Compiler/Visitor.py
+1
-1
Cython/Debugger/DebugWriter.py
Cython/Debugger/DebugWriter.py
+1
-1
Cython/Debugger/Tests/test_libcython_in_gdb.py
Cython/Debugger/Tests/test_libcython_in_gdb.py
+1
-1
Cython/Debugger/Tests/test_libpython_in_gdb.py
Cython/Debugger/Tests/test_libpython_in_gdb.py
+2
-2
Cython/Plex/Lexicons.py
Cython/Plex/Lexicons.py
+1
-1
Cython/Tempita/__init__.py
Cython/Tempita/__init__.py
+1
-1
Cython/Tempita/_tempita.py
Cython/Tempita/_tempita.py
+3
-3
Cython/TestUtils.py
Cython/TestUtils.py
+1
-1
Tools/site_scons/site_tools/pyext.py
Tools/site_scons/site_tools/pyext.py
+2
-2
pyximport/__init__.py
pyximport/__init__.py
+2
-2
pyximport/pyxbuild.py
pyximport/pyxbuild.py
+1
-1
pyximport/pyximport.py
pyximport/pyximport.py
+1
-1
No files found.
2to3-fixers.txt
View file @
958593e9
lib2to3.fixes.fix_apply
lib2to3.fixes.fix_basestring
lib2to3.fixes.fix_basestring
lib2to3.fixes.fix_buffer
lib2to3.fixes.fix_callable
lib2to3.fixes.fix_dict
lib2to3.fixes.fix_dict
lib2to3.fixes.fix_except
lib2to3.fixes.fix_exec
lib2to3.fixes.fix_execfile
lib2to3.fixes.fix_exitfunc
lib2to3.fixes.fix_filter
lib2to3.fixes.fix_funcattrs
lib2to3.fixes.fix_future
lib2to3.fixes.fix_future
lib2to3.fixes.fix_getcwdu
lib2to3.fixes.fix_has_key
lib2to3.fixes.fix_idioms
lib2to3.fixes.fix_import
lib2to3.fixes.fix_imports
lib2to3.fixes.fix_imports
lib2to3.fixes.fix_imports2
lib2to3.fixes.fix_input
lib2to3.fixes.fix_intern
lib2to3.fixes.fix_isinstance
lib2to3.fixes.fix_isinstance
lib2to3.fixes.fix_itertools
lib2to3.fixes.fix_itertools
lib2to3.fixes.fix_itertools_imports
lib2to3.fixes.fix_itertools_imports
...
...
Cython/Build/Dependencies.py
View file @
958593e9
...
@@ -978,7 +978,7 @@ def cythonize_one(pyx_file, c_file, fingerprint, quiet, options=None, raise_on_f
...
@@ -978,7 +978,7 @@ def cythonize_one(pyx_file, c_file, fingerprint, quiet, options=None, raise_on_f
result
=
compile
([
pyx_file
],
options
)
result
=
compile
([
pyx_file
],
options
)
if
result
.
num_errors
>
0
:
if
result
.
num_errors
>
0
:
any_failures
=
1
any_failures
=
1
except
(
EnvironmentError
,
PyrexError
)
,
e
:
except
(
EnvironmentError
,
PyrexError
)
as
e
:
sys
.
stderr
.
write
(
'%s
\
n
'
%
e
)
sys
.
stderr
.
write
(
'%s
\
n
'
%
e
)
any_failures
=
1
any_failures
=
1
# XXX
# XXX
...
...
Cython/Build/Inline.py
View file @
958593e9
...
@@ -22,6 +22,8 @@ from ..Compiler import Pipeline, Nodes
...
@@ -22,6 +22,8 @@ from ..Compiler import Pipeline, Nodes
from
..Utils
import
get_cython_cache_dir
from
..Utils
import
get_cython_cache_dir
import
cython
as
cython_module
import
cython
as
cython_module
IS_PY3
=
sys
.
version_info
>=
(
3
,
0
)
# A utility function to convert user-supplied ASCII strings to unicode.
# A utility function to convert user-supplied ASCII strings to unicode.
if
sys
.
version_info
[
0
]
<
3
:
if
sys
.
version_info
[
0
]
<
3
:
def
to_unicode
(
s
):
def
to_unicode
(
s
):
...
@@ -309,4 +311,7 @@ class RuntimeCompiledFunction(object):
...
@@ -309,4 +311,7 @@ class RuntimeCompiledFunction(object):
def
__call__
(
self
,
*
args
,
**
kwds
):
def
__call__
(
self
,
*
args
,
**
kwds
):
all
=
getcallargs
(
self
.
_f
,
*
args
,
**
kwds
)
all
=
getcallargs
(
self
.
_f
,
*
args
,
**
kwds
)
if
IS_PY3
:
return
cython_inline
(
self
.
_body
,
locals
=
self
.
_f
.
__globals__
,
globals
=
self
.
_f
.
__globals__
,
**
all
)
else
:
return
cython_inline
(
self
.
_body
,
locals
=
self
.
_f
.
func_globals
,
globals
=
self
.
_f
.
func_globals
,
**
all
)
return
cython_inline
(
self
.
_body
,
locals
=
self
.
_f
.
func_globals
,
globals
=
self
.
_f
.
func_globals
,
**
all
)
Cython/Compiler/AutoDocTransforms.py
View file @
958593e9
...
@@ -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
,
e
:
except
AttributeError
as
e
:
return
'<???>'
return
'<???>'
def
_fmt_arg
(
self
,
arg
):
def
_fmt_arg
(
self
,
arg
):
...
...
Cython/Compiler/CmdLine.py
View file @
958593e9
...
@@ -169,7 +169,7 @@ def parse_command_line(args):
...
@@ -169,7 +169,7 @@ def parse_command_line(args):
options
.
compiler_directives
=
Options
.
parse_directive_list
(
options
.
compiler_directives
=
Options
.
parse_directive_list
(
x_args
,
relaxed_bool
=
True
,
x_args
,
relaxed_bool
=
True
,
current_settings
=
options
.
compiler_directives
)
current_settings
=
options
.
compiler_directives
)
except
ValueError
,
e
:
except
ValueError
as
e
:
sys
.
stderr
.
write
(
"Error in compiler directive: %s
\
n
"
%
e
.
args
[
0
])
sys
.
stderr
.
write
(
"Error in compiler directive: %s
\
n
"
%
e
.
args
[
0
])
sys
.
exit
(
1
)
sys
.
exit
(
1
)
elif
option
.
startswith
(
'--debug'
):
elif
option
.
startswith
(
'--debug'
):
...
...
Cython/Compiler/Code.py
View file @
958593e9
...
@@ -128,7 +128,7 @@ class UtilityCodeBase(object):
...
@@ -128,7 +128,7 @@ class UtilityCodeBase(object):
del tags['substitute']
del tags['substitute']
try:
try:
code = Template(code).substitute(vars(Naming))
code = Template(code).substitute(vars(Naming))
except (KeyError, ValueError)
,
e:
except (KeyError, ValueError)
as
e:
raise RuntimeError("
Error
parsing
templated
utility
code
of
type
'%s'
at
line
%
d
:
%
s
" % (
raise RuntimeError("
Error
parsing
templated
utility
code
of
type
'%s'
at
line
%
d
:
%
s
" % (
type, begin_lineno, e))
type, begin_lineno, e))
...
...
Cython/Compiler/ExprNodes.py
View file @
958593e9
...
@@ -2943,7 +2943,7 @@ class IndexNode(ExprNode):
...
@@ -2943,7 +2943,7 @@ class IndexNode(ExprNode):
index
=
self
.
index
.
compile_time_value
(
denv
)
index
=
self
.
index
.
compile_time_value
(
denv
)
try
:
try
:
return
base
[
index
]
return
base
[
index
]
except
Exception
,
e
:
except
Exception
as
e
:
self
.
compile_time_value_error
(
e
)
self
.
compile_time_value_error
(
e
)
def
is_ephemeral
(
self
):
def
is_ephemeral
(
self
):
...
@@ -4023,7 +4023,7 @@ class SliceIndexNode(ExprNode):
...
@@ -4023,7 +4023,7 @@ class SliceIndexNode(ExprNode):
stop
=
self
.
stop
.
compile_time_value
(
denv
)
stop
=
self
.
stop
.
compile_time_value
(
denv
)
try
:
try
:
return
base
[
start
:
stop
]
return
base
[
start
:
stop
]
except
Exception
,
e
:
except
Exception
as
e
:
self
.
compile_time_value_error
(
e
)
self
.
compile_time_value_error
(
e
)
def
analyse_target_declaration
(
self
,
env
):
def
analyse_target_declaration
(
self
,
env
):
...
@@ -4423,7 +4423,7 @@ class SliceNode(ExprNode):
...
@@ -4423,7 +4423,7 @@ class SliceNode(ExprNode):
step
=
self
.
step
.
compile_time_value
(
denv
)
step
=
self
.
step
.
compile_time_value
(
denv
)
try
:
try
:
return
slice
(
start
,
stop
,
step
)
return
slice
(
start
,
stop
,
step
)
except
Exception
,
e
:
except
Exception
as
e
:
self
.
compile_time_value_error
(
e
)
self
.
compile_time_value_error
(
e
)
def
may_be_none
(
self
):
def
may_be_none
(
self
):
...
@@ -4585,7 +4585,7 @@ class SimpleCallNode(CallNode):
...
@@ -4585,7 +4585,7 @@ class SimpleCallNode(CallNode):
args
=
[
arg
.
compile_time_value
(
denv
)
for
arg
in
self
.
args
]
args
=
[
arg
.
compile_time_value
(
denv
)
for
arg
in
self
.
args
]
try
:
try
:
return
function
(
*
args
)
return
function
(
*
args
)
except
Exception
,
e
:
except
Exception
as
e
:
self
.
compile_time_value_error
(
e
)
self
.
compile_time_value_error
(
e
)
def
analyse_as_type
(
self
,
env
):
def
analyse_as_type
(
self
,
env
):
...
@@ -5324,7 +5324,7 @@ class GeneralCallNode(CallNode):
...
@@ -5324,7 +5324,7 @@ class GeneralCallNode(CallNode):
keyword_args
=
self
.
keyword_args
.
compile_time_value
(
denv
)
keyword_args
=
self
.
keyword_args
.
compile_time_value
(
denv
)
try
:
try
:
return
function
(
*
positional_args
,
**
keyword_args
)
return
function
(
*
positional_args
,
**
keyword_args
)
except
Exception
,
e
:
except
Exception
as
e
:
self
.
compile_time_value_error
(
e
)
self
.
compile_time_value_error
(
e
)
def
explicit_args_kwds
(
self
):
def
explicit_args_kwds
(
self
):
...
@@ -5545,7 +5545,7 @@ class AsTupleNode(ExprNode):
...
@@ -5545,7 +5545,7 @@ class AsTupleNode(ExprNode):
arg
=
self
.
arg
.
compile_time_value
(
denv
)
arg
=
self
.
arg
.
compile_time_value
(
denv
)
try
:
try
:
return
tuple
(
arg
)
return
tuple
(
arg
)
except
Exception
,
e
:
except
Exception
as
e
:
self
.
compile_time_value_error
(
e
)
self
.
compile_time_value_error
(
e
)
def
analyse_types
(
self
,
env
):
def
analyse_types
(
self
,
env
):
...
@@ -5615,7 +5615,7 @@ class MergedDictNode(ExprNode):
...
@@ -5615,7 +5615,7 @@ class MergedDictNode(ExprNode):
if
reject_duplicates
and
key
in
result
:
if
reject_duplicates
and
key
in
result
:
raise
ValueError
(
"duplicate keyword argument found: %s"
%
key
)
raise
ValueError
(
"duplicate keyword argument found: %s"
%
key
)
result
[
key
]
=
value
result
[
key
]
=
value
except
Exception
,
e
:
except
Exception
as
e
:
self
.
compile_time_value_error
(
e
)
self
.
compile_time_value_error
(
e
)
return
result
return
result
...
@@ -5797,7 +5797,7 @@ class AttributeNode(ExprNode):
...
@@ -5797,7 +5797,7 @@ class AttributeNode(ExprNode):
obj
=
self
.
obj
.
compile_time_value
(
denv
)
obj
=
self
.
obj
.
compile_time_value
(
denv
)
try
:
try
:
return
getattr
(
obj
,
attr
)
return
getattr
(
obj
,
attr
)
except
Exception
,
e
:
except
Exception
as
e
:
self
.
compile_time_value_error
(
e
)
self
.
compile_time_value_error
(
e
)
def
type_dependencies
(
self
,
env
):
def
type_dependencies
(
self
,
env
):
...
@@ -6923,7 +6923,7 @@ class TupleNode(SequenceNode):
...
@@ -6923,7 +6923,7 @@ class TupleNode(SequenceNode):
values
=
self
.
compile_time_value_list
(
denv
)
values
=
self
.
compile_time_value_list
(
denv
)
try
:
try
:
return
tuple
(
values
)
return
tuple
(
values
)
except
Exception
,
e
:
except
Exception
as
e
:
self
.
compile_time_value_error
(
e
)
self
.
compile_time_value_error
(
e
)
def
generate_operation_code
(
self
,
code
):
def
generate_operation_code
(
self
,
code
):
...
@@ -7571,7 +7571,7 @@ class SetNode(ExprNode):
...
@@ -7571,7 +7571,7 @@ class SetNode(ExprNode):
values
=
[
arg
.
compile_time_value
(
denv
)
for
arg
in
self
.
args
]
values
=
[
arg
.
compile_time_value
(
denv
)
for
arg
in
self
.
args
]
try
:
try
:
return
set
(
values
)
return
set
(
values
)
except
Exception
,
e
:
except
Exception
as
e
:
self
.
compile_time_value_error
(
e
)
self
.
compile_time_value_error
(
e
)
def
generate_evaluation_code
(
self
,
code
):
def
generate_evaluation_code
(
self
,
code
):
...
@@ -7622,7 +7622,7 @@ class DictNode(ExprNode):
...
@@ -7622,7 +7622,7 @@ class DictNode(ExprNode):
for
item
in
self
.
key_value_pairs
]
for
item
in
self
.
key_value_pairs
]
try
:
try
:
return
dict
(
pairs
)
return
dict
(
pairs
)
except
Exception
,
e
:
except
Exception
as
e
:
self
.
compile_time_value_error
(
e
)
self
.
compile_time_value_error
(
e
)
def
type_dependencies
(
self
,
env
):
def
type_dependencies
(
self
,
env
):
...
@@ -8960,7 +8960,7 @@ class UnopNode(ExprNode):
...
@@ -8960,7 +8960,7 @@ class UnopNode(ExprNode):
operand
=
self
.
operand
.
compile_time_value
(
denv
)
operand
=
self
.
operand
.
compile_time_value
(
denv
)
try
:
try
:
return
func
(
operand
)
return
func
(
operand
)
except
Exception
,
e
:
except
Exception
as
e
:
self
.
compile_time_value_error
(
e
)
self
.
compile_time_value_error
(
e
)
def
infer_type
(
self
,
env
):
def
infer_type
(
self
,
env
):
...
@@ -9057,7 +9057,7 @@ class NotNode(UnopNode):
...
@@ -9057,7 +9057,7 @@ class NotNode(UnopNode):
operand
=
self
.
operand
.
compile_time_value
(
denv
)
operand
=
self
.
operand
.
compile_time_value
(
denv
)
try
:
try
:
return
not
operand
return
not
operand
except
Exception
,
e
:
except
Exception
as
e
:
self
.
compile_time_value_error
(
e
)
self
.
compile_time_value_error
(
e
)
def
infer_unop_type
(
self
,
env
,
operand_type
):
def
infer_unop_type
(
self
,
env
,
operand_type
):
...
@@ -9824,7 +9824,7 @@ class BinopNode(ExprNode):
...
@@ -9824,7 +9824,7 @@ class BinopNode(ExprNode):
operand2
=
self
.
operand2
.
compile_time_value
(
denv
)
operand2
=
self
.
operand2
.
compile_time_value
(
denv
)
try
:
try
:
return
func
(
operand1
,
operand2
)
return
func
(
operand1
,
operand2
)
except
Exception
,
e
:
except
Exception
as
e
:
self
.
compile_time_value_error
(
e
)
self
.
compile_time_value_error
(
e
)
def
infer_type
(
self
,
env
):
def
infer_type
(
self
,
env
):
...
@@ -10249,7 +10249,7 @@ class DivNode(NumBinopNode):
...
@@ -10249,7 +10249,7 @@ class DivNode(NumBinopNode):
func
=
self
.
find_compile_time_binary_operator
(
func
=
self
.
find_compile_time_binary_operator
(
operand1
,
operand2
)
operand1
,
operand2
)
return
func
(
operand1
,
operand2
)
return
func
(
operand1
,
operand2
)
except
Exception
,
e
:
except
Exception
as
e
:
self
.
compile_time_value_error
(
e
)
self
.
compile_time_value_error
(
e
)
def
_check_truedivision
(
self
,
env
):
def
_check_truedivision
(
self
,
env
):
...
@@ -10924,7 +10924,7 @@ class CmpNode(object):
...
@@ -10924,7 +10924,7 @@ class CmpNode(object):
operand2
=
self
.
operand2
.
compile_time_value
(
denv
)
operand2
=
self
.
operand2
.
compile_time_value
(
denv
)
try
:
try
:
result
=
func
(
operand1
,
operand2
)
result
=
func
(
operand1
,
operand2
)
except
Exception
,
e
:
except
Exception
as
e
:
self
.
compile_time_value_error
(
e
)
self
.
compile_time_value_error
(
e
)
result
=
None
result
=
None
if
result
:
if
result
:
...
...
Cython/Compiler/Main.py
View file @
958593e9
...
@@ -354,7 +354,7 @@ class Context(object):
...
@@ -354,7 +354,7 @@ class Context(object):
raise
RuntimeError
(
raise
RuntimeError
(
"Formal grammer can only be used with compiled Cython with an available pgen."
)
"Formal grammer can only be used with compiled Cython with an available pgen."
)
ConcreteSyntaxTree
.
p_module
(
source_filename
)
ConcreteSyntaxTree
.
p_module
(
source_filename
)
except
UnicodeDecodeError
,
e
:
except
UnicodeDecodeError
as
e
:
#import traceback
#import traceback
#traceback.print_exc()
#traceback.print_exc()
raise
self
.
_report_decode_error
(
source_desc
,
e
)
raise
self
.
_report_decode_error
(
source_desc
,
e
)
...
@@ -699,7 +699,7 @@ def main(command_line = 0):
...
@@ -699,7 +699,7 @@ def main(command_line = 0):
result
=
compile
(
sources
,
options
)
result
=
compile
(
sources
,
options
)
if
result
.
num_errors
>
0
:
if
result
.
num_errors
>
0
:
any_failures
=
1
any_failures
=
1
except
(
EnvironmentError
,
PyrexError
)
,
e
:
except
(
EnvironmentError
,
PyrexError
)
as
e
:
sys
.
stderr
.
write
(
str
(
e
)
+
'
\
n
'
)
sys
.
stderr
.
write
(
str
(
e
)
+
'
\
n
'
)
any_failures
=
1
any_failures
=
1
if
any_failures
:
if
any_failures
:
...
...
Cython/Compiler/ModuleNode.py
View file @
958593e9
...
@@ -397,7 +397,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
...
@@ -397,7 +397,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
if
target_file_dir
!=
target_dir
and
not
os
.
path
.
exists
(
target_file_dir
):
if
target_file_dir
!=
target_dir
and
not
os
.
path
.
exists
(
target_file_dir
):
try
:
try
:
os
.
makedirs
(
target_file_dir
)
os
.
makedirs
(
target_file_dir
)
except
OSError
,
e
:
except
OSError
as
e
:
import
errno
import
errno
if
e
.
errno
!=
errno
.
EEXIST
:
if
e
.
errno
!=
errno
.
EEXIST
:
raise
raise
...
...
Cython/Compiler/Nodes.py
View file @
958593e9
...
@@ -1037,7 +1037,7 @@ class MemoryViewSliceTypeNode(CBaseTypeNode):
...
@@ -1037,7 +1037,7 @@ class MemoryViewSliceTypeNode(CBaseTypeNode):
try
:
try
:
axes_specs
=
MemoryView
.
get_axes_specs
(
env
,
self
.
axes
)
axes_specs
=
MemoryView
.
get_axes_specs
(
env
,
self
.
axes
)
except
CompileError
,
e
:
except
CompileError
as
e
:
error
(
e
.
position
,
e
.
message_only
)
error
(
e
.
position
,
e
.
message_only
)
self
.
type
=
PyrexTypes
.
ErrorType
()
self
.
type
=
PyrexTypes
.
ErrorType
()
return
self
.
type
return
self
.
type
...
@@ -7657,7 +7657,7 @@ class ParallelStatNode(StatNode, ParallelNode):
...
@@ -7657,7 +7657,7 @@ class ParallelStatNode(StatNode, ParallelNode):
try
:
try
:
self
.
kwargs
=
self
.
kwargs
.
compile_time_value
(
env
)
self
.
kwargs
=
self
.
kwargs
.
compile_time_value
(
env
)
except
Exception
,
e
:
except
Exception
as
e
:
error
(
self
.
kwargs
.
pos
,
"Only compile-time values may be "
error
(
self
.
kwargs
.
pos
,
"Only compile-time values may be "
"supplied as keyword arguments"
)
"supplied as keyword arguments"
)
else
:
else
:
...
...
Cython/Compiler/ParseTreeTransforms.py
View file @
958593e9
...
@@ -255,7 +255,7 @@ class PostParse(ScopeTrackingTransform):
...
@@ -255,7 +255,7 @@ class PostParse(ScopeTrackingTransform):
newdecls
.
append
(
decl
)
newdecls
.
append
(
decl
)
node
.
declarators
=
newdecls
node
.
declarators
=
newdecls
return
stats
return
stats
except
PostParseError
,
e
:
except
PostParseError
as
e
:
# An error in a cdef clause is ok, simply remove the declaration
# An error in a cdef clause is ok, simply remove the declaration
# and try to move on to report more errors
# and try to move on to report more errors
self
.
context
.
nonfatal_error
(
e
)
self
.
context
.
nonfatal_error
(
e
)
...
...
Cython/Compiler/Parsing.py
View file @
958593e9
...
@@ -3329,7 +3329,7 @@ def p_compiler_directive_comments(s):
...
@@ -3329,7 +3329,7 @@ def p_compiler_directive_comments(s):
try
:
try
:
result
.
update
(
Options
.
parse_directive_list
(
result
.
update
(
Options
.
parse_directive_list
(
directives
,
ignore_unknown
=
True
))
directives
,
ignore_unknown
=
True
))
except
ValueError
,
e
:
except
ValueError
as
e
:
s
.
error
(
e
.
args
[
0
],
fatal
=
False
)
s
.
error
(
e
.
args
[
0
],
fatal
=
False
)
s
.
next
()
s
.
next
()
return
result
return
result
...
...
Cython/Compiler/Pipeline.py
View file @
958593e9
...
@@ -327,15 +327,15 @@ def run_pipeline(pipeline, source, printtree=True):
...
@@ -327,15 +327,15 @@ def run_pipeline(pipeline, source, printtree=True):
data
=
phase
(
data
)
data
=
phase
(
data
)
if
DebugFlags
.
debug_verbose_pipeline
:
if
DebugFlags
.
debug_verbose_pipeline
:
print
" %.3f seconds"
%
(
time
()
-
t
)
print
" %.3f seconds"
%
(
time
()
-
t
)
except
CompileError
,
err
:
except
CompileError
as
err
:
# err is set
# err is set
Errors
.
report_error
(
err
)
Errors
.
report_error
(
err
)
error
=
err
error
=
err
except
InternalError
,
err
:
except
InternalError
as
err
:
# Only raise if there was not an earlier error
# Only raise if there was not an earlier error
if
Errors
.
num_errors
==
0
:
if
Errors
.
num_errors
==
0
:
raise
raise
error
=
err
error
=
err
except
AbortError
,
err
:
except
AbortError
as
err
:
error
=
err
error
=
err
return
(
error
,
data
)
return
(
error
,
data
)
Cython/Compiler/Symtab.py
View file @
958593e9
...
@@ -490,7 +490,7 @@ class Scope(object):
...
@@ -490,7 +490,7 @@ class Scope(object):
try
:
try
:
type
=
PyrexTypes
.
create_typedef_type
(
name
,
base_type
,
cname
,
type
=
PyrexTypes
.
create_typedef_type
(
name
,
base_type
,
cname
,
(
visibility
==
'extern'
))
(
visibility
==
'extern'
))
except
ValueError
,
e
:
except
ValueError
as
e
:
error
(
pos
,
e
.
args
[
0
])
error
(
pos
,
e
.
args
[
0
])
type
=
PyrexTypes
.
error_type
type
=
PyrexTypes
.
error_type
entry
=
self
.
declare_type
(
name
,
type
,
pos
,
cname
,
entry
=
self
.
declare_type
(
name
,
type
,
pos
,
cname
,
...
...
Cython/Compiler/Visitor.py
View file @
958593e9
...
@@ -176,7 +176,7 @@ class TreeVisitor(object):
...
@@ -176,7 +176,7 @@ class TreeVisitor(object):
raise
raise
except
Errors
.
AbortError
:
except
Errors
.
AbortError
:
raise
raise
except
Exception
,
e
:
except
Exception
as
e
:
if
DebugFlags
.
debug_no_exception_intercept
:
if
DebugFlags
.
debug_no_exception_intercept
:
raise
raise
self
.
_raise_compiler_error
(
obj
,
e
)
self
.
_raise_compiler_error
(
obj
,
e
)
...
...
Cython/Debugger/DebugWriter.py
View file @
958593e9
...
@@ -61,7 +61,7 @@ class CythonDebugWriter(object):
...
@@ -61,7 +61,7 @@ class CythonDebugWriter(object):
try
:
try
:
os
.
makedirs
(
self
.
output_dir
)
os
.
makedirs
(
self
.
output_dir
)
except
OSError
,
e
:
except
OSError
as
e
:
if
e
.
errno
!=
errno
.
EEXIST
:
if
e
.
errno
!=
errno
.
EEXIST
:
raise
raise
...
...
Cython/Debugger/Tests/test_libcython_in_gdb.py
View file @
958593e9
...
@@ -36,7 +36,7 @@ def print_on_call_decorator(func):
...
@@ -36,7 +36,7 @@ def print_on_call_decorator(func):
try
:
try
:
return
func
(
self
,
*
args
,
**
kwargs
)
return
func
(
self
,
*
args
,
**
kwargs
)
except
Exception
,
e
:
except
Exception
as
e
:
_debug
(
"An exception occurred:"
,
traceback
.
format_exc
(
e
))
_debug
(
"An exception occurred:"
,
traceback
.
format_exc
(
e
))
raise
raise
...
...
Cython/Debugger/Tests/test_libpython_in_gdb.py
View file @
958593e9
...
@@ -14,8 +14,8 @@ import gdb
...
@@ -14,8 +14,8 @@ import gdb
from
Cython.Debugger
import
libcython
from
Cython.Debugger
import
libcython
from
Cython.Debugger
import
libpython
from
Cython.Debugger
import
libpython
import
test_libcython_in_gdb
from
.
import
test_libcython_in_gdb
from
test_libcython_in_gdb
import
_debug
,
inferior_python_version
from
.
test_libcython_in_gdb
import
_debug
,
inferior_python_version
class
TestPrettyPrinters
(
test_libcython_in_gdb
.
DebugTestCase
):
class
TestPrettyPrinters
(
test_libcython_in_gdb
.
DebugTestCase
):
...
...
Cython/Plex/Lexicons.py
View file @
958593e9
...
@@ -180,7 +180,7 @@ class Lexicon(object):
...
@@ -180,7 +180,7 @@ class Lexicon(object):
re
.
build_machine
(
machine
,
initial_state
,
final_state
,
re
.
build_machine
(
machine
,
initial_state
,
final_state
,
match_bol
=
1
,
nocase
=
0
)
match_bol
=
1
,
nocase
=
0
)
final_state
.
set_action
(
action
,
priority
=-
token_number
)
final_state
.
set_action
(
action
,
priority
=-
token_number
)
except
Errors
.
PlexError
,
e
:
except
Errors
.
PlexError
as
e
:
raise
e
.
__class__
(
"Token number %d: %s"
%
(
token_number
,
e
))
raise
e
.
__class__
(
"Token number %d: %s"
%
(
token_number
,
e
))
def
parse_token_definition
(
self
,
token_spec
):
def
parse_token_definition
(
self
,
token_spec
):
...
...
Cython/Tempita/__init__.py
View file @
958593e9
# The original Tempita implements all of its templating code here.
# The original Tempita implements all of its templating code here.
# Moved it to _tempita.py to make the compilation portable.
# Moved it to _tempita.py to make the compilation portable.
from
_tempita
import
*
from
.
_tempita
import
*
Cython/Tempita/_tempita.py
View file @
958593e9
...
@@ -298,7 +298,7 @@ class Template(object):
...
@@ -298,7 +298,7 @@ class Template(object):
try:
try:
try:
try:
value = eval(code, self.default_namespace, ns)
value = eval(code, self.default_namespace, ns)
except SyntaxError
,
e:
except SyntaxError
as
e:
raise SyntaxError(
raise SyntaxError(
'
invalid
syntax
in
expression
:
%
s
' % code)
'
invalid
syntax
in
expression
:
%
s
' % code)
return value
return value
...
@@ -315,7 +315,7 @@ class Template(object):
...
@@ -315,7 +315,7 @@ class Template(object):
def _exec(self, code, ns, pos):
def _exec(self, code, ns, pos):
__traceback_hide__ = True
__traceback_hide__ = True
try:
try:
exec
code in self.default_namespace, ns
exec
(code, self.default_namespace, ns)
except:
except:
exc_info = sys.exc_info()
exc_info = sys.exc_info()
e = exc_info[1]
e = exc_info[1]
...
@@ -354,7 +354,7 @@ class Template(object):
...
@@ -354,7 +354,7 @@ class Template(object):
'
(
no
default_encoding
provided
)
' % value)
'
(
no
default_encoding
provided
)
' % value)
try:
try:
value = value.decode(self.default_encoding)
value = value.decode(self.default_encoding)
except UnicodeDecodeError
,
e:
except UnicodeDecodeError
as
e:
raise UnicodeDecodeError(
raise UnicodeDecodeError(
e.encoding,
e.encoding,
e.object,
e.object,
...
...
Cython/TestUtils.py
View file @
958593e9
...
@@ -101,7 +101,7 @@ class CythonTest(unittest.TestCase):
...
@@ -101,7 +101,7 @@ class CythonTest(unittest.TestCase):
try
:
try
:
func
()
func
()
self
.
fail
(
"Expected an exception of type %r"
%
exc_type
)
self
.
fail
(
"Expected an exception of type %r"
%
exc_type
)
except
exc_type
,
e
:
except
exc_type
as
e
:
self
.
assert_
(
isinstance
(
e
,
exc_type
))
self
.
assert_
(
isinstance
(
e
,
exc_type
))
return
e
return
e
...
...
Tools/site_scons/site_tools/pyext.py
View file @
958593e9
...
@@ -164,7 +164,7 @@ def _set_configuration_nodistutils(env):
...
@@ -164,7 +164,7 @@ def _set_configuration_nodistutils(env):
env
.
AppendUnique
(
PYEXTLINKFLAGS
=
env
[
'PYEXT_ALLOW_UNDEFINED'
])
env
.
AppendUnique
(
PYEXTLINKFLAGS
=
env
[
'PYEXT_ALLOW_UNDEFINED'
])
def
ifnotset
(
env
,
name
,
value
):
def
ifnotset
(
env
,
name
,
value
):
if
n
ot
env
.
has_key
(
name
)
:
if
n
ame
not
in
env
:
env
[
name
]
=
value
env
[
name
]
=
value
def
set_configuration
(
env
,
use_distutils
):
def
set_configuration
(
env
,
use_distutils
):
...
@@ -205,7 +205,7 @@ def generate(env):
...
@@ -205,7 +205,7 @@ def generate(env):
"""Add Builders and construction variables for python extensions to an
"""Add Builders and construction variables for python extensions to an
Environment."""
Environment."""
if
not
env
.
has_key
(
'PYEXT_USE_DISTUTILS'
)
:
if
'PYEXT_USE_DISTUTILS'
not
in
env
:
env
[
'PYEXT_USE_DISTUTILS'
]
=
False
env
[
'PYEXT_USE_DISTUTILS'
]
=
False
# This sets all constructions variables used for pyext builders.
# This sets all constructions variables used for pyext builders.
...
...
pyximport/__init__.py
View file @
958593e9
from
pyximport
import
*
from
.
pyximport
import
*
# replicate docstring
# replicate docstring
from
pyximport
import
__doc__
from
.
pyximport
import
__doc__
pyximport/pyxbuild.py
View file @
958593e9
...
@@ -153,5 +153,5 @@ def pyx_to_dll(filename, ext = None, force_rebuild = 0,
...
@@ -153,5 +153,5 @@ def pyx_to_dll(filename, ext = None, force_rebuild = 0,
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
pyx_to_dll
(
"dummy.pyx"
)
pyx_to_dll
(
"dummy.pyx"
)
import
test
from
.
import
test
pyximport/pyximport.py
View file @
958593e9
...
@@ -177,7 +177,7 @@ def build_module(name, pyxfilename, pyxbuild_dir=None, inplace=False, language_l
...
@@ -177,7 +177,7 @@ def build_module(name, pyxfilename, pyxbuild_dir=None, inplace=False, language_l
sargs
.
update
(
setup_args
)
sargs
.
update
(
setup_args
)
build_in_temp
=
sargs
.
pop
(
'build_in_temp'
,
build_in_temp
)
build_in_temp
=
sargs
.
pop
(
'build_in_temp'
,
build_in_temp
)
import
pyxbuild
from
.
import
pyxbuild
so_path
=
pyxbuild
.
pyx_to_dll
(
pyxfilename
,
extension_mod
,
so_path
=
pyxbuild
.
pyx_to_dll
(
pyxfilename
,
extension_mod
,
build_in_temp
=
build_in_temp
,
build_in_temp
=
build_in_temp
,
pyxbuild_dir
=
pyxbuild_dir
,
pyxbuild_dir
=
pyxbuild_dir
,
...
...
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