[ python-Bugs-1503157 ] "/".join() throws OverflowError

SourceForge.net noreply at sourceforge.net
Sat Jun 10 08:45:20 CEST 2006


Bugs item #1503157, was opened at 2006-06-08 20:58
Message generated for change (Settings changed) made by gbrandl
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1503157&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.5
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Wummel (calvin)
Assigned to: Tim Peters (tim_one)
Summary: "/".join() throws OverflowError

Initial Comment:
I noticed a regression in string.join() behaviour:

Running under Python 2.4 works:
$ python2.4
Python 2.4.4c0 (#2, Apr 22 2006, 22:39:06) 
[GCC 4.0.3 (Debian 4.0.3-1)] on linux2
Type "help", "copyright", "credits" or "license" for
more information.
>>> "/".join([u"", u"2"])
u'/2'
>>> 

Running under Python 2.5 SVN build fails:
$ python2.5
Python 2.5a2 (trunk:46757, Jun  8 2006, 22:20:31) 
[GCC 4.1.2 20060604 (prerelease) (Debian 4.1.1-2)] on
linux2
Type "help", "copyright", "credits" or "license" for
more information.
>>> "/".join([u"", u"2"])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OverflowError: join() is too long for a Python string
>>> 


----------------------------------------------------------------------

>Comment By: Georg Brandl (gbrandl)
Date: 2006-06-10 06:45

Message:
Logged In: YES 
user_id=849994

I applied the fix in rev. 46812. I also added the new test
to the 2.4 branch in rev. 46813.

----------------------------------------------------------------------

Comment By: Tim Peters (tim_one)
Date: 2006-06-09 00:34

Message:
Logged In: YES 
user_id=31435

Fudge -- sorry about that!  Your fix is fine.  Adding two
non-negative signed integers of the same width indeed
overflows if and only if the computed result is negative.  I
was hallucinating when I imagined that a 0 result also
indicated overflow (something related to that is a correct
fast test when dealing with unsigned integers, but we're not
here).

----------------------------------------------------------------------

Comment By: Hye-Shik Chang (perky)
Date: 2006-06-08 22:40

Message:
Logged In: YES 
user_id=55188

That occurrs when join sequence includes a zero-length
unicode object after Tim's r46084. 
I attached a patch but can't sure that it's correct fix yet. :)

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1503157&group_id=5470


More information about the Python-bugs-list mailing list