New submission from Christoph Wruck: Hi, is there any reason why ord() raises a TypeError instead of ValueError on string/bytes input with wrong length?
The chr() function will raise a ValueError on negative integers such as chr(-1). Required behaviour: try: n = ord(input_string) except ValueError as e: # it's a string/bytes-string, process potential escape sequence and # get an ordinal number of decoded escape sequence, otherwise raise ... with kind regards, Chris ---------- components: Unicode messages: 266142 nosy: cwr, ezio.melotti, haypo priority: normal severity: normal status: open title: ord() raises TypeError in string input versions: Python 3.4 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue27092> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com