Patches item #1680015, was opened at 2007-03-13 17:44
Message generated for change (Comment added) made by zseil
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1680015&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: Core (C code)
Group: Python 2.5
>Status: Closed
Resolution: Accepted
Priority: 5
Private: No
Submitted By: Žiga Seilnacht (zseil)
Assigned to: Žiga Seilnacht (zseil)
Summary: __slots__ tuple modified inplace if it contains unicode name

Initial Comment:
Function _unicode_to_string() in typeobject.c
tries to copy the original tuple by asking for
a complete slice of the original tuple. This
case is special cased in tupleslice() to only
incref the original tuple. As a consequence,
the user's tuple could be modified (see
the test). 
There are also some reference leaks if an
unicode name can't be encoded with the default
codec. 
The patch fixes this and adds tests for both
cases. I also moved a comment about possible
leaks to the appropriate place.


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

>Comment By: Žiga Seilnacht (zseil)
Date: 2007-03-14 13:38

Message:
Logged In: YES 
user_id=1326842
Originator: YES

I moved the comment back to its old place and
renamed variables to "slot_name" and "new_name".

Commited as revision 54378, 54379 (2.5).

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

Comment By: Georg Brandl (gbrandl)
Date: 2007-03-13 18:57

Message:
Logged In: YES 
user_id=849994
Originator: NO

Perhaps moving the "leak" comment into the if block isn't such a good
idea.

Ah, and while you're at it, you could improve the variable names ("o" and
"o1" is not very useful :)

Otherwise the patch looks fine, I'd say you can apply it then.

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

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1680015&group_id=5470
_______________________________________________
Patches mailing list
Patches@python.org
http://mail.python.org/mailman/listinfo/patches

Reply via email to