Commit Graph

60 Commits

Author SHA1 Message Date
Victor Stinner
7791165fb3 code_richcompare() now uses the constants types
Issue #25843: When compiling code, don't merge constants if they are equal but
have a different types. For example, "f1, f2 = lambda: 1, lambda: 1.0" is now
correctly compiled to two different functions: f1() returns 1 (int) and f2()
returns 1.0 (int), even if 1 and 1.0 are equal.

Add a new _PyCode_ConstantKey() private function.
2016-01-22 12:33:12 +01:00
Serhiy Storchaka
43e9007767 Fixed Py3k warnings in tests for issue #24731. 2015-11-29 20:13:56 +02:00
Serhiy Storchaka
6156560e4b Issue #25678: Copy buffer objects to null-terminated strings.
Avoid buffer overreads when int(), long(), float(), and compile()
are passed buffer objects.  Similar code is removed from the
complex() constructor, where it was not reachable.

Patch backported from issue #24802 by Eryk Sun.
2015-11-20 21:56:21 +02:00
Serhiy Storchaka
5d7d26c403 Issue #25388: Fixed tokenizer hang when processing undecodable source code
with a null byte.
2015-11-14 15:14:29 +02:00
Serhiy Storchaka
3eb554fc82 Issue #22221: Backported fixes from Python 3 (issue #18960).
* Now the source encoding declaration on the second line isn't effective if
  the first line contains anything except a comment.  This affects compile(),
  eval() and exec() too.

* IDLE now ignores the source encoding declaration on the second line if the
  first line contains anything except a comment.

* 2to3 and the findnocoding.py script now ignore the source encoding
  declaration on the second line if the first line contains anything except
  a comment.
2014-09-05 10:22:05 +03:00
Benjamin Peterson
4f09e615cd test for 2 arg exec case 2014-08-09 19:39:50 -07:00
Robert Jordens
af09c774e5 Issue #21591: add test for qualified exec in tuple form. 2014-07-29 17:24:24 +02:00
Antoine Pitrou
ab4a69158b Issue #21523: Fix over-pessimistic computation of the stack effect of some opcodes in the compiler.
This also fixes a quadratic compilation time issue noticeable when compiling
code with a large number of "and" and "or" operators.
2014-05-23 11:46:03 +02:00
Mark Dickinson
1658797a9d Issue #16339: Document and test exec(stmt, globals, locals) form in Python 2.7. 2012-11-25 13:25:57 +00:00
Ezio Melotti
24b07bcba3 #11515: fix several typos. Patch by Piotr Kasprzyk. 2011-03-15 18:55:01 +02:00
Florent Xicluna
af61719ec3 Silence some py3k SyntaxWarning using check_py3k_warnings() with "exec" statements. 2010-03-21 11:03:21 +00:00
Benjamin Peterson
0dee9c1b5c prevent lambda functions from having docstrings #8164 2010-03-17 20:41:42 +00:00
Ezio Melotti
b0f5adc3f4 use assert[Not]IsInstance where appropriate 2010-01-24 16:58:36 +00:00
Ezio Melotti
aa98058cc4 use assert[Not]In where appropriate 2010-01-23 23:04:36 +00:00
Senthil Kumaran
ce8e33a095 Reverting the Revision: 77368. I committed Flox's big patch for tests by
mistake. ( It may come in for sure tough)
2010-01-08 19:04:16 +00:00
Senthil Kumaran
3ddc435af6 Fixing - Issue7026 - RuntimeError: dictionary changed size during iteration. Patch by flox 2010-01-08 18:41:40 +00:00
Benjamin Peterson
e36199b49d fix several compile() issues by translating newlines in the tokenizer 2009-11-12 23:39:44 +00:00
Benjamin Peterson
5c8da86f3a convert usage of fail* to assert* 2009-06-30 22:57:08 +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
Mark Dickinson
64b7e501f4 Issue #3360: Fix incorrect parsing of "020000000000.0". 2008-07-16 09:40:03 +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
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
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
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