> No, because you can pass in maxchar to PyUnicode_New() and
> the implementation will take this as hint to the max code point
> used in the string. There is no check done whether maxchar
> is indeed the minimum upper bound to the code point ordinals.

API doc says:

"""
maxchar should be the true maximum code point to be placed in the string.
As an approximation, it can be rounded up to the nearest value in the
sequence 127, 255, 65535, 1114111.
"""
https://docs.python.org/3/c-api/unicode.html#c.PyUnicode_New

Since doc says *should*, strings created with wrong maxchar
are considered invalid object.

We already ignores string with wrong maxchars in some places.
Even "a" == "a" may fail for such invalid string object.

So I don't think str.iascii() should consider about it.

Regards,
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to