Skip to content

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

Merged
kumaraditya303 merged 1 commit intopython:mainfrom
okiemute04:fix-termios-tcsetwinsize
Mar 19, 2026
Merged

gh-146091: Fix NULL check in termios.tcsetwinsize#146147
kumaraditya303 merged 1 commit intopython:mainfrom
okiemute04:fix-termios-tcsetwinsize

Conversation

@okiemute04
Copy link
Contributor

@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
@kumaraditya303 kumaraditya303 merged commit 89a154a into python:main Mar 19, 2026
54 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SystemError from termios.tcsetwinsizepassing NULL to PyLong_AsLong

2 participants