[issue10570] curses.tigetstr() returns bytes, but curses.tparm() expects a string

Petri Lehtinen report at bugs.python.org
Wed Nov 2 21:10:07 CET 2011


Petri Lehtinen <petri at digip.org> added the comment:

I'm not a curses expert, but after digging a while, I believe that I now understand what these functions are doing. tigetstr() returns a "format string" (bytes) and tparm() does substitutions and returns a command string (bytes) for the terminal.

I don't believe that the first parameter to tparm() (the format string) is ever constructed by hand, because it's terminal specific. The value is obtained from the terminfo database by calling tigetstr() instead. Furthermore, tigetstr() returns binary data, for which bytes is the only sane representation, and therefore tparm() should expect bytes instead of str.

Attached a patch that fixes this.

----------
keywords: +needs review, patch
stage: test needed -> patch review
Added file: http://bugs.python.org/file23595/issue10570.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10570>
_______________________________________


More information about the Python-bugs-list mailing list