pypy3.6 7.3.0 curses get_wch: ffi.error: undefined type name wint_t[1]

Create issue
Issue #3144 resolved
Anthony Sottile created an issue

Still reproduces on the latest nightly – seems to be a regression (I was able to call this function previously, it just misbehaved)

$ ./pypy-c-jit-98442-def680385695-linux64/bin/pypy3 ../ 
Traceback (most recent call last):
  File "../", line 6, in <module>
  File "/home/asottile/workspace/babi/x/pypy-c-jit-98442-def680385695-linux64/lib-python/3/curses/", line 94, in wrapper
    return func(stdscr, *args, **kwds)
  File "../", line 4, in c_main
  File "/home/asottile/workspace/babi/x/pypy-c-jit-98442-def680385695-linux64/lib_pypy/", line 407, in get_wch
    wch ="wint_t[1]")
ffi.error: undefined type name

import curses

def c_main(stdscr):


In case it matters, here is my curses versions:

$ dpkg -l | grep libncurses
ii  libncurses5:amd64                          6.1-1ubuntu1.18.04                              amd64        shared libraries for terminal handling
ii  libncursesw5:amd64                         6.1-1ubuntu1.18.04                              amd64        shared libraries for terminal handling (wide character support)
ii  libncursesw5-dev:amd64                     6.1-1ubuntu1.18.04                              amd64        developer's libraries for ncursesw

Comments (5)

  1. mattip

    yeah, it seemed I regressed this when making the linux packages portable. You should be able to rebuild the curses cffi module by running


    in the lib_pypy directory. In parallel, I will try to see how to fix this

  2. mattip

    The problem seemed to be the build script was checking ncurses version when it should have been checking which of ncurses/ncursesw is being used. Fixed in 580ac8d8c1af, the essence of which is

    diff -r 11fe1f50f3f8 -r 580ac8d8c1af lib_pypy/
    --- a/lib_pypy/ Thu Jan 09 14:59:46 2020 +0000
    +++ b/lib_pypy/ Fri Jan 10 10:44:14 2020 +0800
    @@ -385,7 +383,7 @@
     void _m_getsyx(int *yx);
    -if version > (5, 7):
    +if 'ncursesw' in libs:
     typedef int... wint_t;
     int wget_wch(WINDOW *, wint_t *);

    and after that rebuilding the _curses c-extension module

  3. Log in to comment