mirror of
https://github.com/python/cpython
synced 2024-09-05 16:38:56 +00:00
Rework previous fix slightly; the &0x20 test seems useless, and the isprint() check mustn't prevent the meta-bit check at the end
This commit is contained in:
parent
e8792c1f65
commit
b738041c5d
|
@ -87,13 +87,11 @@ def alt(c):
|
|||
return _ctoi(c) | 0x80
|
||||
|
||||
def unctrl(c):
|
||||
if isprint(c):
|
||||
return chr(_ctoi(c))
|
||||
bits = _ctoi(c)
|
||||
if bits == 0x7f:
|
||||
rep = "^?"
|
||||
elif bits & 0x20:
|
||||
rep = chr((bits & 0x7f) | 0x20)
|
||||
elif isprint(bits & 0x7f):
|
||||
rep = chr(bits & 0x7f)
|
||||
else:
|
||||
rep = "^" + chr(((bits & 0x7f) | 0x20) + 0x20)
|
||||
if bits & 0x80:
|
||||
|
|
Loading…
Reference in a new issue