Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e9b1949

Browse files
committed
Patch #1352711: make zipimport raise a complete IOError
1 parent 2a8ec99 commit e9b1949

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

Modules/zipimport.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -434,8 +434,7 @@ zipimporter_get_data(PyObject *obj, PyObject *args)
434434

435435
toc_entry = PyDict_GetItemString(self->files, path);
436436
if (toc_entry == NULL) {
437-
PyErr_Format(PyExc_IOError, "file not found [%.200s]",
438-
path);
437+
PyErr_SetFromErrnoWithFilename(PyExc_IOError, path);
439438
return NULL;
440439
}
441440
return get_data(PyString_AsString(self->archive), toc_entry);

0 commit comments

Comments
 (0)