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
Kirill Smelkov
cython
Commits
5c900c59
Commit
5c900c59
authored
Jun 28, 2022
by
da-woods
Committed by
GitHub
Jun 28, 2022
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix tuple multiplication in MergedSequenceNode (GH-4864)
Fixes
https://github.com/cython/cython/issues/4861
parent
530e370f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
1 deletion
+19
-1
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+1
-1
tests/run/pep448_extended_unpacking.pyx
tests/run/pep448_extended_unpacking.pyx
+18
-0
No files found.
Cython/Compiler/ExprNodes.py
View file @
5c900c59
...
...
@@ -8482,7 +8482,7 @@ class MergedSequenceNode(ExprNode):
if
type
in
(
list_type
,
tuple_type
)
and
args
and
args
[
0
].
is_sequence_constructor
:
# construct a list directly from the first argument that we can then extend
if
args
[
0
].
type
is
not
list_type
:
args
[
0
]
=
ListNode
(
args
[
0
].
pos
,
args
=
args
[
0
].
args
,
is_temp
=
True
)
args
[
0
]
=
ListNode
(
args
[
0
].
pos
,
args
=
args
[
0
].
args
,
is_temp
=
True
,
mult_factor
=
args
[
0
].
mult_factor
)
ExprNode
.
__init__
(
self
,
pos
,
args
=
args
,
type
=
type
)
def
calculate_constant_result
(
self
):
...
...
tests/run/pep448_extended_unpacking.pyx
View file @
5c900c59
...
...
@@ -185,6 +185,24 @@ def unpack_list_literal_mult():
return
[
*
([
1
,
2
,
*
([
4
,
5
]
*
2
)]
*
3
)]
def
unpack_list_tuple_mult
():
"""
>>> unpack_list_tuple_mult()
[1, 1]
"""
return
[
*
(
1
,)
*
2
]
def
unpack_list_tuple_bad_mult
():
"""
>>> unpack_list_tuple_bad_mult()
Traceback (most recent call last):
...
TypeError: can't multiply sequence by non-int of type 'float'
"""
return
[
*
(
1
,)
*
1.5
]
@
cython
.
test_fail_if_path_exists
(
"//ListNode//ListNode"
,
"//MergedSequenceNode"
,
...
...
Kirill Smelkov
@kirr
mentioned in commit
1c0691f7
·
Oct 23, 2022
mentioned in commit
1c0691f7
mentioned in commit 1c0691f7720976a2ee9c471e071b6c8a0341eb7b
Toggle commit list
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