Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b0e5718 commit e0e5982Copy full SHA for e0e5982
1 file changed
Python/errors.c
@@ -282,15 +282,20 @@ PyErr_SetFromErrnoWithFilename(exc, filename)
282
char *filename;
283
{
284
PyObject *v;
285
+ char *s;
286
int i = errno;
287
#ifdef EINTR
288
if (i == EINTR && PyErr_CheckSignals())
289
return NULL;
290
#endif
291
+ if (i == 0)
292
+ s = "Error"; /* Sometimes errno didn't get set */
293
+ else
294
+ s = strerror(i);
295
if (filename != NULL && Py_UseClassExceptionsFlag)
- v = Py_BuildValue("(iss)", i, strerror(i), filename);
296
+ v = Py_BuildValue("(iss)", i, s, filename);
297
else
- v = Py_BuildValue("(is)", i, strerror(i));
298
+ v = Py_BuildValue("(is)", i, s);
299
if (v != NULL) {
300
PyErr_SetObject(exc, v);
301
Py_DECREF(v);
0 commit comments