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
22b7ce25
Commit
22b7ce25
authored
Nov 10, 2012
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make the parser correctly understand obj[1,] as passing a tuple as key
parent
c6c3388c
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
6 deletions
+10
-6
CHANGES.rst
CHANGES.rst
+2
-0
Cython/Compiler/Parsing.pxd
Cython/Compiler/Parsing.pxd
+1
-1
Cython/Compiler/Parsing.py
Cython/Compiler/Parsing.py
+7
-5
No files found.
CHANGES.rst
View file @
22b7ce25
...
@@ -13,6 +13,8 @@ Features added
...
@@ -13,6 +13,8 @@ Features added
Bugs fixed
Bugs fixed
----------
----------
* "obj[1,]" passed a single integer into the item getter instead of a tuple.
* Cyclic imports at module init time did not work in Py3.
* Cyclic imports at module init time did not work in Py3.
* The names of C++ destructors for template classes were built incorrectly.
* The names of C++ destructors for template classes were built incorrectly.
...
...
Cython/Compiler/Parsing.pxd
View file @
22b7ce25
...
@@ -49,7 +49,7 @@ cpdef p_call_parse_args(PyrexScanner s, bint allow_genexp = *)
...
@@ -49,7 +49,7 @@ cpdef p_call_parse_args(PyrexScanner s, bint allow_genexp = *)
cdef
p_call_build_packed_args
(
pos
,
positional_args
,
keyword_args
,
star_arg
,
starstar_arg
)
cdef
p_call_build_packed_args
(
pos
,
positional_args
,
keyword_args
,
star_arg
,
starstar_arg
)
cdef
p_call
(
PyrexScanner
s
,
function
)
cdef
p_call
(
PyrexScanner
s
,
function
)
cdef
p_index
(
PyrexScanner
s
,
base
)
cdef
p_index
(
PyrexScanner
s
,
base
)
cdef
p_subscript_list
(
PyrexScanner
s
)
cdef
tuple
p_subscript_list
(
PyrexScanner
s
)
cdef
p_subscript
(
PyrexScanner
s
)
cdef
p_subscript
(
PyrexScanner
s
)
cdef
p_slice_element
(
PyrexScanner
s
,
follow_set
)
cdef
p_slice_element
(
PyrexScanner
s
,
follow_set
)
cdef
expect_ellipsis
(
PyrexScanner
s
)
cdef
expect_ellipsis
(
PyrexScanner
s
)
...
...
Cython/Compiler/Parsing.py
View file @
22b7ce25
...
@@ -503,14 +503,14 @@ def p_index(s, base):
...
@@ -503,14 +503,14 @@ def p_index(s, base):
# s.sy == '['
# s.sy == '['
pos
=
s
.
position
()
pos
=
s
.
position
()
s
.
next
()
s
.
next
()
subscripts
=
p_subscript_list
(
s
)
subscripts
,
is_single_value
=
p_subscript_list
(
s
)
if
len
(
subscripts
)
==
1
and
len
(
subscripts
[
0
])
==
2
:
if
is_single_value
and
len
(
subscripts
[
0
])
==
2
:
start
,
stop
=
subscripts
[
0
]
start
,
stop
=
subscripts
[
0
]
result
=
ExprNodes
.
SliceIndexNode
(
pos
,
result
=
ExprNodes
.
SliceIndexNode
(
pos
,
base
=
base
,
start
=
start
,
stop
=
stop
)
base
=
base
,
start
=
start
,
stop
=
stop
)
else
:
else
:
indexes
=
make_slice_nodes
(
pos
,
subscripts
)
indexes
=
make_slice_nodes
(
pos
,
subscripts
)
if
len
(
indexes
)
==
1
:
if
is_single_value
:
index
=
indexes
[
0
]
index
=
indexes
[
0
]
else
:
else
:
index
=
ExprNodes
.
TupleNode
(
pos
,
args
=
indexes
)
index
=
ExprNodes
.
TupleNode
(
pos
,
args
=
indexes
)
...
@@ -520,13 +520,15 @@ def p_index(s, base):
...
@@ -520,13 +520,15 @@ def p_index(s, base):
return
result
return
result
def
p_subscript_list
(
s
):
def
p_subscript_list
(
s
):
is_single_value
=
True
items
=
[
p_subscript
(
s
)]
items
=
[
p_subscript
(
s
)]
while
s
.
sy
==
','
:
while
s
.
sy
==
','
:
is_single_value
=
False
s
.
next
()
s
.
next
()
if
s
.
sy
==
']'
:
if
s
.
sy
==
']'
:
break
break
items
.
append
(
p_subscript
(
s
))
items
.
append
(
p_subscript
(
s
))
return
items
return
items
,
is_single_value
#subscript: '.' '.' '.' | test | [test] ':' [test] [':' [test]]
#subscript: '.' '.' '.' | test | [test] ':' [test] [':' [test]]
...
@@ -2117,7 +2119,7 @@ def p_memoryviewslice_access(s, base_type_node):
...
@@ -2117,7 +2119,7 @@ def p_memoryviewslice_access(s, base_type_node):
# s.sy == '['
# s.sy == '['
pos
=
s
.
position
()
pos
=
s
.
position
()
s
.
next
()
s
.
next
()
subscripts
=
p_subscript_list
(
s
)
subscripts
,
_
=
p_subscript_list
(
s
)
# make sure each entry in subscripts is a slice
# make sure each entry in subscripts is a slice
for
subscript
in
subscripts
:
for
subscript
in
subscripts
:
if
len
(
subscript
)
<
2
:
if
len
(
subscript
)
<
2
:
...
...
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