forked from sqlalchemy/mako
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support nested tuple unpacking in for loops
Fixed issue where unpacking nested tuples in a for loop using would raise a "couldn't apply loop context" error if the loop context was used. The regex used to match the for loop expression now allows the list of loop variables to contain parenthesized sub-tuples. Pull request courtesy Matt Trescott. For example: ~~~ for (key1, val1), (key2, val2) in itertools.pairwise(dict.items()): ... ~~~ This is really just "kicking the can down the road" so to speak, because it doesn't allow an infinite number of layers of tuples, but it helps somewhat. Closes: sqlalchemy#368 Pull-request: sqlalchemy#368 Pull-request-sha: 3f15a87 Change-Id: I52915acb8904daf7071d8c92e1de352f200131ec
- Loading branch information
Showing
3 changed files
with
26 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.. change:: | ||
:tags: bug, codegen | ||
:tickets: 368 | ||
|
||
Fixed issue where unpacking nested tuples in a for loop using would raise a | ||
"couldn't apply loop context" error if the loop context was used. The regex | ||
used to match the for loop expression now allows the list of loop variables | ||
to contain parenthesized sub-tuples. Pull request courtesy Matt Trescott. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters