This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2009年04月24日 12:26 by mark.dickinson, last changed 2022年04月11日 14:56 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| issue5829.patch | mark.dickinson, 2009年05月16日 08:24 | |||
| Messages (6) | |||
|---|---|---|---|
| msg86402 - (view) | Author: Mark Dickinson (mark.dickinson) * (Python committer) | Date: 2009年04月24日 12:26 | |
In (for example) Python 2.6:
>>> float('1e500')
inf
>>> complex('1e500')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: float() out of range: 1e500
I'd say that one of these is a bug, but I'm not sure which one.
Ideally, float('1e500') would raise OverflowError (not ValueError). But
it's quite likely that there are people who depend on the current
behaviour, and the current behaviour also agrees with what happens for
float literals:
>>> 1e500
inf
For 2.7 and 3.1, I propose fixing the complex constructor so that
complex('1e500') produces (inf+0j). For 2.6 and 3.0, I propose leaving
the current behaviour as it is.
|
|||
| msg86403 - (view) | Author: Mark Dickinson (mark.dickinson) * (Python committer) | Date: 2009年04月24日 12:28 | |
Note: complex('1e-500') also produces ValueError in 2.6. That's
definitely a bug.
|
|||
| msg86505 - (view) | Author: Mark Dickinson (mark.dickinson) * (Python committer) | Date: 2009年04月25日 13:29 | |
complex('1e-500') bug fixed in r71891 (2.6) and r71892 (3.0).
It's already gone in trunk and py3k.
What's left is deciding whether the OverflowError that 2.7 and 3.1
currently produce should disappear in favour of producing infinities
instead.
|
|||
| msg87861 - (view) | Author: Mark Dickinson (mark.dickinson) * (Python committer) | Date: 2009年05月16日 08:24 | |
Patch against py3k. If someone can review this I'll apply it for 3.1; otherwise, it can wait until 3.2. |
|||
| msg88002 - (view) | Author: Eric V. Smith (eric.smith) * (Python committer) | Date: 2009年05月17日 20:55 | |
It looks good to me. |
|||
| msg88132 - (view) | Author: Mark Dickinson (mark.dickinson) * (Python committer) | Date: 2009年05月20日 18:45 | |
Thanks, Eric. Committed in r72803; backported to trunk in r72805. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:56:48 | admin | set | github: 50079 |
| 2009年05月20日 18:45:10 | mark.dickinson | set | status: open -> closed resolution: fixed messages: + msg88132 |
| 2009年05月17日 20:55:41 | eric.smith | set | nosy:
+ eric.smith messages: + msg88002 |
| 2009年05月16日 08:25:27 | mark.dickinson | set | components: + Interpreter Core |
| 2009年05月16日 08:24:51 | mark.dickinson | set | files:
+ issue5829.patch priority: normal versions: - Python 2.6, Python 3.0 messages: + msg87861 keywords: + patch stage: test needed -> commit review |
| 2009年05月01日 15:24:15 | mark.dickinson | set | assignee: mark.dickinson |
| 2009年04月25日 13:29:29 | mark.dickinson | set | messages: + msg86505 |
| 2009年04月24日 12:28:06 | mark.dickinson | set | messages: + msg86403 |
| 2009年04月24日 12:26:47 | mark.dickinson | set | keywords: + easy |
| 2009年04月24日 12:26:20 | mark.dickinson | create | |