Commit graph

132 commits

Author SHA1 Message Date
Amaury Forgeot d'Arc
b1147f5d0a Merged revisions 84209, 84214 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r84209 | amaury.forgeotdarc | 2010-08-19 19:43:15 +0200 (jeu., 19 août 2010) | 5 lines

  Check the return values for all functions returning an ast node.
  Failure to do it may result in strange error messages or even crashes,
  in admittedly convoluted cases that are normally syntax errors, like:
      def f(*xx, __debug__): pass
........
  r84214 | amaury.forgeotdarc | 2010-08-19 23:32:38 +0200 (jeu., 19 août 2010) | 3 lines

  Add tests for r84209 (crashes in the Ast builder)
  Also remove one tab, and move a check closer to the possible failure.
........
2010-08-19 21:50:08 +00:00
Benjamin Peterson
947ce58a90 prevent assignment to set literals 2010-06-24 00:12:40 +00:00
Brett Cannon
fa84d923ec Remove two unneeded branches to an 'if' statement by applying De Morgan's Law
and creating a single 'if' statement along with a NULL default value for a
variable.

Also clean up a bunch of whitespace.

Found using Clang's static analyzer.
2010-05-05 20:30:30 +00:00
Brett Cannon
417439e6cd Partially revert the over-reaching r80813. 2010-05-05 20:24:30 +00:00
Brett Cannon
0b03f10afb Remove three unneeded variable assignments.
Found using Clang's static analyzer.
2010-05-05 20:20:19 +00:00
Alexandre Vassalotti
b646547bb4 Issue #2333: Backport set and dict comprehensions syntax. 2010-01-11 22:36:12 +00:00
Alexandre Vassalotti
ee936a2130 Issue #2335: Backport set literals syntax from Python 3.x. 2010-01-09 23:35:54 +00:00
Benjamin Peterson
99a5023c80 improve several corner cases related with argument names in parenthesis
- Fix #7362: give a good error message for parenthesized arguments with
  defaults.

- Add a py3k warning for any parenthesized arguments since those are not allowed
  in Py3.  This warning is not given in tuple unpacking, since that incurs the
  tuple unpacking warning.
2009-11-19 22:54:57 +00:00
Benjamin Peterson
ea0e3b0d60 do a backport of r75928
The added test does not fail without the patch, but we still fix the issue of
surrogates being used in wide builds where they should not be.
2009-10-29 01:49:07 +00:00
Eric Smith
abc9f70381 Removed PyOS_ascii_atof from ast.c, as mentioned in issue 7117. 2009-10-27 18:33:14 +00:00
Benjamin Peterson
7adbb5a35d #7050 fix a SystemError when using tuple unpacking and augmented assignment 2009-10-03 20:23:24 +00:00
Benjamin Peterson
c0ba828857 better col_offsets for "for" statements with tuple unpacking #6704
Patch from Frank Wierzbicki.
2009-08-15 22:59:21 +00:00
Benjamin Peterson
4879c907ce the Slice in x[::] has to have step as None to help the interpreter 2009-07-20 20:28:08 +00:00
Benjamin Peterson
a72be3b325 when no module is given in a 'from' relative import, make ImportFrom.module NULL 2009-06-13 20:23:33 +00:00
Benjamin Peterson
52c4bec76b give a better error message when deleting () 2009-06-13 17:08:53 +00:00
Benjamin Peterson
5d1ff94b9e set Print.values to NULL if there are no values 2009-06-13 16:19:19 +00:00
Benjamin Peterson
d1f5a59edb allow importing from a module named None if it has an 'as' clause 2009-06-13 13:06:21 +00:00
Benjamin Peterson
565e1b6bb7 prevent import statements from assigning to None 2009-06-13 03:46:30 +00:00
Benjamin Peterson
4afbba3d34 keep the slice.step field as NULL if no step expression is given 2009-06-13 01:40:00 +00:00
Benjamin Peterson
4efb5d0b82 remove check for case handled in sub-function 2009-06-11 22:29:23 +00:00
Benjamin Peterson
b266481ed8 revert r73361 2009-06-11 17:49:38 +00:00
Benjamin Peterson
e5fa5fe8fc remove duplicate check 2009-06-11 16:25:52 +00:00
Benjamin Peterson
a5a5728cf0 remove error checks already done in set_context() 2009-06-08 23:44:13 +00:00
Benjamin Peterson
8ea4ded9a6 remove useless assertion 2009-06-08 22:18:32 +00:00
Georg Brandl
944f684ce6 Allow multiple context managers in one with statement, as proposed
in http://codereview.appspot.com/53094 and accepted by Guido.

The construct is transformed into multiple With AST nodes so that
there should be no problems with the semantics.
2009-05-25 21:02:56 +00:00
Amaury Forgeot d'Arc
59ce042766 #4077: No need to append \n when calling Py_FatalError
+ fix a declaration to make it match the one in pythonrun.h
2009-01-17 20:18:59 +00:00
Mark Dickinson
422ce06b9c Issue #4461: Safety check in parsenumber (ast.c) 2008-12-05 17:59:46 +00:00
Benjamin Peterson
9e6310d936 always check the return value of NEW_IDENTIFIER 2008-11-25 03:43:14 +00:00
Benjamin Peterson
c078f929cb don't segfault when \N escapes are used and unicodedata fails to load
Fixes #4367
2008-11-21 22:27:24 +00:00
Benjamin Peterson
2c98faada6 check for assignment to __debug__ during AST generation
Also, give assignment to None a better error message
2008-11-08 18:38:54 +00:00
Benjamin Peterson
399b1fe8df give a py3k warning when 'nonlocal' is used as a variable name 2008-10-25 02:53:28 +00:00
Benjamin Peterson
80f0ed5bb1 allow keyword args to be passed in after *args #3473 2008-08-19 19:52:46 +00:00
Mark Dickinson
64b7e501f4 Issue #3360: Fix incorrect parsing of "020000000000.0". 2008-07-16 09:40:03 +00:00
Benjamin Peterson
175e4d9663 #3219 repeated keyword arguments aren't allowed in function calls anymore 2008-07-01 19:34:52 +00:00
Gregory P. Smith
9d53457e59 Merge in release25-maint r60793:
Added checks for integer overflows, contributed by Google. Some are
 only available if asserts are left in the code, in cases where they
 can't be triggered from Python code.
2008-06-11 07:41:16 +00:00
Gregory P. Smith
dd96db63f6 This reverts r63675 based on the discussion in this thread:
http://mail.python.org/pipermail/python-dev/2008-June/079988.html

Python 2.6 should stick with PyString_* in its codebase.  The PyBytes_* names
in the spirit of 3.0 are available via a #define only.  See the email thread.
2008-06-09 04:58:54 +00:00
Benjamin Peterson
f4fcdb6b8c warn about parameter tuple unpacking 2008-06-08 23:00:00 +00:00
Benjamin Peterson
d5efd20406 Warn about assigning to Py3k keywords (True and False) 2008-06-08 22:52:37 +00:00
Benjamin Peterson
cbd78133fa add an ast_warn helper function to make adding those Py3k warnings easier 2008-06-08 15:45:23 +00:00
Benjamin Peterson
2fe3ef8750 change Py3k backquote warning to a SyntaxWarning and add a test 2008-06-08 02:05:33 +00:00
Christian Heimes
593daf545b Renamed PyString to PyBytes 2008-05-26 12:51:38 +00:00
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