[issue29751] PyLong_FromString fails on decimals with leading zero and base=0

2017-03-08 Thread Mark Dickinson
Mark Dickinson added the comment: Yes, PyLong_FromString is directly used by the implementation of int, and is also used in parsing of numeric integer literals in source: https://github.com/python/cpython/blob/cb41b2766de646435743b6af7dd152751b54e73f/Python/ast.c#L4084 So I agree that this is

[issue29751] PyLong_FromString fails on decimals with leading zero and base=0

2017-03-07 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- assignee: -> docs@python components: +Documentation -Interpreter Core nosy: +docs@python, mark.dickinson type: behavior -> enhancement ___ Python tracker __

[issue29751] PyLong_FromString fails on decimals with leading zero and base=0

2017-03-07 Thread Martin Panter
Martin Panter added the comment: My guess is this is supposed to emulate (or is actually the implementation of) the "int" constructor and the Python syntax. In these cases, numbers with leading zeros are disallowed. This was to help with Python 2 porting, where a leading zero specified an octa

[issue29751] PyLong_FromString fails on decimals with leading zero and base=0

2017-03-07 Thread Cubi
New submission from Cubi: Calling PyLong_FromString(str, NULL, 0) fails, if str is a string containing a decimal number with leading zeros, even though such strings should be parsed as decimal numbers according to the documentation: "If base is 0, the radix will be determined based on the lead