Hello,

TL;DR
I encountered a bug-like behavior of a Python built-in module.
Could you reproduce it in C?

While working with Python and its curses module on FreeBSD 11-current (x86_64), I found a weird behavior of the module. The code below doesn't print any character
although it should print a space on the upper-left corner.

```
# test.py

import curses

window = curses.initscr()
window.attrset(curses.A_NORMAL)
window.addch(" ")
window.getch()
curses.endwin()
```

The cause is `window.attrset()` and when I removed the line it works just fine. And, with the visible characters (such as 'A' and '?' except for ' ' and '\t'),
it works fine even if window.attrset() is there.

I found out Python's _curses.so links with /usr/local/lib/libncurses.so.5 dynamically. When I links it with the new /lib/libncurses.so.8 shipped with FreeBSD 11-current base
as follows, the code above (test.py in the command line below) works fine.

```
$ ln -s /lib/libncurses.so.8 /usr/lib/libncurses.so.5
$ LD_LIBRARY_PATH=/usr/lib python3.5 test.py
```

Then, I tried to reproduce it in C with the code below.

```
// test.c

#include <curses.h>

int
main()
{
  WINDOW *win = initscr();

  wattrset(win, A_NORMAL);
  waddch(win, ' ');
  getch();

  endwin();
}
```

Compiled and run it (test.c).

```
$ cc /usr/local/lib/libncurses.so.5 /usr/local/lib/libtinfo.so.5 test.c
$ ./a.out
```

It WORKS FINE as printing a space in place. I explored Modules/_cursesmodule.c in Python source tree and found that Python's curses.initscr() calls setupterm()
in <term.h> too. And, I checked the TERM environment variable.
But, the real problem could not be revealed eventually.

Could someone help me to reproduce the bug in C?
Am I missing something? Or, do I misunderstand the problem?

Thank you, all.
_______________________________________________
freebsd-python@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-python
To unsubscribe, send any mail to "freebsd-python-unsubscr...@freebsd.org"

Reply via email to