Skip to content

Commit

Permalink
fixed integration of Hotfix-2008-08-12
Browse files Browse the repository at this point in the history
  • Loading branch information
zopyx committed Aug 14, 2008
1 parent 3399a98 commit 37af9da
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
6 changes: 5 additions & 1 deletion PythonScript.py
Expand Up @@ -323,7 +323,11 @@ def _exec(self, bound_names, args, kw):
g['__file__'] = getattr(self, '_filepath', None) or self.get_filepath()
f = new.function(fcode, g, None, fadefs)

result = f(*args, **kw)
try:
result = f(*args, **kw)
except SystemExit:
raise ValueError('SystemExit can not be raised within a PythonScript')

if keyset is not None:
# Store the result in the cache.
self.ZCacheable_set(result, keywords=keyset)
Expand Down
8 changes: 8 additions & 0 deletions tests/testPythonScript.py
Expand Up @@ -211,6 +211,14 @@ def testGetSize(self):
f = self._filePS('complex_print')
self.assertEqual(f.get_size(), len(f.read()))

def testRaiseSystemExitLaunchpad257269(self):
ps = self._newPS("raise SystemExit")
self.assertRaises(ValueError, ps)

def testEncodingTestDotTestAllLaunchpad257276(self):
ps = self._newPS("return 'foo'.encode('test.testall')")
self.assertRaises(LookupError, ps)


class TestPythonScriptErrors(PythonScriptTestBase):

Expand Down

0 comments on commit 37af9da

Please sign in to comment.