Commit a8506a9c authored by Stefan Behnel's avatar Stefan Behnel

Merge branch '0.29.x'

parents edf9350a a5dba3d8
......@@ -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 ``3str``.
* Starred expressions in %-formatting tuples could fail to compile for
unicode strings. (Github issue #2939)
0.29.7 (2019-04-14)
===================
......
......@@ -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.
......
# 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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment