[issue32582] chr raises OverflowError

2021-11-22 Thread Mark Dickinson


Change by Mark Dickinson :


--
nosy: +mark.dickinson

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32582] chr raises OverflowError

2021-11-21 Thread Alex Waygood


Change by Alex Waygood :


--
type:  -> behavior

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32582] chr raises OverflowError

2021-11-21 Thread Irit Katriel


Irit Katriel  added the comment:

Still raising OVerflowError on 3.11:

>>> print(chr(0x8000))
Traceback (most recent call last):
  File "", line 1, in 
OverflowError: Python int too large to convert to C int

--
nosy: +iritkatriel
versions: +Python 3.11 -Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32582] chr raises OverflowError

2018-01-20 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Perhaps this issue should be raised on Python-Dev, since it changes the old and 
well-known behavior of buildins. I think that ValueError is more appropriate, 
but in past we decided to keep OverflowError for compatibility.

If change chr(), other code needs to be changed. "%c", PyUnicode_FromOrdinal(), 
PyUnicode_Format(), and possible the same for bytes.

See also issue29833 and issue15988.

--
nosy: +serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32582] chr raises OverflowError

2018-01-19 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

The message I get on Windows is 
OverflowError: Python int too large to convert to C long

Given that the exception type is documented, making this a clear bug, I would 
be tempted to fix in 3.6 also.  But your decision.

--
nosy: +terry.reedy

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32582] chr raises OverflowError

2018-01-17 Thread STINNER Victor

STINNER Victor  added the comment:

It's more an implementation issue.

I proposed PR 5218 to also raise a ValueError on overflow.

I propose to only change Python 3.7, and only Python 2.7 and 3.6 unchanged.

--
nosy: +vstinner
versions: +Python 3.7 -Python 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32582] chr raises OverflowError

2018-01-17 Thread STINNER Victor

Change by STINNER Victor :


--
pull_requests: +5071
stage:  -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32582] chr raises OverflowError

2018-01-17 Thread Uwe Kleine-König

New submission from Uwe Kleine-König :

Hello,

the description for chr (from 
https://docs.python.org/3/library/functions.html#chr) reads as:

Return the string representing a character whose Unicode code
point is the integer i. [...] The valid range for the argument
is from 0 through 1,114,111 (0x10 in base 16). ValueError
will be raised if i is outside that range.

If however a value > 0x7fff (or < -0x8000) is provided, the function 
raises an Overflow error:

$ python3 -c 'print(chr(0x8000))'
Traceback (most recent call last):
  File "", line 1, in 
OverflowError: signed integer is greater than maximum

This is either a documentation problem or (more like) an implementation issue. 
I attached a patch that fixes the issue for me. (I'm not sure however if I 
should call PyErr_Clear() before raising ValueError.)

--
components: Interpreter Core
files: chr-OverflowError.patch
keywords: patch
messages: 310178
nosy: ukl
priority: normal
severity: normal
status: open
title: chr raises OverflowError
versions: Python 3.6
Added file: https://bugs.python.org/file47390/chr-OverflowError.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com