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
1a83f191
Commit
1a83f191
authored
Aug 28, 2018
by
cjgibson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improving slicing logic flow following initial feedback.
parent
904ca6e4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
18 deletions
+39
-18
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+39
-18
No files found.
Cython/Compiler/ExprNodes.py
View file @
1a83f191
...
@@ -4748,30 +4748,50 @@ class SliceIndexNode(ExprNode):
...
@@ -4748,30 +4748,50 @@ class SliceIndexNode(ExprNode):
env
,
getting
=
getting
,
setting
=
not
getting
,
env
,
getting
=
getting
,
setting
=
not
getting
,
analyse_base
=
False
)
analyse_base
=
False
)
from
.UtilNodes
import
ResultRefNode
if
self
.
start
:
if
self
.
start
:
self
.
start
=
CondExprNode
(
self
.
start
.
analyse_types
(
env
)
self
.
start
.
pos
,
if
self
.
start
.
type
.
is_pyobject
:
true_val
=
IntNode
(
self
.
start
.
pos
,
value
=
'0'
),
start_ref
=
ResultRefNode
(
self
.
start
)
false_val
=
self
.
start
,
self
.
start
=
CondExprNode
(
test
=
PrimaryCmpNode
(
self
.
start
.
pos
,
self
.
start
.
pos
,
operand1
=
self
.
start
,
true_val
=
IntNode
(
operator
=
'is'
,
self
.
start
.
pos
,
operand2
=
NoneNode
(
self
.
start
.
pos
),
value
=
'0'
,
constant_result
=
0
),
false_val
=
start_ref
,
test
=
PrimaryCmpNode
(
self
.
start
.
pos
,
operand1
=
start_ref
,
operator
=
'is'
,
operand2
=
NoneNode
(
self
.
start
.
pos
),
)
)
)
).
analyse_types
(
env
)
self
.
start
.
coerce_to
(
PyrexTypes
.
c_py_ssize_t_type
,
env
)
self
.
start
.
analyse_types
(
env
)
if
self
.
stop
:
if
self
.
stop
:
self
.
stop
=
CondExprNode
(
self
.
stop
.
analyse_types
(
env
)
self
.
stop
.
pos
,
if
self
.
stop
.
type
.
is_pyobject
:
true_val
=
IntNode
(
self
.
stop
.
pos
,
value
=
'PY_SSIZE_T_MAX'
),
stop_ref
=
ResultRefNode
(
self
.
stop
)
false_val
=
self
.
stop
,
self
.
stop
=
CondExprNode
(
test
=
PrimaryCmpNode
(
self
.
stop
.
pos
,
self
.
stop
.
pos
,
operand1
=
self
.
stop
,
true_val
=
IntNode
(
operator
=
'is'
,
self
.
stop
.
pos
,
operand2
=
NoneNode
(
self
.
stop
.
pos
),
value
=
'PY_SSIZE_T_MAX'
,
# See: github.com/python/cpython/blob/2.7/Python/sysmodule.c#L1446
constant_result
=
sys
.
maxsize
),
false_val
=
stop_ref
,
test
=
PrimaryCmpNode
(
self
.
stop
.
pos
,
operand1
=
stop_ref
,
operator
=
'is'
,
operand2
=
NoneNode
(
self
.
stop
.
pos
),
)
)
)
).
analyse_types
(
env
)
self
.
stop
.
coerce_to
(
PyrexTypes
.
c_py_ssize_t_type
,
env
)
self
.
stop
.
analyse_types
(
env
)
if
not
env
.
directives
[
'wraparound'
]:
if
not
env
.
directives
[
'wraparound'
]:
check_negative_indices
(
self
.
start
,
self
.
stop
)
check_negative_indices
(
self
.
start
,
self
.
stop
)
...
@@ -4814,6 +4834,7 @@ class SliceIndexNode(ExprNode):
...
@@ -4814,6 +4834,7 @@ class SliceIndexNode(ExprNode):
step
=
none_node
step
=
none_node
).
analyse_types
(
env
)
).
analyse_types
(
env
)
else
:
else
:
# TODO: is this logic needed?
c_int
=
PyrexTypes
.
c_py_ssize_t_type
c_int
=
PyrexTypes
.
c_py_ssize_t_type
if
self
.
start
:
if
self
.
start
:
self
.
start
=
self
.
start
.
coerce_to
(
c_int
,
env
)
self
.
start
=
self
.
start
.
coerce_to
(
c_int
,
env
)
...
...
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