Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(42874)

Delta Between Two Patch Sets: Modules/parsermodule.c

Issue 11682: PEP 380 reference implementation for 3.3
Left Patch Set: Created 7 years, 4 months ago
Right Patch Set: Created 7 years, 4 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « Misc/NEWS ('k') | Objects/abstract.c » ('j') | Objects/exceptions.c » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 /* parsermodule.c 1 /* parsermodule.c
2 * 2 *
3 * Copyright 1995-1996 by Fred L. Drake, Jr. and Virginia Polytechnic 3 * Copyright 1995-1996 by Fred L. Drake, Jr. and Virginia Polytechnic
4 * Institute and State University, Blacksburg, Virginia, USA. 4 * Institute and State University, Blacksburg, Virginia, USA.
5 * Portions copyright 1991-1995 by Stichting Mathematisch Centrum, 5 * Portions copyright 1991-1995 by Stichting Mathematisch Centrum,
6 * Amsterdam, The Netherlands. Copying is permitted under the terms 6 * Amsterdam, The Netherlands. Copying is permitted under the terms
7 * associated with the main Python distribution, with the additional 7 * associated with the main Python distribution, with the additional
8 * restriction that this additional notice be included and maintained 8 * restriction that this additional notice be included and maintained
9 * on all distributed copies. 9 * on all distributed copies.
10 * 10 *
(...skipping 1631 matching lines...) Expand 10 before | Expand all | Expand 10 after
1642 static int 1642 static int
1643 validate_yield_expr(node *tree) 1643 validate_yield_expr(node *tree)
1644 { 1644 {
1645 int nch = NCH(tree); 1645 int nch = NCH(tree);
1646 if (nch < 1 || nch > 2) 1646 if (nch < 1 || nch > 2)
1647 return 0; 1647 return 0;
1648 if (!validate_ntype(tree, yield_expr)) 1648 if (!validate_ntype(tree, yield_expr))
1649 return 0; 1649 return 0;
1650 if (!validate_name(CHILD(tree, 0), "yield")) 1650 if (!validate_name(CHILD(tree, 0), "yield"))
1651 return 0; 1651 return 0;
1652 if (nch == 2) { 1652 if (nch == 2) {
Z. Jędrzejewski-Szmek 2012/01/12 19:06:52 nch was tested to be (>=1 && <=2) above. This seco
1653 if (!validate_yield_arg(CHILD(tree, 1))) 1653 if (!validate_yield_arg(CHILD(tree, 1)))
1654 return 0; 1654 return 0;
1655 } 1655 }
1656 return 1; 1656 return 1;
1657 } 1657 }
1658 1658
1659 /* yield_arg: 'from' test | testlist 1659 /* yield_arg: 'from' test | testlist
1660 */ 1660 */
1661 static int 1661 static int
1662 validate_yield_arg(node *tree) 1662 validate_yield_arg(node *tree)
1663 { 1663 {
1664 int nch = NCH(tree); 1664 int nch = NCH(tree);
1665 if (!validate_ntype(tree, yield_arg)) 1665 if (!validate_ntype(tree, yield_arg))
1666 return 0; 1666 return 0;
1667 if (nch == 1) { 1667 if (nch == 1) {
1668 if (!validate_testlist(CHILD(tree, nch - 1))) 1668 if (!validate_testlist(CHILD(tree, nch - 1)))
1669 return 0; 1669 return 0;
1670 } 1670 }
1671 else if (nch == 2) { 1671 else if (nch == 2) {
Z. Jędrzejewski-Szmek 2012/01/12 19:06:52 Indentation here (off-by-one-space) Also I think
1672 if (!validate_name(CHILD(tree, 0), "from")) 1672 if (!validate_name(CHILD(tree, 0), "from"))
1673 return 0; 1673 return 0;
1674 if (!validate_test(CHILD(tree, 1))) 1674 if (!validate_test(CHILD(tree, 1)))
1675 return 0; 1675 return 0;
1676 } 1676 }
1677 else 1677 else
1678 return 0; 1678 return 0;
1679 return 1; 1679 return 1;
1680 } 1680 }
1681 1681
(...skipping 1602 matching lines...) Expand 10 before | Expand all | Expand 10 after
3284 pickle_constructor, NULL); 3284 pickle_constructor, NULL);
3285 Py_XDECREF(res); 3285 Py_XDECREF(res);
3286 } 3286 }
3287 Py_XDECREF(func); 3287 Py_XDECREF(func);
3288 Py_XDECREF(pickle_constructor); 3288 Py_XDECREF(pickle_constructor);
3289 Py_XDECREF(pickler); 3289 Py_XDECREF(pickler);
3290 Py_DECREF(copyreg); 3290 Py_DECREF(copyreg);
3291 } 3291 }
3292 return module; 3292 return module;
3293 } 3293 }
LEFTRIGHT

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+