mirror of
https://github.com/python/cpython
synced 2026-09-29 09:50:29 +03:00
This patch adds a new builtin unistr() which behaves like str()
except that it always returns Unicode objects. A new C API PyObject_Unicode() is also provided. This closes patch #101664. Written by Marc-Andre Lemburg. Copyright assigned to Guido van Rossum.
This commit is contained in:
parent
d5c43065d5
commit
ad7c98e264
10 changed files with 119 additions and 6 deletions
|
|
@ -271,6 +271,18 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
|||
|
||||
*/
|
||||
|
||||
/* Implemented elsewhere:
|
||||
|
||||
PyObject *PyObject_Unicode(PyObject *o);
|
||||
|
||||
Compute the unicode representation of object, o. Returns the
|
||||
unicode representation on success, NULL on failure. This is
|
||||
the equivalent of the Python expression: unistr(o).)
|
||||
|
||||
Called by the unistr() built-in function.
|
||||
|
||||
*/
|
||||
|
||||
DL_IMPORT(int) PyCallable_Check(PyObject *o);
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -266,6 +266,7 @@ extern DL_IMPORT(PyTypeObject) PyType_Type; /* The type of type objects */
|
|||
extern DL_IMPORT(int) PyObject_Print(PyObject *, FILE *, int);
|
||||
extern DL_IMPORT(PyObject *) PyObject_Repr(PyObject *);
|
||||
extern DL_IMPORT(PyObject *) PyObject_Str(PyObject *);
|
||||
extern DL_IMPORT(PyObject *) PyObject_Unicode(PyObject *);
|
||||
extern DL_IMPORT(int) PyObject_Compare(PyObject *, PyObject *);
|
||||
extern DL_IMPORT(PyObject *) PyObject_RichCompare(PyObject *, PyObject *, int);
|
||||
extern DL_IMPORT(int) PyObject_RichCompareBool(PyObject *, PyObject *, int);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue