summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorAmaury Forgeot d'Arc <amauryfa@gmail.com>2007-11-24 13:44:17 (GMT)
committerAmaury Forgeot d'Arc <amauryfa@gmail.com>2007-11-24 13:44:17 (GMT)
commitce7d10ccc4d04fd96dfd5c0d239ed81357efd3f8 (patch)
tree0f13ca75cbdaac1c1c2e712f47055cd7f66a8bca /Lib
parent6dae85f409642f29ff37c8648f977ea24883e75e (diff)
downloadcpython-ce7d10ccc4d04fd96dfd5c0d239ed81357efd3f8.zip
cpython-ce7d10ccc4d04fd96dfd5c0d239ed81357efd3f8.tar.gz
cpython-ce7d10ccc4d04fd96dfd5c0d239ed81357efd3f8.tar.bz2
Issue #1445: Fix a SystemError when accessing the ``cell_contents``
attribute of an empty cell object. Now a ValueError is raised.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_funcattrs.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_funcattrs.py b/Lib/test/test_funcattrs.py
index 7a083b7..a32be38 100644
--- a/Lib/test/test_funcattrs.py
+++ b/Lib/test/test_funcattrs.py
@@ -242,6 +242,17 @@ def test_func_closure():
verify(c[0].__class__.__name__ == "cell") # don't have a type object handy
cantset(f, "func_closure", c)
+def test_empty_cell():
+ def f(): print a
+ try:
+ f.func_closure[0].cell_contents
+ except ValueError:
+ pass
+ else:
+ raise TestFailed, "shouldn't be able to read an empty cell"
+
+ a = 12
+
def test_func_doc():
def f(): pass
verify(f.__doc__ is None)
@@ -385,6 +396,7 @@ def test_im_name():
def testmore():
test_func_closure()
+ test_empty_cell()
test_func_doc()
test_func_globals()
test_func_name()