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
9498ab65
Commit
9498ab65
authored
Jul 25, 2015
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
replace xrange() by range() to make it work in Py2/Py3
parent
9c7d4b13
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
20 additions
and
24 deletions
+20
-24
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+6
-6
Cython/Compiler/MemoryView.py
Cython/Compiler/MemoryView.py
+1
-1
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+2
-2
Cython/Compiler/ParseTreeTransforms.py
Cython/Compiler/ParseTreeTransforms.py
+3
-3
Cython/Compiler/Parsing.py
Cython/Compiler/Parsing.py
+2
-2
Cython/Compiler/TypeSlots.py
Cython/Compiler/TypeSlots.py
+1
-1
Cython/Debugger/libpython.py
Cython/Debugger/libpython.py
+1
-1
Cython/Plex/Regexps.py
Cython/Plex/Regexps.py
+3
-7
Cython/Plex/Traditional.py
Cython/Plex/Traditional.py
+1
-1
No files found.
Cython/Compiler/ExprNodes.py
View file @
9498ab65
...
...
@@ -4769,7 +4769,7 @@ class SimpleCallNode(CallNode):
# Coerce arguments
some_args_in_temps
=
False
for
i
in
x
range
(
min
(
max_nargs
,
actual_nargs
)):
for
i
in
range
(
min
(
max_nargs
,
actual_nargs
)):
formal_arg
=
func_type
.
args
[
i
]
formal_type
=
formal_arg
.
type
arg
=
args
[
i
].
coerce_to
(
formal_type
,
env
)
...
...
@@ -4799,7 +4799,7 @@ class SimpleCallNode(CallNode):
args
[
i
]
=
arg
# handle additional varargs parameters
for
i
in
x
range
(
max_nargs
,
actual_nargs
):
for
i
in
range
(
max_nargs
,
actual_nargs
):
arg
=
args
[
i
]
if
arg
.
type
.
is_pyobject
:
arg_ctype
=
arg
.
type
.
default_coerced_ctype
()
...
...
@@ -4817,7 +4817,7 @@ class SimpleCallNode(CallNode):
# sure they are either all temps or all not temps (except
# for the last argument, which is evaluated last in any
# case)
for
i
in
x
range
(
actual_nargs
-
1
):
for
i
in
range
(
actual_nargs
-
1
):
if
i
==
0
and
self
.
self
is
not
None
:
continue
# self is ok
arg
=
args
[
i
]
...
...
@@ -5207,7 +5207,7 @@ class InlinedDefNodeCallNode(CallNode):
# Coerce arguments
some_args_in_temps
=
False
for
i
in
x
range
(
actual_nargs
):
for
i
in
range
(
actual_nargs
):
formal_type
=
func_type
.
args
[
i
].
type
arg
=
self
.
args
[
i
].
coerce_to
(
formal_type
,
env
)
if
arg
.
is_temp
:
...
...
@@ -5234,7 +5234,7 @@ class InlinedDefNodeCallNode(CallNode):
# sure they are either all temps or all not temps (except
# for the last argument, which is evaluated last in any
# case)
for
i
in
x
range
(
actual_nargs
-
1
):
for
i
in
range
(
actual_nargs
-
1
):
arg
=
self
.
args
[
i
]
if
arg
.
nonlocally_immutable
():
# locals, C functions, unassignable types are safe.
...
...
@@ -6503,7 +6503,7 @@ class SequenceNode(ExprNode):
else
:
offset
=
''
for
i
in
x
range
(
arg_count
):
for
i
in
range
(
arg_count
):
arg
=
self
.
args
[
i
]
if
c_mult
or
not
arg
.
result_in_temp
():
code
.
put_incref
(
arg
.
result
(),
arg
.
ctype
())
...
...
Cython/Compiler/MemoryView.py
View file @
9498ab65
...
...
@@ -790,7 +790,7 @@ def validate_axes_specs(positions, specs, is_c_contig, is_f_contig):
if
access
==
'ptr'
:
last_indirect_dimension
=
idx
for
idx
,
pos
,
(
access
,
packing
)
in
zip
(
x
range
(
len
(
specs
)),
positions
,
specs
):
for
idx
,
pos
,
(
access
,
packing
)
in
zip
(
range
(
len
(
specs
)),
positions
,
specs
):
if
not
(
access
in
access_specs
and
packing
in
packing_specs
):
...
...
Cython/Compiler/Nodes.py
View file @
9498ab65
...
...
@@ -6684,7 +6684,7 @@ class TryExceptStatNode(StatNode):
try_end_label
=
code
.
new_label
(
'try_end'
)
exc_save_vars
=
[
code
.
funcstate
.
allocate_temp
(
py_object_type
,
False
)
for
_
in
x
range
(
3
)]
for
_
in
range
(
3
)]
code
.
mark_pos
(
self
.
pos
)
code
.
putln
(
"{"
)
save_exc
=
code
.
insertion_point
()
...
...
@@ -6869,7 +6869,7 @@ class ExceptClauseNode(Node):
exc_vars
=
[
code
.
funcstate
.
allocate_temp
(
py_object_type
,
manage_ref
=
True
)
for
_
in
x
range
(
3
)]
for
_
in
range
(
3
)]
code
.
put_add_traceback
(
self
.
function_name
)
# We always have to fetch the exception value even if
# there is no target, because this also normalises the
...
...
Cython/Compiler/ParseTreeTransforms.py
View file @
9498ab65
...
...
@@ -420,11 +420,11 @@ def sort_common_subsequences(items):
for
pos
,
item
in
enumerate
(
items
):
key
=
item
[
1
]
# the ResultRefNode which has already been injected into the sequences
new_pos
=
pos
for
i
in
x
range
(
pos
-
1
,
-
1
,
-
1
):
for
i
in
range
(
pos
-
1
,
-
1
,
-
1
):
if
lower_than
(
key
,
items
[
i
][
0
]):
new_pos
=
i
if
new_pos
!=
pos
:
for
i
in
x
range
(
pos
,
new_pos
,
-
1
):
for
i
in
range
(
pos
,
new_pos
,
-
1
):
items
[
i
]
=
items
[
i
-
1
]
items
[
new_pos
]
=
item
...
...
@@ -460,7 +460,7 @@ def flatten_parallel_assignments(input, output):
rhs_args
=
unpack_string_to_character_literals
(
rhs
)
rhs_size
=
len
(
rhs_args
)
lhs_targets
=
[
[]
for
_
in
xrange
(
rhs_size
)
]
lhs_targets
=
[
[]
for
_
in
range
(
rhs_size
)
]
starred_assignments
=
[]
for
lhs
in
input
[:
-
1
]:
if
not
lhs
.
is_sequence_constructor
:
...
...
Cython/Compiler/Parsing.py
View file @
9498ab65
...
...
@@ -3450,7 +3450,7 @@ def print_parse_tree(f, node, level, key = None):
t
=
type
(
node
)
if
t
is
tuple
:
f
.
write
(
"(%s @ %s
\
n
"
%
(
node
[
0
],
node
[
1
]))
for
i
in
x
range
(
2
,
len
(
node
)):
for
i
in
range
(
2
,
len
(
node
)):
print_parse_tree
(
f
,
node
[
i
],
level
+
1
)
f
.
write
(
"%s)
\
n
"
%
ind
)
return
...
...
@@ -3466,7 +3466,7 @@ def print_parse_tree(f, node, level, key = None):
return
elif
t
is
list
:
f
.
write
(
"[
\
n
"
)
for
i
in
x
range
(
len
(
node
)):
for
i
in
range
(
len
(
node
)):
print_parse_tree
(
f
,
node
[
i
],
level
+
1
)
f
.
write
(
"%s]
\
n
"
%
ind
)
return
...
...
Cython/Compiler/TypeSlots.py
View file @
9498ab65
...
...
@@ -127,7 +127,7 @@ class Signature(object):
def
function_type
(
self
,
self_arg_override
=
None
):
# Construct a C function type descriptor for this signature
args
=
[]
for
i
in
x
range
(
self
.
num_fixed_args
()):
for
i
in
range
(
self
.
num_fixed_args
()):
if
self_arg_override
is
not
None
and
self
.
is_self_arg
(
i
):
assert
isinstance
(
self_arg_override
,
PyrexTypes
.
CFuncTypeArg
)
args
.
append
(
self_arg_override
)
...
...
Cython/Debugger/libpython.py
View file @
9498ab65
...
...
@@ -118,7 +118,7 @@ def safety_limit(val):
def
safe_range
(
val
):
# As per range, but don't trust the value too much: cap it to a safety
# threshold in case the data was corrupted
return
x
range
(
safety_limit
(
val
))
return
range
(
safety_limit
(
val
))
def
write_unicode
(
file
,
text
):
...
...
Cython/Plex/Regexps.py
View file @
9498ab65
...
...
@@ -87,9 +87,7 @@ def CodeRanges(code_list):
Given a list of codes as returned by chars_to_ranges, return
an RE which will match a character in any of the ranges.
"""
re_list
=
[]
for
i
in
xrange
(
0
,
len
(
code_list
),
2
):
re_list
.
append
(
CodeRange
(
code_list
[
i
],
code_list
[
i
+
1
]))
re_list
=
[
CodeRange
(
code_list
[
i
],
code_list
[
i
+
1
])
for
i
in
range
(
0
,
len
(
code_list
),
2
)]
return
Alt
(
*
re_list
)
...
...
@@ -307,8 +305,7 @@ class Seq(RE):
def
__init__
(
self
,
*
re_list
):
nullable
=
1
for
i
in
xrange
(
len
(
re_list
)):
re
=
re_list
[
i
]
for
i
,
re
in
enumerate
(
re_list
):
self
.
check_re
(
i
,
re
)
nullable
=
nullable
and
re
.
nullable
self
.
re_list
=
re_list
...
...
@@ -332,12 +329,11 @@ class Seq(RE):
else
:
s1
=
initial_state
n
=
len
(
re_list
)
for
i
in
xrange
(
n
):
for
i
,
re
in
enumerate
(
re_list
):
if
i
<
n
-
1
:
s2
=
m
.
new_state
()
else
:
s2
=
final_state
re
=
re_list
[
i
]
re
.
build_machine
(
m
,
s1
,
s2
,
match_bol
,
nocase
)
s1
=
s2
match_bol
=
re
.
match_nl
or
(
match_bol
and
re
.
nullable
)
...
...
Cython/Plex/Traditional.py
View file @
9498ab65
...
...
@@ -104,7 +104,7 @@ class REParser(object):
if
self
.
c
==
'-'
and
self
.
lookahead
(
1
)
!=
']'
:
self
.
next
()
c2
=
self
.
get
()
for
a
in
x
range
(
ord
(
c1
),
ord
(
c2
)
+
1
):
for
a
in
range
(
ord
(
c1
),
ord
(
c2
)
+
1
):
char_list
.
append
(
chr
(
a
))
else
:
char_list
.
append
(
c1
)
...
...
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