[issue2799] Remove _PyUnicode_AsString(), rework _PyUnicode_AsStringAndSize(), add PyUnicode_AsChar()

2013-11-30 Thread Alexandre Vassalotti

Alexandre Vassalotti added the comment:

With PEP 393 implemented, there doesn't seem to anything left to be done here. 
Closing as fixed.

--
resolution:  - fixed
stage: needs patch - committed/rejected
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue2799
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2799] Remove _PyUnicode_AsString(), rework _PyUnicode_AsStringAndSize(), add PyUnicode_AsChar()

2011-09-29 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

The PEP 393 changed the API:

#define _PyUnicode_AsString PyUnicode_AsUTF8
#define _PyUnicode_AsStringAndSize PyUnicode_AsUTF8AndSize

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue2799
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2799] Remove _PyUnicode_AsString(), rework _PyUnicode_AsStringAndSize(), add PyUnicode_AsChar()

2010-12-07 Thread Julian Andres Klode

Julian Andres Klode j...@jak-linux.org added the comment:

The problem I see here is that there is no public way to simply get a C string 
from a unicode object similar to PyBytes_AsString() for bytes. That's bad 
because we don't want to rewrite the whole code to duplicate strings all the 
time and free every string we get from a MyPyUnicode_AsString() like function.

I used the following, but this clearly has a memory leak:


  static const char *MyPyUnicode_AsString(PyObject *op) {
  PyObject *bytes = PyUnicode_AsEncodedString(op,0,0);
  return bytes ? PyBytes_AS_STRING(bytes) : 0;
  }

I now use the following which has no memory leak, but needs an internal 
function (I would use _PyUnicode_AsString, but I need Python 2.X compatibility 
as well):

  static const char *MyPyUnicode_AsString(PyObject *op) {
  PyObject *bytes = _PyUnicode_AsDefaultEncodedString(op, 0);
  return bytes ? PyBytes_AS_STRING(bytes) : 0;
  }

So could something be done about this?

--
nosy: +jak

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue2799
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2799] Remove _PyUnicode_AsString(), rework _PyUnicode_AsStringAndSize(), add PyUnicode_AsChar()

2010-11-16 Thread Alexander Belopolsky

Changes by Alexander Belopolsky belopol...@users.sourceforge.net:


--
components: +Interpreter Core
stage:  - needs patch
versions: +Python 3.3 -Python 3.0, Python 3.1

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue2799
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2799] Remove _PyUnicode_AsString(), rework _PyUnicode_AsStringAndSize(), add PyUnicode_AsChar()

2010-04-03 Thread Marc-Andre Lemburg

Marc-Andre Lemburg m...@egenix.com added the comment:

Updating the ticket title to what we actually have in SVN (I had renamed the 
APIs to mark them as private to the interpreter some time ago).

--
title: Remove PyUnicode_AsString(), rework PyUnicode_AsStringAndSize(), add 
PyUnicode_AsChar() - Remove _PyUnicode_AsString(), rework 
_PyUnicode_AsStringAndSize(), add PyUnicode_AsChar()

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue2799
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com