mirror of
https://github.com/python/cpython.git
synced 2025-08-01 07:33:08 +00:00
Bug #1520864 (again): unpacking singleton tuples in list comprehensions and
generator expressions (x for x, in ... ) works again. Sigh, I only fixed for loops the first time, not list comps and genexprs too. I couldn't find any more unpacking cases where there is a similar bug lurking. This code should be refactored to eliminate the duplication. I'm sure the listcomp/genexpr code can be refactored. I'm not sure if the for loop can re-use any of the same code though. Will backport to 2.5 (the only place it matters).
This commit is contained in:
parent
4bc2c0919b
commit
dac090d3e6
4 changed files with 23 additions and 5 deletions
|
@ -64,9 +64,10 @@ extern time_t PyOS_GetLastModificationTime(char *, FILE *);
|
|||
Python 2.5b3: 62111 (fix wrong code: x += yield)
|
||||
Python 2.5c1: 62121 (fix wrong lnotab with for loops and
|
||||
storing constants that should have been removed)
|
||||
Python 2.5c2: 62131 (fix wrong code: for x, in ... in listcomp/genexp)
|
||||
.
|
||||
*/
|
||||
#define MAGIC (62121 | ((long)'\r'<<16) | ((long)'\n'<<24))
|
||||
#define MAGIC (62131 | ((long)'\r'<<16) | ((long)'\n'<<24))
|
||||
|
||||
/* Magic word as global; note that _PyImport_Init() can change the
|
||||
value of this global to accommodate for alterations of how the
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue