Skip to content

gh-146091: Fix NULL check in termios.tcsetwinsize#146147

Open
okiemute04 wants to merge 1 commit intopython:mainfrom
okiemute04:fix-termios-tcsetwinsize
Open

gh-146091: Fix NULL check in termios.tcsetwinsize#146147
okiemute04 wants to merge 1 commit intopython:mainfrom
okiemute04:fix-termios-tcsetwinsize

Conversation

@okiemute04
Copy link

@okiemute04 okiemute04 commented Mar 18, 2026

Fixes #146091

Add proper NULL checks for PySequence_GetItem results before passing
to PyLong_AsLong, this prevents SystemError when a BadSequence raises
TypeError in getitem, the issue was that PySequence_GetItem can return NULL, which when passed to PyLong_AsLong would cause an internal error instead of propagating
the original exception.

@bedevere-app
Copy link

bedevere-app bot commented Mar 18, 2026

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

@python-cla-bot
Copy link

python-cla-bot bot commented Mar 18, 2026

All commit authors signed the Contributor License Agreement.

CLA signed

Add proper NULL checks for PySequence_GetItem results before passing
to PyLong_AsLong. This prevents SystemError when a BadSequence raises
TypeError in __getitem__.
@okiemute04 okiemute04 force-pushed the fix-termios-tcsetwinsize branch from 5e8ef92 to 113df89 Compare March 19, 2026 00:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SystemError from termios.tcsetwinsizepassing NULL to PyLong_AsLong

1 participant