mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Thanks to Coverity, these were all reported by their Prevent tool.
All of these (except _lsprof.c) should be backported. Particularly the hotshot change which validates sys.path. Can someone backport?
This commit is contained in:
parent
e22373d690
commit
60da31660c
6 changed files with 25 additions and 2 deletions
|
@ -107,6 +107,19 @@ class HotShotTestCase(unittest.TestCase):
|
|||
profiler.close()
|
||||
os.unlink(self.logfn)
|
||||
|
||||
def test_bad_sys_path(self):
|
||||
import sys
|
||||
orig_path = sys.path
|
||||
coverage = hotshot._hotshot.coverage
|
||||
try:
|
||||
# verify we require a list for sys.path
|
||||
sys.path = 'abc'
|
||||
self.assertRaises(RuntimeError, coverage, test_support.TESTFN)
|
||||
# verify sys.path exists
|
||||
del sys.path
|
||||
self.assertRaises(RuntimeError, coverage, test_support.TESTFN)
|
||||
finally:
|
||||
sys.path = orig_path
|
||||
|
||||
def test_main():
|
||||
test_support.run_unittest(HotShotTestCase)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue