[Patches] [ python-Patches-1007087 ] Return new string for single item joins (Bug #1001011)

SourceForge.net noreply at sourceforge.net
Wed Aug 11 14:52:26 CEST 2004


Patches item #1007087, was opened at 2004-08-11 04:03
Message generated for change (Comment added) made by tim_one
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1007087&group_id=5470

Category: Core (C code)
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Nick Coghlan (ncoghlan)
Assigned to: Nobody/Anonymous (nobody)
Summary: Return new string for single item joins (Bug #1001011)

Initial Comment:
At present, str.join contains a shortcut that returns a
reference to the existing string for a sequence that
contains a single item.

This can cause misbehaviour when subclasses of str are
involved (see the bug report for details).

The attached patch removes the shortcut, and adds a
test for the correct behaviour.

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

>Comment By: Tim Peters (tim_one)
Date: 2004-08-11 08:52

Message:
Logged In: YES 
user_id=31435

This is an important optimization for "true strings".  It was 
indeed the intent that internal optimization for immutable 
types not be applied to subclass instances, so it's good to fix 
that.  It's not good to lose the optimization when it's safe.

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

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


More information about the Patches mailing list