◐ Shell
clean mode source ↗

gh-76763: chr function raises ValueError exception instead OverflowError by furkanonder · Pull Request #104486 · python/cpython

Conversation

JelleZijlstra


i = _PyLong_AsInt(arg);
if (i == -1 && PyErr_Occurred()) {
if (PyErr_ExceptionMatches(PyExc_OverflowError)) {

Choose a reason for hiding this comment

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

We shouldn't change the generated Argument Clinic files directly. I'm not sure, unfortunately, if there's an easy way to implement the desired behavior while still using Argument Clinic.

serhiy-storchaka

Choose a reason for hiding this comment

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

It is an implementation detail. On platform with INT_MAX >= 2**32 it raises ValueError.

@serhiy-storchaka

Also it may raise ValueError on other Python implementation.

Labels