[issue5816] Simplify parsing of complex numbers and make complex('inf') valid.

Mark Dickinson report at bugs.python.org
Wed Apr 22 22:27:20 CEST 2009


New submission from Mark Dickinson <dickinsm at gmail.com>:

Here's a patch that:

 1. greatly simplifies the complex parsing code in Objects/complexobject.c
 2. allows nans and infinities in constructing a complex number from
    a string
 3. fixes missing out-of-memory checks (PyOS_ascii_strtod can fail due to
    lack of memory).

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') 
should be valid too.  There are potential uses for being able to create a 
complex infinity when working with the complex projective plane (a natural 
domain for rational functions over the complex numbers).

----------
files: simplify_complex_parsing.patch
keywords: patch
messages: 86328
nosy: marketdickinson
severity: normal
status: open
title: Simplify parsing of complex numbers and make complex('inf') valid.
Added file: http://bugs.python.org/file13738/simplify_complex_parsing.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5816>
_______________________________________


More information about the Python-bugs-list mailing list