[Python-bugs-list] [ python-Bugs-416187 ] API problem causes unicode memory leak
noreply@sourceforge.net
noreply@sourceforge.net
Sat, 14 Apr 2001 14:11:25 -0700
Bugs item #416187, was updated on 2001-04-14 14:11
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=416187&group_id=5470
Category: Python Library
Group: None
Status: Open
Priority: 5
Submitted By: douglas orr (dougbo)
Assigned to: Nobody/Anonymous (nobody)
Summary: API problem causes unicode memory leak
Initial Comment:
The API PyString_ASString returns a pointer to a char
* representation of its argument.
PyString_ASStringAndSize tries to convert it to the
default encoding. In the process it makes a new
string object holding the newly encoded buffer, it
returns a pointer to the buffer (bad idea) and leaks
the new object and the buffer -- which is the only
choice since there is no control on how long the
pointer to the buffer needs to be valid.
It should probably throw an error if you give it a
unicode string and force you to convert it explicitly,
before calling the API.
I encountered this problem trying to use XML data.
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=416187&group_id=5470