[Python-bugs-list] [ python-Bugs-543840 ] complex(string) accepts strings with \0
noreply@sourceforge.net
noreply@sourceforge.net
Sun, 14 Apr 2002 14:50:41 -0700
Bugs item #543840, was opened at 2002-04-14 22: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: Nobody/Anonymous (nobody)
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: Hernan Martinez Foffani (hfoffani)
Date: 2002-04-14 23: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