Movatterモバイル変換


[0]ホーム

URL:


[Python-Dev] The -U flag

Martin v. Loewismartin@v.loewis.de
Sun, 13 Oct 2002 21:48:08 +0200


Since Python allows Unicode strings in sys.path, we are makingprogress on getting -U to work. When entering interactive mode, thestumbling block is_idmap = ''for i in range(256): _idmap = _idmap + chr(i)del iHere, _idmap is initialized with a Unicode string, and the chr(i)results are promoted to Unicode, which eventually causes aUnicodeErorr when you get past 127.The work-around would be to write_idmap = str('')for i in range(256): _idmap = _idmap + chr(i)del iWith that, we can enter interactive mode in python -U.Is such a change acceptable?Curious,MartinP.S. In case you wonder how the testsuite works for -U: The firstproblem is  File "/usr/src/python/Lib/warnings.py", line 267, in ?    filterwarnings("ignore", category=OverflowWarning, append=1)  File "/usr/src/python/Lib/warnings.py", line 131, in filterwarnings    assert isinstance(message, str), "message must be a string"AssertionError: message must be a stringI'm not going to ask whether I can use basestring there, yet...


[8]ページ先頭

©2009-2025 Movatter.jp