Commit Graph

91 Commits

Author SHA1 Message Date
Benjamin Peterson 2b30ea068f The compiling struct is now passed around to all AST helpers (see issue 2720) 2008-05-03 15:56:42 +00:00
Georg Brandl a48f3ab895 Patch #2511: Give the "excepthandler" AST item proper attributes by making it a Sum. 2008-03-30 06:40:17 +00:00
Christian Heimes 3c60833e1e Patch #2477: Added from __future__ import unicode_literals
The new PyParser_*Ex() functions are based on Neal's suggestion and initial patch. The new __future__ feature makes all '' and r'' unicode strings. b'' and br'' stay (byte) strings.
2008-03-26 22:01:37 +00:00
Georg Brandl d5b635f196 Make Py3k warnings consistent w.r.t. punctuation; also respect the
EOL 80 limit and supply more alternatives in warning messages.
2008-03-25 08:29:14 +00:00
Martin v. Löwis a4d77898db Issue #2400: Allow relative imports to "import *". 2008-03-19 04:39:13 +00:00
Amaury Forgeot d'Arc d21fb4c2e0 Issue#2238: some syntax errors from *args or **kwargs expressions
would give bogus error messages, because of untested exceptions::

    >>> f(**g(1=2))
    XXX undetected error
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    TypeError: 'int' object is not iterable

instead of the expected SyntaxError: keyword can't be an expression

Will backport.
2008-03-05 01:50:33 +00:00
Christian Heimes 5224d28d38 Patch #1759: Backport of PEP 3129 class decorators
with some help from Georg
2008-02-23 15:01:05 +00:00
Christian Heimes 288e89acfc Added bytes and b'' as aliases for str and '' 2008-01-18 18:24:07 +00:00
Georg Brandl dfe5dc8455 Make Python compile with --disable-unicode. 2008-01-07 18:16:36 +00:00
Christian Heimes ffcd1e10b6 Added filename to compiling struct based on Martin's suggestion.
I'm wonder why I was trying to add the filename to the node all the time. The compiling struct is more obvious.
2007-11-24 01:36:02 +00:00
Christian Heimes 6d8fb1a444 And yet another fix for the patch. Paul Moore has send me a note that I've missed a declaration. The additional code has moved the declaration in the middle of the block. 2007-11-23 13:25:31 +00:00
Christian Heimes e36fe53d68 How did the comment get there? 2007-11-23 12:16:35 +00:00
Christian Heimes 02c9ab568d Fixed problems in the last commit. Filenames and line numbers weren't reported correctly.
Backquotes still don't report the correct file. The AST nodes only contain the line number but not the file name.
2007-11-23 12:12:02 +00:00
Christian Heimes 729ab15370 Applied patch #1754273 and #1754271 from Thomas Glee
The patches are adding deprecation warnings for back ticks and <>
2007-11-23 09:10:36 +00:00
Neal Norwitz 3adac21762 Fix Coverity #158: Check the correct variable. 2007-10-05 03:41:19 +00:00
Georg Brandl 69ff5acc8b Place #ifdef Py_USING_UNICODE around decode_unicode(). 2007-08-06 07:37:58 +00:00
Guido van Rossum b6ac23cd07 SF patch# 1755885 by Kurt Kaiser: show location of Unicode escape errors.
(Slightly tweaked for style and refcounts.)
2007-07-18 17:19:14 +00:00
Georg Brandl e06cf4534f Disallow function calls like foo(None=1).
Backport from py3k rev. 55708 by Guido.
2007-06-07 13:23:24 +00:00
Collin Winter 6290305e67 Backport PEP 3110's new 'except' syntax to 2.6. 2007-05-18 23:11:24 +00:00
Neal Norwitz dc9b32e1ab Handle a couple of uncaught errors. This should be backported 2007-05-03 06:47:18 +00:00
Georg Brandl b8ae3d0138 Actually raise an exception before calling ast_error_finish.
Triggers an assertion otherwise.
2007-05-02 20:02:29 +00:00
Jeremy Hylton dd2cf1cb84 Clean up formatting of this file.
The file should now follow PEP 7, except that it uses 4 space indents
(in the style of Py3k).  This particular code would be really hard to
read with the regular tab idents.

Other changes:
 - reflow long lines
 - change multi-line conditionals to have test at end of line
2007-03-16 15:59:47 +00:00
Collin Winter 77c67bd585 Patch #1642547: Fix an error/crash when encountering syntax errors in complex if statements.
Will backport.
2007-03-16 04:11:30 +00:00
Jeremy Hylton 819de6ce20 tabify
Note that ast.c still has a mix of tabs and spaces, because it
attempts to use four-space indents for more of the new code.
2007-02-27 16:13:23 +00:00
Neal Norwitz 85dbec6da7 Bug #1588287: fix invalid assertion for `1,2` in debug builds.
Will backport
2006-11-04 19:25:22 +00:00
Neal Norwitz 3a23017bb2 Bug #1557232: fix seg fault with def f((((x)))) and def f(((x),)).
These tests should be improved.  Hopefully this fixes variations when
flipping back and forth between fpdef and fplist.

Backport candidate.
2006-09-22 08:18:10 +00:00
Neal Norwitz ca460d9722 with and as are now keywords. There are some generated files I can't recreate. 2006-09-06 06:28:06 +00:00
Neal Norwitz d042132268 M-x untabify 2006-09-05 04:00:12 +00:00
Neal Norwitz e4d4f00aee Add a comment about some refactoring. (There's probably more that should be done.) I will reformat this file in the next checkin due to the inconsistent tabs/spaces. 2006-09-05 03:58:26 +00:00
Neal Norwitz dac090d3e6 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).
2006-09-05 03:53:08 +00:00
Neal Norwitz 6f5ff3f3eb Klocwork made another run and found a bunch more problems.
This is the first batch of fixes that should be easy to verify based on context.

This fixes problem numbers: 220 (ast), 323-324 (symtable),
321-322 (structseq), 215 (array), 210 (hotshot), 182 (codecs), 209 (etree).
2006-08-12 01:43:40 +00:00
Neal Norwitz c173b488dc Add some asserts and update comments 2006-07-30 19:18:13 +00:00
Neal Norwitz 0d62a06206 Patch #1531113: Fix augmented assignment with yield expressions.
Also fix a SystemError when trying to assign to yield expressions.
2006-07-30 06:53:31 +00:00
Neal Norwitz d12bd012a6 Handle more memory allocation failures without crashing. 2006-07-21 07:59:47 +00:00
Neal Norwitz edef2be4af Bug #1520864: unpacking singleton tuples in for loop (for x, in) work again. 2006-07-12 05:26:17 +00:00
Neil Schemenauer 6ec6ab02c3 Fix SF bug 1441486: bad unary minus folding in compiler. 2006-07-09 21:19:29 +00:00
Neil Schemenauer 0e07b60a4e Fix AST compiler bug #1501934: incorrect LOAD/STORE_GLOBAL generation. 2006-07-09 16:16:34 +00:00
Neal Norwitz fb48afa708 Fix SF bug #1519018: 'as' is now validated properly in import statements 2006-07-08 05:31:37 +00:00
Georg Brandl 7784f12d74 Replace Py_BuildValue("OO") by PyTuple_Pack. 2006-05-26 20:04:44 +00:00
Neal Norwitz 5ef922447c Fix #1474677, non-keyword argument following keyword. 2006-05-19 06:43:50 +00:00
Neal Norwitz 373f0a718c - Bug #1487966: Fix SystemError with conditional expression in assignment
Most of the test_syntax changes are just updating the numbers.
2006-05-15 07:04:36 +00:00
Martin v. Löwis 6685128b97 Fix more ssize_t issues. 2006-04-22 11:40:03 +00:00
Martin v. Löwis 0cc56e5c59 Introduce asdl_int_seq, to hold cmpop_ty. 2006-04-13 12:29:43 +00:00
Martin v. Löwis 2845750c5b Convert 0 to their respective enum types. Convert
void* to their respective _ty types. Fix signature of
ast_for_exprlist.
2006-04-11 09:17:27 +00:00
Anthony Baxter a863d334aa low-hanging fruit in Python/ - g++ still hates all the enum_kind declarations
in Python/Python-ast.c. Not sure what to do about those.
2006-04-11 07:43:46 +00:00
Jeremy Hylton 2f327c14eb Add lineno, col_offset to excephandler to enable future fix for
tracing/line number table in except blocks.

Reflow long lines introduced by col_offset changes.  Update test_ast
to handle new fields in excepthandler.

As note in Python.asdl says, we might want to rethink how attributes
are handled.  Perhaps they should be the same as other fields, with
the primary difference being how they are defined for all types within
a sum.

Also fix asdl_c so that constructors with int fields don't fail when
passed a zero value.
2006-04-04 04:00:23 +00:00
Neal Norwitz 33b730e33c Fix SF bug #1458903 with AST compiler.
def foo((x)): was getting recognized as requiring tuple unpacking
which is not correct.

Add tests for this case and the proper way to unpack a tuple of one:
	def foo((x,)):

test_inpsect was incorrect before.  I'm not sure why it was passing,
but that has been corrected with a test for both functions above.
This means the test (and therefore inspect.getargspec()) are broken in 2.4.
2006-03-27 08:58:23 +00:00
Neal Norwitz e98ccf6690 Forward port MvL's fix in 43227:
Fix crash when a Unicode string containing an encoding declaration is
compile()d. Fixes #1115379.
2006-03-23 05:39:47 +00:00
Nick Coghlan 77858684e4 Fix bug 1441408 where a double colon didn't trigger extended slice semantics (applies patch 1452332) 2006-03-17 17:59:10 +00:00
Hye-Shik Chang 4af5c8cee4 SF #1444030: Fix several potential defects found by Coverity.
(reviewed by Neal Norwitz)
2006-03-07 15:39:21 +00:00