cpython/Objects
Guido van Rossum b8c65bc27f SF patch #470578: Fixes to synchronize unicode() and str()
This patch implements what we have discussed on python-dev late in
    September: str(obj) and unicode(obj) should behave similar, while
    the old behaviour is retained for unicode(obj, encoding, errors).

    The patch also adds a new feature with which objects can provide
    unicode(obj) with input data: the __unicode__ method. Currently no
    new tp_unicode slot is implemented; this is left as option for the
    future.

    Note that PyUnicode_FromEncodedObject() no longer accepts Unicode
    objects as input. The API name already suggests that Unicode
    objects do not belong in the list of acceptable objects and the
    functionality was only needed because
    PyUnicode_FromEncodedObject() was being used directly by
    unicode(). The latter was changed in the discussed way:

    * unicode(obj) calls PyObject_Unicode()
    * unicode(obj, encoding, errors) calls PyUnicode_FromEncodedObject()

    One thing left open to discussion is whether to leave the
    PyUnicode_FromObject() API as a thin API extension on top of
    PyUnicode_FromEncodedObject() or to turn it into a (macro) alias
    for PyObject_Unicode() and deprecate it. Doing so would have some
    surprising consequences though, e.g.  u"abc" + 123 would turn out
    as u"abc123"...

[Marc-Andre didn't have time to check this in before the deadline.  I
hope this is OK, Marc-Andre!  You can still make changes and commit
them on the trunk after the branch has been made, but then please mail
Barry a context diff if you want the change to be merged into the
2.2b1 release branch.  GvR]
2001-10-19 02:01:31 +00:00
..
.cvsignore Ignore a bunch of generated files. 2000-05-02 18:34:30 +00:00
abstract.c Fix error checking done by abstract_issubclass and abstract_isinstance. 2001-10-18 03:18:43 +00:00
bufferobject.c repr's converted to using PyString_FromFormat() instead of sprintf'ing 2001-08-24 18:34:26 +00:00
cellobject.c Use new GC API. 2001-08-29 23:54:21 +00:00
classobject.c Protect references to tp_descr_get and tp_dict with the appropriate test: 2001-10-17 20:26:38 +00:00
cobject.c REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
complexobject.c Enable GC for new-style instances. This touches lots of files, since 2001-10-05 20:51:39 +00:00
descrobject.c *EXPERIMENTAL* speedup of slot_sq_item. This sped up the following 2001-10-03 12:09:30 +00:00
dictobject.c Enable GC for new-style instances. This touches lots of files, since 2001-10-05 20:51:39 +00:00
fileobject.c Band-aid solution to SF bug #470634: readlines() on linux requires 2 ^D's. 2001-10-12 20:01:53 +00:00
floatobject.c Enable GC for new-style instances. This touches lots of files, since 2001-10-05 20:51:39 +00:00
frameobject.c Add optional docstrings to getset descriptors. Fortunately, there's 2001-09-20 21:45:26 +00:00
funcobject.c Enable GC for new-style instances. This touches lots of files, since 2001-10-05 20:51:39 +00:00
intobject.c Add additional coercion support for "self subtypes" to int, long, 2001-09-19 01:25:16 +00:00
iterobject.c Patch #427190: Implement and use METH_NOARGS and METH_O. 2001-08-16 13:15:00 +00:00
listobject.c Enable GC for new-style instances. This touches lots of files, since 2001-10-05 20:51:39 +00:00
longobject.c Enable GC for new-style instances. This touches lots of files, since 2001-10-05 20:51:39 +00:00
methodobject.c Add optional docstrings to getset descriptors. Fortunately, there's 2001-09-20 21:45:26 +00:00
moduleobject.c Enable GC for new-style instances. This touches lots of files, since 2001-10-05 20:51:39 +00:00
object.c SF patch #470578: Fixes to synchronize unicode() and str() 2001-10-19 02:01:31 +00:00
obmalloc.c Identifiers matching _[A-Z_]\w* are reserved for C implementations. 2001-03-11 18:36:13 +00:00
rangeobject.c repr's converted to using PyString_FromFormat() instead of sprintf'ing 2001-08-24 18:34:26 +00:00
sliceobject.c Add optional docstrings to member descriptors. For backwards 2001-09-20 20:46:19 +00:00
stringobject.c SF bug [#468061] __str__ ignored in str subclass. 2001-10-16 20:18:24 +00:00
structseq.c Missing file structseq.c for SF patch #462296 2001-10-18 20:47:51 +00:00
tupleobject.c Enable GC for new-style instances. This touches lots of files, since 2001-10-05 20:51:39 +00:00
typeobject.c Fix SF bug #472234: type(obj) calls type->tp_init (Roeland Rengelink) 2001-10-18 15:49:21 +00:00
unicodectype.c removed "register const" from scalar arguments to the unicode 2001-06-27 22:08:26 +00:00
unicodeobject.c SF patch #470578: Fixes to synchronize unicode() and str() 2001-10-19 02:01:31 +00:00
unicodetype_db.h forgot to check in the new makeunicodedata.py script 2001-01-21 17:01:31 +00:00
weakrefobject.c Remove an unnecessary check for NULL. 2001-10-18 19:21:46 +00:00
xxobject.c REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00