mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
Patch #1550800: make exec a function.
This commit is contained in:
parent
4e472e05bd
commit
7cae87ca7b
105 changed files with 1246 additions and 1583 deletions
|
@ -61,7 +61,7 @@ class CompilerTest(unittest.TestCase):
|
|||
c = compiler.compile("try:\n 1/0\nexcept:\n e = 1\nfinally:\n f = 1",
|
||||
"<string>", "exec")
|
||||
dct = {}
|
||||
exec c in dct
|
||||
exec(c, dct)
|
||||
self.assertEquals(dct.get('e'), 1)
|
||||
self.assertEquals(dct.get('f'), 1)
|
||||
|
||||
|
@ -73,7 +73,7 @@ class CompilerTest(unittest.TestCase):
|
|||
self.assert_('__doc__' in c.co_names)
|
||||
c = compiler.compile('def f():\n "doc"', '<string>', 'exec')
|
||||
g = {}
|
||||
exec c in g
|
||||
exec(c, g)
|
||||
self.assertEquals(g['f'].__doc__, "doc")
|
||||
|
||||
def testLineNo(self):
|
||||
|
@ -113,7 +113,7 @@ class CompilerTest(unittest.TestCase):
|
|||
'<string>',
|
||||
'exec')
|
||||
dct = {}
|
||||
exec c in dct
|
||||
exec(c, dct)
|
||||
self.assertEquals(dct.get('result'), 3)
|
||||
|
||||
def testGenExp(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue