Skip to content

Breaks in python 3.14 #128

@jounathaen

Description

@jounathaen

My script using npyscreen breaks since the latest fedora release at with the followin error. I guess it's the python update, but it might be something else.

  File "/usr/lib/python3.14/site-packages/npyscreen/proto_fm_screen_area.py", line 94, in _create_screen
    self.lines = self._max_physical()[0]+1
                 ~~~~~~~~~~~~~~~~~~^^
  File "/usr/lib/python3.14/site-packages/npyscreen/proto_fm_screen_area.py", line 117, in _max_physical
    mxy, mxx = struct.unpack('hh', fcntl.ioctl(sys.stderr.fileno(), termios.TIOCGWINSZ, 'xxxx'))
                                   ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SystemError: buffer overflow

I'd think a fix is as easy as changing these lines

mxy, mxx = struct.unpack('hh', fcntl.ioctl(sys.stderr.fileno(), termios.TIOCGWINSZ, 'xxxx'))
if (mxy, mxx) == (0,0):

to

mxy, mxx = termios.tcgetwinsize(sys.stderr.fileno())
if (mxy, mxx) == (0,0): 

As this repo seems to be abandoned, I guess the creation of a PR is not worth the time, but maybe this helps someone else.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions