From 901e4715bd50bd96469c7fea8c9ed22e61ff6028 Mon Sep 17 00:00:00 2001 From: Neal Norwitz Date: Sun, 24 Aug 2008 22:03:05 +0000 Subject: #3662: Fix segfault introduced when fixing memory leaks. TESTED=./python -E -tt ./Lib/test/regrtest.py test_fileio R (approach from bug)=Amaury and Benjamin --- Lib/test/test_fileio.py | 4 ++++ Modules/_fileio.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Lib/test/test_fileio.py b/Lib/test/test_fileio.py index 9f70a73..a8b15fa 100644 --- a/Lib/test/test_fileio.py +++ b/Lib/test/test_fileio.py @@ -227,6 +227,10 @@ class OtherFileTests(unittest.TestCase): except: pass + def testInvalidInit(self): + self.assertRaises(TypeError, _fileio._FileIO, "1", 0, 0) + + def test_main(): # Historically, these tests have been sloppy about removing TESTFN. # So get rid of it no matter what. diff --git a/Modules/_fileio.c b/Modules/_fileio.c index 6b3a98d..d6f004f 100644 --- a/Modules/_fileio.c +++ b/Modules/_fileio.c @@ -175,7 +175,7 @@ fileio_init(PyObject *oself, PyObject *args, PyObject *kwds) kwlist, Py_FileSystemDefaultEncoding, &name, &mode, &closefd)) - goto error; + return -1; } } -- cgit v0.12