changeset 48859:de954dd6797b legacy-trunk

#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
author Neal Norwitz <nnorwitz@gmail.com>
date Sun, 24 Aug 2008 22:03:05 +0000
parents 58d295e7800f
children 1a4922fa5160
files Lib/test/test_fileio.py Modules/_fileio.c
diffstat 2 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/Lib/test/test_fileio.py	Sun Aug 24 21:55:03 2008 +0000
+++ b/Lib/test/test_fileio.py	Sun Aug 24 22:03:05 2008 +0000
@@ -227,6 +227,10 @@
             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.
--- a/Modules/_fileio.c	Sun Aug 24 21:55:03 2008 +0000
+++ b/Modules/_fileio.c	Sun Aug 24 22:03:05 2008 +0000
@@ -175,7 +175,7 @@
 						 kwlist,
 						 Py_FileSystemDefaultEncoding,
 						 &name, &mode, &closefd))
-			goto error;
+			return -1;
 	    }
 	}