msg122746 - (view) |
Author: Jakub Wilk (jwilk) |
Date: 2010-11-28 23:38 |
$ python3 --version Python 3.1.3 $ python3 setup.py bdist upload --sign [snip] Traceback (most recent call last): File "setup.py", line 71, in cmdclass = dict(build_py=build_py) File "/usr/local/lib/python3.1/distutils/core.py", line 149, in setup dist.run_commands() File "/usr/local/lib/python3.1/distutils/dist.py", line 919, in run_commands self.run_command(cmd) File "/usr/local/lib/python3.1/distutils/dist.py", line 938, in run_command cmd_obj.run() File "/usr/local/lib/python3.1/distutils/command/upload.py", line 66, in run self.upload_file(command, pyversion, filename) File "/usr/local/lib/python3.1/distutils/command/upload.py", line 155, in upload_file body.write(value) TypeError: 'str' does not support the buffer interface Without --sign it works just fine. |
|
|
msg122781 - (view) |
Author: Jakub Wilk (jwilk) |
Date: 2010-11-29 08:44 |
Ugh. Please disregard the first message. What I wanted to write is: In Python 3.1.3, curses.tigetstr() returns bytes (which makes sense), but curses.tparm() expects a Unicode string as first argument. As a consequence even the example given in the documentation doesn't work: >>> from curses import * >>> setupterm() >>> tparm(tigetstr("cup"), 5, 3) Traceback (most recent call last): File "", line 1, in TypeError: must be string, not bytes |
|
|
msg141657 - (view) |
Author: Tobias Klausmann (klausman) |
Date: 2011-08-05 12:23 |
This bug is still not fixed and basically makes the curses module unusable except for very narrow use cases. Unfortunately, my C-fu is very weak, otherwise I'd try to make a patch. |
|
|
msg141770 - (view) |
Author: STINNER Victor (vstinner) *  |
Date: 2011-08-08 11:21 |
See also #12567. |
|
|
msg146873 - (view) |
Author: Petri Lehtinen (petri.lehtinen) *  |
Date: 2011-11-02 20:10 |
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. |
|
|
msg146879 - (view) |
Author: Roundup Robot (python-dev)  |
Date: 2011-11-02 22:46 |
New changeset e41663970ca5 by Victor Stinner in branch '3.2': Issue #10570: curses.tigetstr() is now expecting a byte string, instead of a http://hg.python.org/cpython/rev/e41663970ca5 New changeset ab11a6a73683 by Victor Stinner in branch 'default': (Merge 3.2) Issue #10570: curses.tigetstr() is now expecting a byte string, http://hg.python.org/cpython/rev/ab11a6a73683 |
|
|
msg146880 - (view) |
Author: STINNER Victor (vstinner) *  |
Date: 2011-11-02 22:48 |
"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." Ok, it sounds to be fair. I wrote a patch based on yours (except that Python crashes with your patch :-)). |
|
|
msg146913 - (view) |
Author: Petri Lehtinen (petri.lehtinen) *  |
Date: 2011-11-03 09:53 |
It seems that putp() should also accept only bytes, because it's used to output terminal commands. It's currently expecting a str. |
|
|
msg146963 - (view) |
Author: Roundup Robot (python-dev)  |
Date: 2011-11-03 19:35 |
New changeset 38f4a251608f by Victor Stinner in branch '3.2': Issue #10570: curses.putp() is now expecting a byte string, instead of a http://hg.python.org/cpython/rev/38f4a251608f New changeset 08f44eb760a6 by Victor Stinner in branch 'default': (Merge 3.2) Issue #10570: curses.putp() is now expecting a byte string, instead http://hg.python.org/cpython/rev/08f44eb760a6 |
|
|
msg146964 - (view) |
Author: STINNER Victor (vstinner) *  |
Date: 2011-11-03 19:36 |
> It seems that putp() should also accept only bytes, > because it's used to output terminal commands. Ok, here is another fix for Python 3.2 and 3.3. I'm closing the issue again. |
|
|
msg147136 - (view) |
Author: Arfrever Frehtes Taifersar Arahesis (Arfrever) *  |
Date: 2011-11-06 03:18 |
The entry in Misc/NEWS mentions the change in curses.tigetstr(), but actually curses.tparm() has been changed. Please fix that entry to avoid confusion. (curses.tigetstr() still expects a unicode string and returns a bytes string.) |
|
|
msg147145 - (view) |
Author: Roundup Robot (python-dev)  |
Date: 2011-11-06 07:31 |
New changeset 3a0a94797ac5 by Petri Lehtinen in branch '3.2': curses.tparm() is expecting a byte string, not curses.tigetstr() http://hg.python.org/cpython/rev/3a0a94797ac5 New changeset 626c6c7f3af6 by Petri Lehtinen in branch 'default': curses.tparm() is expecting a byte string, not curses.tigetstr() http://hg.python.org/cpython/rev/626c6c7f3af6 |
|
|
msg147158 - (view) |
Author: STINNER Victor (vstinner) *  |
Date: 2011-11-06 13:55 |
> The entry in Misc/NEWS mentions the change in curses.tigetstr(), > but actually curses.tparm() has been changed Woops, thanks for fixing the NEWS file :-) |
|
|