New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplify parsing of complex numbers and make complex('inf') valid. #50066
Comments
Here's a patch that:
Note that part 2. comes entirely for free with the parsing simplification. But it seems to me that if float('inf') is valid, then complex('inf') |
Updated patch:
>>> inf = float('inf')
>>> 1 + inf*j
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'j' is not defined
>>> 1 + inf*1j # expect (1+infj), but get nan in real part:
(nan+infj) Furthermore, with these simplifications to printing and
|
Wow, that does greatly simplify printing. One nit: the variable named Mark Dickinson wrote:
That's correct. It might make a difference when fixing bpo-4482, Also, could this be backported to 2.7, so that 4482 can be fixed the |
The fallback code, around line 633 in the patched version of pystrtod.c, |
Committed to py3k, r71818, with the changes Eric suggested. I ran build Will backport. |
Backported to trunk in r71824. Leaving open, as I now need forward port some bits of r71824 which Note that with this change, some strings which were previously accepted '1..1j' I consider this to be a bugfix: I can't imagine that acceptance of 'j' continue to be accepted. |
Extra bits forward ported in r71829. Python 3.1 and 2.7 now both accept |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: