Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

SystemError fromtermios.tcsetwinsizepassingNULL toPyLong_AsLong #146091

Closed
Labels
3.13bugs and security fixes3.14bugs and security fixes3.15new features, bugs and security fixesextension-modulesC modules in the Modules dirtype-crashA hard crash of the interpreter, possibly with a core dump
@devdanzin

Description

@devdanzin

Crash report

What happened?

It's possible to raiseSystemError fromtermios.tcsetwinsize by passing a sequence that raises on__getitem__ to it.

Automated diagnosis:

Bug:termios.tcsetwinsize passesNULL toPyLong_AsLong.PySequence_GetItem(winsz, 0) can returnNULL (e.g.,__getitem__ raises). The result is passed directly toPyLong_AsLong(NULL) which callsPyErr_BadInternalCall(), masking the real error withSystemError.

File:Modules/termios.c, lines 502-510

MRE:

importtermiosimportosfd=os.open("/dev/tty",os.O_RDWR|os.O_NOCTTY)classBadSequence:def__len__(self):return2def__getitem__(self,idx):raiseTypeErrortermios.tcsetwinsize(fd,BadSequence())

Backtrace:

Traceback (mostrecentcalllast):File"/home/danzin/crashers/trigger_termios_null_pylong.py",line23,in<module>termios.tcsetwinsize(fd,BadSequence())~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^SystemError:Objects/longobject.c:598:badargumenttointernalfunction

Found usingcpython-review-toolkit with Claude Opus 4.6, using the/cpython-review-toolkit:explore Modules/termios.c all deep command.

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

Output from running 'python -VV' on the command line:

Python 3.15.0a7+ (heads/main:e0f7c1097e1, Mar 17 2026, 18:10:52) [Clang 21.1.2 (2ubuntu6)]

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.13bugs and security fixes3.14bugs and security fixes3.15new features, bugs and security fixesextension-modulesC modules in the Modules dirtype-crashA hard crash of the interpreter, possibly with a core dump

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2026 Movatter.jp