Commit Graph

39 Commits

Author SHA1 Message Date
Benjamin Peterson
50a2252851 condense with assertRaises 2009-07-02 22:56:16 +00:00
Benjamin Peterson
5c8da86f3a convert usage of fail* to assert* 2009-06-30 22:57:08 +00:00
Jeremy Hylton
88f1c04215 Global statements from one function leaked into parallel functions.
Re http://bugs.python.org/issue4315

The symbol table used the same name dictionaries to recursively
analyze each of its child blocks, even though the dictionaries are
modified during analysis.  The fix is to create new temporary
dictionaries via the analyze_child_block().  The only information that
needs to propagate back up is the names of the free variables.

Add more comments and break out a helper function.  This code doesn't
get any easier to understand when you only look at it once a year.
2009-03-31 13:48:15 +00:00
Benjamin Peterson
f5574a0c29 don't use assert statement 2008-07-21 22:05:34 +00:00
Amaury Forgeot d'Arc
e4921fec01 Issue2378: pdb would delete free variables when stepping into a class statement.
The problem was introduced by r53954, the correction is to restore the symmetry between
PyFrame_FastToLocals and PyFrame_LocalsToFast
2008-07-21 22:00:38 +00:00
Amaury Forgeot d'Arc
632fad3933 Prevent a crash with nested scopes, again caused by calling Py_DECREF when the pointer
is still present in the containing structure.
2008-02-16 20:55:24 +00:00
Jeremy Hylton
759410b372 Do not copy free variables to locals in class namespaces.
Fixes bug 1569356, but at the cost of a minor incompatibility in
locals().  Add test that verifies that the class namespace is not
polluted.  Also clarify the behavior in the library docs.

Along the way, cleaned up the dict_to_map and map_to_dict
implementations and added some comments that explain what they do.
2007-02-26 18:41:18 +00:00
Tim Peters
abd8a336a3 Whitespace normalization. 2006-11-03 02:32:46 +00:00
Georg Brandl
c6fdec6d7e Convert test_global, test_scope and test_grammar to unittest.
I tried to enclose all tests which must be run at the toplevel
(instead of inside a method) in exec statements.
2006-10-28 13:10:17 +00:00
Neil Schemenauer
0e07b60a4e Fix AST compiler bug #1501934: incorrect LOAD/STORE_GLOBAL generation. 2006-07-09 16:16:34 +00:00
Neil Schemenauer
d403c45386 Fix arigo's funky LOAD_NAME bug: implicit globals inside classes have
historically been looked up using LOAD_NAME, not LOAD_GLOBAL.
looked up by LOAD_NAME, not
2005-10-23 04:24:49 +00:00
Jeremy Hylton
3e0055f8c6 Merge ast-branch to head
This change implements a new bytecode compiler, based on a
transformation of the parse tree to an abstract syntax defined in
Parser/Python.asdl.

The compiler implementation is not complete, but it is in stable
enough shape to run the entire test suite excepting two disabled
tests.
2005-10-20 19:59:25 +00:00
Barry Warsaw
04f357cffe Get rid of relative imports in all unittests. Now anything that
imports e.g. test_support must do so using an absolute package name
such as "import test.test_support" or "from test import test_support".

This also updates the README in Lib/test, and gets rid of the
duplicate data dirctory in Lib/test/data (replaced by
Lib/email/test/data).

Now Tim and Jack can have at it. :)
2002-07-23 19:04:11 +00:00
Jeremy Hylton
954aed8c8d Add test for eval() w/ free variables.
Related to SF bug #505315
2002-04-20 04:51:39 +00:00
Neal Norwitz
290d31e2fc SF #506611, fix sys.setprofile(), sys.settrace() core dumps
when no arguments are passed
2002-03-03 15:12:58 +00:00
Guido van Rossum
796e1e0b30 Don't call resetwarnings(). Be more restrictive in what we filter out
instead.
2001-12-15 18:04:10 +00:00
Jeremy Hylton
f36cfef1ae Undo inadvertent change to test_scope in previous checkin 2001-12-13 20:00:26 +00:00
Jeremy Hylton
ccae8377a3 Add test for SF bug [ #492403 ] exec() segfaults on closure's func_code 2001-12-13 19:45:04 +00:00
Jeremy Hylton
cf672f15e0 Add test for local assigned to only in a nested list comp 2001-10-18 16:23:11 +00:00
Tim Peters
d48004f4f0 test_support should be imported directly, not via test.test_support. 2001-09-25 19:29:35 +00:00
Jeremy Hylton
cd738364ce silence warnings about import * 2001-08-07 16:38:19 +00:00
Jeremy Hylton
5121e7de11 Fix for SF bug [ #443866 ] Evaluating func_code causing core dump
Add test that calls eval with a code object that has free variables.
2001-07-30 21:55:29 +00:00
Tim Peters
c4889c496a Remove now-unnecessary "from __future__ import nested_scopes" stmts. 2001-07-12 22:36:02 +00:00
Jeremy Hylton
4c889011db SF patch 419176 from MvL; fixed bug 418977
Two errors in dict_to_map() helper used by PyFrame_LocalsToFast().
2001-05-08 04:08:59 +00:00
Jeremy Hylton
ddc4fd03b1 Fix 2.1 nested scopes crash reported by Evan Simpson
The new test case demonstrates the bug.  Be more careful in
symtable_resolve_free() to add a var to cells or frees only if it
won't be added under some other rule.

XXX Add new assertion that will catch this bug.
2001-04-27 02:29:40 +00:00