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
a8506a9c
Commit
a8506a9c
authored
Apr 30, 2019
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '0.29.x'
parents
edf9350a
a5dba3d8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
1 deletion
+27
-1
CHANGES.rst
CHANGES.rst
+5
-1
Cython/Compiler/Optimize.py
Cython/Compiler/Optimize.py
+4
-0
tests/run/pep448_extended_unpacking.pyx
tests/run/pep448_extended_unpacking.pyx
+18
-0
No files found.
CHANGES.rst
View file @
a8506a9c
...
...
@@ -134,12 +134,16 @@ Other changes
Bugs
fixed
----------
*
GH
-
2919
:
Python
tuple
constants
that
compare
equal
but
have
different
item
*
Python
tuple
constants
that
compare
equal
but
have
different
item
types
could
incorrectly
be
merged
into
a
single
constant
.
(
Github
issue
#
2919
)
*
Non
-
ASCII
characters
in
unprefixed
strings
could
crash
the
compiler
when
used
with
language
level
``
3
str
``.
*
Starred
expressions
in
%-
formatting
tuples
could
fail
to
compile
for
unicode
strings
.
(
Github
issue
#
2939
)
0.29.7
(
2019
-
04
-
14
)
===================
...
...
Cython/Compiler/Optimize.py
View file @
a8506a9c
...
...
@@ -4326,6 +4326,9 @@ class ConstantFolding(Visitor.VisitorTransform, SkipDeclarations):
warning
(
pos
,
"Too few arguments for format placeholders"
,
level
=
1
)
can_be_optimised
=
False
break
if
arg
.
is_starred
:
can_be_optimised
=
False
break
if
format_type
in
u'asrfdoxX'
:
format_spec
=
s
[
1
:]
if
format_type
in
u'doxX'
and
u'.'
in
format_spec
:
...
...
@@ -4343,6 +4346,7 @@ class ConstantFolding(Visitor.VisitorTransform, SkipDeclarations):
else
:
# keep it simple for now ...
can_be_optimised
=
False
break
if
not
can_be_optimised
:
# Print all warnings we can find before finally giving up here.
...
...
tests/run/pep448_extended_unpacking.pyx
View file @
a8506a9c
# mode: run
# tag: all_language_levels
cimport
cython
...
...
@@ -144,6 +146,22 @@ def unpack_tuple_keep_originals(a, b, c):
return
(
*
a
,
*
b
,
2
,
*
c
)
def
unpack_tuple_in_string_formatting
(
a
,
*
args
):
"""
>>> print(unpack_tuple_in_string_formatting(1, 2))
1 2
>>> print(unpack_tuple_in_string_formatting(1, 'x'))
1 'x'
>>> unpack_tuple_in_string_formatting(1) # doctest: +ELLIPSIS
Traceback (most recent call last):
TypeError: ...format...
>>> unpack_tuple_in_string_formatting(1, 2, 3) # doctest: +ELLIPSIS
Traceback (most recent call last):
TypeError: ...format...
"""
return
"%s %r"
%
(
a
,
*
args
)
#### lists
...
...
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