Patches item #1752184, was opened at 2007-07-11 15:46
Message generated for change (Comment added) made by gvanrossum
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1752184&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: None
Group: Python 3000
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Thomas Heller (theller)
Assigned to: Guido van Rossum (gvanrossum)
Summary: PyHeapTypeObject fix

Initial Comment:
This patch makes sure that the PyHeapTypeObject's ht_name member always 
contains a PyUnicode_Object.  Other code relies on this.

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

>Comment By: Guido van Rossum (gvanrossum)
Date: 2007-07-11 17:15

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

You're right there's a refcount leak.  Can you rework the patch to avoid
this?  One way would be to remove the later INCREF(value) and move that
into the code for when value is already a unicode. Then all the error
returns from them on must DECREF(value).

Also, the test for null bytes is not correct if there can be non-ASCII
characters in the name (as Martin will eventually implement), since it is
comparing the strlen() of the 8-bit string (which is UTF-8) with the length
of the Unicode string.  I wonder if we shouldn't add a generic API that
checks for null characters in a string, as I expect we'll need this in
other places too and the correct idiom is much more complicated now.

I also think that you might be able to simply insist on unicode, rather
than accepting both string and unicode.  That way we'll find any remaining
offenders more quickly (probably there aren't many).

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

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

Reply via email to