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.
Created on 2016年05月23日 12:53 by cwr, last changed 2022年04月11日 14:58 by admin. This issue is now closed.
| Messages (3) | |||
|---|---|---|---|
| msg266142 - (view) | Author: Christoph Wruck (cwr) | Date: 2016年05月23日 12:53 | |
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 |
|||
| msg266144 - (view) | Author: Xiang Zhang (xiang.zhang) * (Python committer) | Date: 2016年05月23日 13:14 | |
Once I also mentioned about this in another thread, issue27008, I created and Serhiy gave me a response. You can have a look at that. |
|||
| msg266147 - (view) | Author: Christoph Wruck (cwr) | Date: 2016年05月23日 13:41 | |
closed as redundant to: http://bugs.python.org/issue27008 |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:58:31 | admin | set | github: 71279 |
| 2016年05月23日 13:41:26 | cwr | set | status: open -> closed resolution: not a bug messages: + msg266147 title: ord() raises TypeError in string input -> ord() raises TypeError on string/bytes input |
| 2016年05月23日 13:27:05 | xiang.zhang | set | nosy:
+ serhiy.storchaka |
| 2016年05月23日 13:14:42 | xiang.zhang | set | nosy:
+ xiang.zhang messages: + msg266144 |
| 2016年05月23日 13:03:38 | cwr | set | type: enhancement -> behavior |
| 2016年05月23日 13:03:00 | cwr | set | type: enhancement |
| 2016年05月23日 12:53:59 | cwr | create | |