]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
#3662: Fix segfault introduced when fixing memory leaks.
authorNeal Norwitz <nnorwitz@gmail.com>
Sun, 24 Aug 2008 22:03:05 +0000 (22:03 +0000)
committerNeal Norwitz <nnorwitz@gmail.com>
Sun, 24 Aug 2008 22:03:05 +0000 (22:03 +0000)
TESTED=./python -E -tt ./Lib/test/regrtest.py test_fileio
R (approach from bug)=Amaury and Benjamin

Lib/test/test_fileio.py
Modules/_fileio.c

index 9f70a7335406fe99c48fa5c85792cea8ee8371ec..a8b15fa1f843743f3497a6e77ecce4955c40ff39 100644 (file)
@@ -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.
index 6b3a98d6f05e2ad7c48eec24c08db485a33869de..d6f004f66182bd797593da77f5146f0b71d9e1b2 100644 (file)
@@ -175,7 +175,7 @@ fileio_init(PyObject *oself, PyObject *args, PyObject *kwds)
                                                 kwlist,
                                                 Py_FileSystemDefaultEncoding,
                                                 &name, &mode, &closefd))
-                       goto error;
+                       return -1;
            }
        }