homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author pitrou
Recipients arigo, martin.panter, nascheme, neologix, nikratio, pitrou, serhiy.storchaka, tim.peters, vstinner, xgdomingo
Date 2017年09月05日.19:13:20
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1504638800.69.0.405441777348.issue17852@psf.upfronthosting.co.za>
In-reply-to
Content
Just apply the following patch to the original PR and it should work fine:
diff --git a/Modules/_io/bufferedio.c b/Modules/_io/bufferedio.c
index 50c87c1..2ba98f2 100644
--- a/Modules/_io/bufferedio.c
+++ b/Modules/_io/bufferedio.c
@@ -409,12 +409,12 @@ static void
 buffered_dealloc(buffered *self)
 {
 self->finalizing = 1;
+ if (self->next != NULL)
+ remove_from_linked_list(self);
 if (_PyIOBase_finalize((PyObject *) self) < 0)
 return;
 _PyObject_GC_UNTRACK(self);
 self->ok = 0;
- if (self->next != NULL)
- remove_from_linked_list(self);
 if (self->weakreflist != NULL)
 PyObject_ClearWeakRefs((PyObject *)self);
 Py_CLEAR(self->raw);
@@ -1860,8 +1860,12 @@ void _PyIO_atexit_flush(void)
 while (buffer_list_end.next != &buffer_list_end) {
 buffered *buf = buffer_list_end.next;
 remove_from_linked_list(buf);
- buffered_flush(buf, NULL);
- PyErr_Clear();
+ if (buf->ok && !buf->finalizing) {
+ Py_INCREF(buf);
+ buffered_flush(buf, NULL);
+ Py_DECREF(buf);
+ PyErr_Clear();
+ }
 }
 }
History
Date User Action Args
2017年09月05日 19:13:20pitrousetrecipients: + pitrou, tim.peters, arigo, nascheme, vstinner, nikratio, neologix, martin.panter, serhiy.storchaka, xgdomingo
2017年09月05日 19:13:20pitrousetmessageid: <1504638800.69.0.405441777348.issue17852@psf.upfronthosting.co.za>
2017年09月05日 19:13:20pitroulinkissue17852 messages
2017年09月05日 19:13:20pitroucreate

AltStyle によって変換されたページ (->オリジナル) /