[Python-checkins] CVS: python/dist/src/Python exceptions.c,1.4,1.5
Barry Warsaw
python-dev@python.org
Sat, 8 Jul 2000 21:56:27 -0700
Update of /cvsroot/python/python/dist/src/Python
In directory slayer.i.sourceforge.net:/tmp/cvs-serv21321
Modified Files:
exceptions.c
Log Message:
EnvironmentError__init__(): The two case clauses were missing
`break's. This first missing break caused a memory leak when case 3
fell through case 2 in the following example:
import os
os.chmod('/missing', 0600)
Index: exceptions.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/exceptions.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** exceptions.c 2000年07月01日 04:45:52 1.4
--- exceptions.c 2000年07月09日 04:56:25 1.5
***************
*** 441,446 ****
switch (PySequence_Length(args)) {
case 3:
! /* open() errors give third argument which is the filename. But so
! * common in-place unpacking doesn't break, e.g.:
*
* except IOError, (errno, strerror):
--- 441,448 ----
switch (PySequence_Length(args)) {
case 3:
! /* Where a function has a single filename, such as open() or some
! * of the os module functions, PyErr_SetFromErrnoWithFilename() is
! * called, giving a third argument which is the filename. But, so
! * that old code using in-place unpacking doesn't break, e.g.:
*
* except IOError, (errno, strerror):
***************
*** 466,472 ****
if (!subslice || PyObject_SetAttrString(self, "args", subslice))
goto finally;
case 2:
! /* common case: PyErr_SetFromErrno() */
item0 = PySequence_GetItem(args, 0);
item1 = PySequence_GetItem(args, 1);
--- 468,477 ----
if (!subslice || PyObject_SetAttrString(self, "args", subslice))
goto finally;
+ break;
case 2:
! /* Used when PyErr_SetFromErrno() is called and no filename
! * argument is given.
! */
item0 = PySequence_GetItem(args, 0);
item1 = PySequence_GetItem(args, 1);
***************
*** 479,482 ****
--- 484,488 ----
goto finally;
}
+ break;
}