STINNER Victor added the comment:
+ if (!closed) {
+ PyObject *res = PyObject_CallMethod(file, "close", "");
+ PyErr_Clear();
+ Py_XDECREF(res);
+ }
+ if (!dunder_closed) {
+ PyObject *res = PyObject_CallMethod(dunder_file, "close", "");
+ PyErr_Clear();
+ Py_XDECREF(res);
+ }
Hum, since it's common to have sys.__stderr__ = sys.stderr, maybe it's worth to
skip the second close if dunder_file == file?
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue26642>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com