[Python-bugs-list] [ python-Bugs-543840 ] complex(string) accepts strings with \0
noreply@sourceforge.net
noreply@sourceforge.net
Sun, 14 Apr 2002 14:55:41 -0700
Bugs item #543840, was opened at 2002-04-14 16:53
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=543840&group_id=5470
Category: Python Interpreter Core
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Hernan Martinez Foffani (hfoffani)
>Assigned to: Tim Peters (tim_one)
Summary: complex(string) accepts strings with \0
Initial Comment:
the complex constructor doesn't fail when passing
strings with an embbebed \0
Python 2.3a0 (#10, Apr 14 2002, 16:21:30)
[GCC 2.95.2 19991024 (release)] on linux2
Type "copyright", "credits" or "license" for more
information.
>>> complex('1+0j\0j')
(1+0j)
>>>
Other malformed arguments do fail:
>>> complex('1+0j j')
Traceback (most recent call last):
File "<pyshell#0>", line 1, in ?
complex('1+0j j')
ValueError: complex() arg is a malformed string
--
Source code from todays CVS.
Regards,
-Hernan
----------------------------------------------------------------------
>Comment By: Tim Peters (tim_one)
Date: 2002-04-14 17:55
Message:
Logged In: YES
user_id=31435
Assigned to me; I've already got a fix, so you needn't
bother with that.
----------------------------------------------------------------------
Comment By: Hernan Martinez Foffani (hfoffani)
Date: 2002-04-14 17:50
Message:
Logged In: YES
user_id=112690
It seems to be a problem in complex_subtype_from_string(..)
when there is a '\0' in the string argument.
I'm uploading a patch that seems to fix this.
In another patch goes the tests for this fix.
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=543840&group_id=5470