Georg Brandl
bc1309255e
Remove useless string literal.
2009-01-03 13:45:15 +00:00
Benjamin Peterson
bdca942ffc
fix __future__ imports when multiple features are given
2008-10-26 20:21:13 +00:00
Benjamin Peterson
aff36f1295
fix compiler warning
2008-10-19 13:59:01 +00:00
Armin Ronacher
35e01fbeaa
Fixed #4067 by implementing _attributes and _fields for the AST root node.
2008-10-19 08:27:43 +00:00
Benjamin Peterson
84076d8a11
update asdl_c.py from r66377
2008-09-10 22:28:00 +00:00
Andrew M. Kuchling
110a48cf60
#3367 : revert rev. 65539: this change causes test_parser to fail
2008-08-05 02:05:23 +00:00
Andrew M. Kuchling
efa61bc15f
#3367 from Kristjan Valur Jonsson:
...
If a PyTokenizer_FromString() is called with an empty string, the
tokenizer's line_start member never gets initialized. Later, it is
compared with the token pointer 'a' in parsetok.c:193 and that behavior
can result in undefined behavior.
2008-08-05 01:38:08 +00:00
Benjamin Peterson
114f7e5fff
#1683 prevent forking from interfering in threading storage
...
This should prevent some test_multiprocessing failures
2008-06-13 00:09:47 +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
Christian Heimes
593daf545b
Renamed PyString to PyBytes
2008-05-26 12:51:38 +00:00
Amaury Forgeot d'Arc
5216721a53
Issue2681: the literal 0o8 was wrongly accepted, and evaluated as float(0.0).
...
This happened only when 8 is the first digit.
Credits go to Lukas Meuser.
2008-04-24 18:07:05 +00:00
Benjamin Peterson
820b51c170
#2627 Let it be known what pgen generates
2008-04-13 20:35:56 +00:00
Neal Norwitz
371d1747f9
Use file.write instead of print to make it easier to merge with 3k.
2008-03-31 04:28:40 +00:00
Georg Brandl
e34c21c2a0
Make AST nodes pickleable.
2008-03-30 20:20:39 +00:00
Georg Brandl
1721e75749
Fix error message -- "expects either 0 or 0 arguments"
2008-03-30 19:43:27 +00:00
Georg Brandl
2c55c597fa
Make _fields attr for no fields consistent with _attributes attr.
2008-03-30 19:00:49 +00:00
Georg Brandl
c52ed59473
#2505 : allow easier creation of AST nodes.
2008-03-30 07:01:47 +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
Georg Brandl
f2bfd54d6f
Properly check for consistency with the third argument of
...
compile() when compiling an AST node.
2008-03-29 13:24:23 +00:00
Georg Brandl
aa5fbdd71a
Silence compiler warning at the source.
2008-03-28 20:22:56 +00:00
Georg Brandl
fc8eef3c78
Patch #1810 by Thomas Lee, reviewed by myself:
...
allow compiling Python AST objects into code objects
in compile().
2008-03-28 12:11:56 +00:00
Neal Norwitz
d183bdd6fb
Revert r61969 which added casts to Py_CHARMASK to avoid compiler warnings.
...
Rather than sprinkle casts throughout the code, change Py_CHARMASK to
always cast it's result to an unsigned char. This should ensure we
do the right thing when accessing an array with the result.
2008-03-28 04:58:51 +00:00
Christian Heimes
342212c52a
Surround p_flags access with #ifdef PY_PARSER_REQUIRES_FUTURE_KEYWORD
2008-03-26 22:20:26 +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
Eric Smith
7c47894a2a
Backport of the print function, using a __future__ import.
...
This work is substantially Anthony Baxter's, from issue
1633807. I just freshened it, made a few minor tweaks,
and added the test cases. I also created issue 2412,
which is to check for 2to3's behavior with the print
function. I also added myself to ACKS.
2008-03-18 23:45:49 +00:00
Eric Smith
9ff19b5434
Finished backporting PEP 3127, Integer Literal Support and Syntax.
...
Added 0b and 0o literals to tokenizer.
Modified PyOS_strtoul to support 0b and 0o inputs.
Modified PyLong_FromString to support guessing 0b and 0o inputs.
Renamed test_hexoct.py to test_int_literal.py and added binary tests.
Added upper and lower case 0b, 0O, and 0X tests to test_int_literal.py
2008-03-17 17:32:20 +00:00
Christian Heimes
c5f05e45cf
Patch #2167 from calvin: Remove unused imports
2008-02-23 17:40:11 +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
Facundo Batista
fc2d01032f
Issue 1881. Increased the stack limit from 500 to 1500. Also added
...
a test for this (and because of this test you'll see in stderr a
message that parser.c sends before raising MemoryError).
Thanks Ralf Schmitt.
2008-02-23 12:01:13 +00:00
Neal Norwitz
c44af337ce
Add assertion that we do not blow out newl
2008-01-27 17:10:29 +00:00
Christian Heimes
082c9b0267
Fixed bug #1915 : Python compiles with --enable-unicode=no again. However several extension methods and modules do not work without unicode support.
2008-01-23 14:20:50 +00:00
Georg Brandl
898f1879e1
Add a "const" to make gcc happy.
2008-01-21 21:14:21 +00:00
Georg Brandl
38d1715b0d
Issue #1882 : when compiling code from a string, encoding cookies in the
...
second line of code were not always recognized correctly.
2008-01-21 18:35:49 +00:00
Georg Brandl
14404b68d8
Fix #1679 : "0x" was taken as a valid integer literal.
...
Fixes the tokenizer, tokenize.py and int() to reject this.
Patches by Malte Helmert.
2008-01-19 19:27:05 +00:00
Christian Heimes
288e89acfc
Added bytes and b'' as aliases for str and ''
2008-01-18 18:24:07 +00:00
Christian Heimes
7b1e119f8c
Coverity issue CID #167
...
Event alloc_fn: Called allocation function "metacompile" [model]
Event var_assign: Assigned variable "gr" to storage returned from "metacompile"
gr = metacompile(n);
Event pass_arg: Variable "gr" not freed or pointed-to in function "maketables" [model]
g = maketables(gr);
translatelabels(g);
addfirstsets(g);
Event leaked_storage: Returned without freeing storage "gr"
return g;
2008-01-18 07:45:30 +00:00
Georg Brandl
76b30d1688
Fix #define ordering.
2008-01-07 18:41:34 +00:00
Georg Brandl
dfe5dc8455
Make Python compile with --disable-unicode.
2008-01-07 18:16:36 +00:00
Amaury Forgeot d'Arc
6dae85f409
Warning "<> not supported in 3.x" should be enabled only when the -3 option is set.
2007-11-24 13:20:22 +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
Guido van Rossum
9fc1b96a19
Change a PyErr_Print() into a PyErr_Clear(),
...
per discussion in issue 1031213.
2007-10-15 15:54:11 +00:00
Neal Norwitz
a7d329a9b2
Fix Coverity 180: Don't overallocate. We don't need structs, but pointers.
...
Also fix a memory leak.
2007-10-12 03:04:18 +00:00
Martin v. Löwis
a5136196bc
Patch #1031213 : Decode source line in SyntaxErrors back to its original
...
source encoding. Will backport to 2.5.
2007-09-04 14:19:28 +00:00
Neal Norwitz
7b7d1c8282
Fix a couple of problems in generating the AST code:
...
* use %r instead of backticks since backticks are going away in Py3k
* PyArena_Malloc() already sets PyErr_NoMemory so we don't need to do it again
* the signature for ast2obj_int incorrectly used a bool, rather than a long
2007-02-26 18:10:47 +00:00
Brett Cannon
0db62aaf09
Modify Parser/asdl_c.py so that the __version__ number for Python/Python-ast.c
...
is specified at the top of the file. Also add a note that Python/Python-ast.c
needs to be committed separately after a change to the AST grammar to capture
the revision number of the change (which is what __version__ is set to).
2007-02-12 03:51:02 +00:00
Brett Cannon
1fbe3ab5de
Change a very minor inconsistency (that is purely cosmetic) in the AST
...
definition.
2007-02-11 05:36:00 +00:00
Martin v. Löwis
4885e7d098
Prefix AST symbols with _Py_. Fixes #1637022 .
...
Will backport.
2007-01-19 06:42:22 +00:00