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.

classification
Title: FileIO.__init__ aborts when opener returns bad fd
Type: crash Stage: patch review
Components: Interpreter Core, IO Versions: Python 3.11, Python 3.10, Python 3.9
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: ZackerySpytz, iritkatriel, tekknolagi
Priority: normal Keywords: patch

Created on 2019-09-04 21:19 by tekknolagi, last changed 2022-04-11 14:59 by admin.

Pull Requests
URL Status Linked Edit
PR 15688 open ZackerySpytz, 2019-09-05 01:13
Messages (3)
msg351150 - (view) Author: Maxwell Bernstein (tekknolagi) * Date: 2019-09-04 21:19
On a debug build, the following causes an abort:

import _io
_io.FileIO("foobar", opener=lambda name, flags: 1000000)

1000000 is not a valid fd. FileIO attempts to raise an IOError from errno, but there is already an exception set when PyErr_SetFromErrno uses PyObject_Call to create the exception.
msg351159 - (view) Author: Zackery Spytz (ZackerySpytz) * (Python triager) Date: 2019-09-05 01:18
Thank you for the report.
msg404246 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2021-10-18 23:22
Reproduced on 3.11.
History
Date User Action Args
2022-04-11 14:59:19adminsetgithub: 82212
2021-10-18 23:22:00iritkatrielsetnosy: + iritkatriel

messages: + msg404246
versions: + Python 3.10, Python 3.11, - Python 3.7, Python 3.8
2019-09-05 01:18:41ZackerySpytzsetversions: + Python 3.7, Python 3.8, Python 3.9, - Python 3.6
nosy: + ZackerySpytz

messages: + msg351159

components: + Interpreter Core
2019-09-05 01:13:39ZackerySpytzsetkeywords: + patch
stage: patch review
pull_requests: + pull_request15346
2019-09-04 21:19:41tekknolagicreate