This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: curses.ascii.unctrl broken
Type: Stage:
Components: Library (Lib) Versions: Python 2.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: akuchling Nosy List: akuchling, dcinege
Priority: normal Keywords:

Created on 2003-08-18 04:09 by dcinege, last changed 2022-04-10 16:10 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
patch. akuchling, 2003-08-29 18:53 Revised patch
Messages (2)
msg17825 - (view) Author: Dave Cinege (dcinege) Date: 2003-08-18 04:09
unctrl(c) 
 Return a string representation of the ASCII character c. If c 
is printable, this string is the character itself. ... 
 
from curses.ascii import unctrl 
>>> unctrl('a') 
'a' 
>>> unctrl('A') 
'^\x81' 
 
unctrl() is not working for the full printable charset. 
 
The Q&D fix is: 
 
def unctrl(c): 
+    if isprint(c): 
+    	return c 
    bits = _ctoi(c) 
    if bits == 0x7f: 
 
This bug has been confirmed in python 2.3 and 2.2 as 
distributed in Debian Linux. 
 
msg17826 - (view) Author: A.M. Kuchling (akuchling) * (Python committer) Date: 2003-08-29 18:53
Logged In: YES 
user_id=11375

The breakage seems to run a bit deeper than that; characters >127 also 
have problems.  I've attached a revised patch that seems to fix all the 
problems.  This patch has been checked into the trunk, and I've also 
added some simple unit tests that would have caught the problem.

Thanks!
History
Date User Action Args
2022-04-10 16:10:41adminsetgithub: 39081
2003-08-18 04:09:36dcinegecreate