◐ Shell
reader mode source ↗
Skip to content

bpo-32582: chr() doesn't raise OverflowError anymore#5218

Closed
vstinner wants to merge 3 commits into
python:masterfrom
vstinner:chr_overflow
Closed

bpo-32582: chr() doesn't raise OverflowError anymore#5218
vstinner wants to merge 3 commits into
python:masterfrom
vstinner:chr_overflow

Conversation

@vstinner

@vstinner vstinner commented Jan 17, 2018

Copy link
Copy Markdown
Member

chr() now catchs OverflowError and raises a ValueError exception
instead.

https://bugs.python.org/issue32582

chr() now catchs OverflowError and raises a ValueError exception
instead.
@vstinner

Copy link
Copy Markdown
Member Author

Hum, this PR changes the exception type for large float.

Patched:

>>> chr(2.0**32)
ValueError: chr() arg not in range(0x110000)

Python 3.6:

>>> chr(2.0**32)
TypeError: integer argument expected, got float

@zhangyangyu

Copy link
Copy Markdown
Member

Ahh, yes. And now it could accept small float while not the case before. So still need to call "PyArg_Parse" and catch OverflowError then.

@serhiy-storchaka serhiy-storchaka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hide comment

Needed updating the chr() documentation an an entry in the What's New document, in the section "Porting to 3.7".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants