Skip to content

Handle errors correctly in os_get_terminal_size_impl in posixmodule.c #116520

@sobolevn

Description

@sobolevn

Bug report

Here the first possible error will be overwritten by the second one:

cpython/Modules/posixmodule.c

Lines 14981 to 14990 in 3cdfdc0

termsize = PyStructSequence_New((PyTypeObject *)TerminalSizeType);
if (termsize == NULL)
return NULL;
PyStructSequence_SET_ITEM(termsize, 0, PyLong_FromLong(columns));
PyStructSequence_SET_ITEM(termsize, 1, PyLong_FromLong(lines));
if (PyErr_Occurred()) {
Py_DECREF(termsize);
return NULL;
}
return termsize;

Linked PRs

Metadata

Metadata

Assignees

Labels

extension-modulesC modules in the Modules dirtype-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions