python / cpython

The Python programming language
https://www.python.org/
Other
61.06k stars 29.49k forks source link

builtins.chr and the 'c' format flag raise different errors #88830

Open df79943f-4aee-4531-a00d-c6b12816eb70 opened 2 years ago

df79943f-4aee-4531-a00d-c6b12816eb70 commented 2 years ago
BPO 44664
Nosy @serhiy-storchaka, @mr-nfamous, @jdevries3133

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields: ```python assignee = None closed_at = None created_at = labels = ['type-bug'] title = "builtins.chr and the 'c' format flag raise different errors" updated_at = user = 'https://github.com/mr-nfamous' ``` bugs.python.org fields: ```python activity = actor = 'serhiy.storchaka' assignee = 'none' closed = False closed_date = None closer = None components = [] creation = creator = 'bup' dependencies = [] files = [] hgrepos = [] issue_num = 44664 keywords = [] message_count = 2.0 messages = ['397735', '397745'] nosy_count = 3.0 nosy_names = ['serhiy.storchaka', 'bup', 'jack__d'] pr_nums = [] priority = 'normal' resolution = None stage = None status = 'open' superseder = None type = 'behavior' url = 'https://bugs.python.org/issue44664' versions = [] ```

df79943f-4aee-4531-a00d-c6b12816eb70 commented 2 years ago

chr (or anything else which calls PyUnicode_FromOrdinal) raises ValueError if its argument falls outside the range of valid Unicode code points, while PyUnicode_FromFormat raises OverflowError. Shouldn't the latter raise ValueError as well?

serhiy-storchaka commented 2 years ago

Is there any example where it causes troubles?

terryjreedy commented 1 year ago

Serhiy, do you think we should close this?