[Python-bugs-list] [Bug #113934] string * int silently returns wrong answer for certain ints

noreply@sourceforge.net noreply@sourceforge.net
Fri, 8 Sep 2000 22:34:50 -0700


Bug #113934, was updated on 2000-Sep-08 21:18
Here is a current snapshot of the bug.

Project: Python
Category: Core
Status: Open
Resolution: None
Bug Group: None
Priority: 8
Summary: string * int silently returns wrong answer for certain ints

Details: Multiplying string * int sometimes delivers the wrong answer instead of raising an exception. For example, Python will return the wrong value when attempting to create a string exactly 2**32 bytes long:

Python 1.5.2 (#1, Feb  1 2000, 16:32:16)  [GCC egcs-2.91.66 19990314/Linux (egcs- on linux-i386
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> s='x'*65536
>>> len(s)
65536
>>> t=s*65536
>>> len (t)
0

Follow-Ups:

Date: 2000-Sep-08 22:34
By: tim_one

Comment:
Assigned to me.  Boosted the priority because similar inputs can cause core dumps, and especially when mucking with Unicode strings instead of 8-bit guys.
-------------------------------------------------------

For detailed info, follow this link:
http://sourceforge.net/bugs/?func=detailbug&bug_id=113934&group_id=5470