bpo-38031: Fix a possible assertion failure in _io.FileIO() by ZackerySpytz · Pull Request #15688 · python/cpython

Conversation

@ZackerySpytz

Use PyErr_Fetch() / _PyErr_ChainExceptions() when calling
internal_close() on error. The opener may return an invalid
fd, which will cause the close() call in internal_close() to fail.

https://bugs.python.org/issue38031

Use PyErr_Fetch() / _PyErr_ChainExceptions() when calling
internal_close() on error.  The opener may return an invalid
fd, which will cause the close() call in internal_close() to fail.

aeros

@aeros aeros left a comment

Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vstinner

@vstinner

serhiy-storchaka

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly LGTH. Just address Victor's comment.

@csabella

iritkatriel

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Converted @vstinner's comment into suggestions.

iritkatriel

iritkatriel

iritkatriel

vstinner

iritkatriel

iritkatriel

vstinner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for updating the PR @iritkatriel ;-)

iritkatriel

@miss-islington

Thanks @ZackerySpytz for the PR, and @iritkatriel for merging it 🌮🎉.. I'm working now to backport this PR to: 3.10, 3.11.
🐍🍒⛏🤖

This was referenced

Nov 25, 2022