cpython/Include
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
..
Python.h Include the weakref object interface. 2001-10-05 21:55:19 +00:00
abstract.h Generalize operator.indexOf (PySequence_Index) to work with any 2001-09-08 04:00:12 +00:00
bitset.h REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
bufferobject.h REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
cStringIO.h Cast the result of xxxPyCObject_Import to PycStringIO_CAPI*. 2001-06-09 07:59:43 +00:00
cellobject.h PEP 227 implementation 2001-01-25 20:04:14 +00:00
ceval.h Merge of descr-branch back into trunk. 2001-08-02 04:15:00 +00:00
classobject.h Add PyMethod_Function(), PyMethod_Self(), PyMethod_Class() back. 2001-09-05 22:52:50 +00:00
cobject.h REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
codecs.h Changing the CNRI copyright notice according to CNRI's instructions. 2000-08-03 16:24:25 +00:00
compile.h Refactor future feature handling 2001-08-10 21:38:04 +00:00
complexobject.h Again perhaps the end of [#460020] bug or feature: unicode() and subclasses. 2001-09-12 19:12:49 +00:00
descrobject.h *EXPERIMENTAL* speedup of slot_sq_item. This sped up the following 2001-10-03 12:09:30 +00:00
dictobject.h Add PyDict_Merge(a, b, override): 2001-08-10 20:28:28 +00:00
errcode.h REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
eval.h Merge of descr-branch back into trunk. 2001-08-02 04:15:00 +00:00
fileobject.h SF bug [#460467] file objects should be subclassable. 2001-09-13 05:38:56 +00:00
floatobject.h More for SF bug [#460020] bug or feature: unicode() and subclasses 2001-09-10 21:28:20 +00:00
frameobject.h Make frames a PyVarObject instead of a PyObject. 2001-08-29 23:45:25 +00:00
funcobject.h Merge of descr-branch back into trunk. 2001-08-02 04:15:00 +00:00
graminit.h Very subtle syntax change: in a list comprehension, the testlist in 2001-10-15 15:44:05 +00:00
grammar.h REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
import.h REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
intobject.h SF bug #460020: bug or feature: unicode() and subclasses. 2001-09-10 20:52:51 +00:00
intrcheck.h REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
iterobject.h Mondo changes to the iterator stuff, without changing how Python code 2001-04-23 14:08:49 +00:00
listobject.h Introduced the oddly-missing PyList_CheckExact(), and used it to replace 2001-10-05 20:41:38 +00:00
longintrepr.h SF bug #460020: bug or feature: unicode() and subclasses. 2001-09-10 20:52:51 +00:00
longobject.h SF bug #460020: bug or feature: unicode() and subclasses. 2001-09-10 20:52:51 +00:00
marshal.h It's unclear whether PyMarshal_XXX() are part of the public or private API. 2001-01-28 00:27:39 +00:00
metagrammar.h REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
methodobject.h Remove much dead code from ceval.c 2001-08-12 21:52:24 +00:00
modsupport.h Merge of descr-branch back into trunk. 2001-08-02 04:15:00 +00:00
moduleobject.h SF bug [#460467] file objects should be subclassable. 2001-09-13 05:38:56 +00:00
node.h Use an assert() for the REQ() macro instead of making up our own 2001-10-15 17:23:13 +00:00
object.h Get rid of __defined__ and tp_defined -- there's no need to 2001-10-15 22:03:32 +00:00
objimpl.h SF bug [#467145] Python 2.2a4 build problem on HPUX 11.0. 2001-10-11 18:31:31 +00:00
opcode.h Implement PEP 238 in its (almost) full glory. 2001-08-08 05:00:18 +00:00
osdefs.h RISCOS patch by dschwertberger 2001-03-02 06:10:17 +00:00
parsetok.h Ugly. A pile of new xxxFlags() functions, to communicate to the parser 2001-07-16 05:37:24 +00:00
patchlevel.h PY_RELEASE_SERIAL => 4 2001-09-28 17:15:23 +00:00
pgenheaders.h Repair more now-obsolete references to config.h. 2001-07-26 21:34:59 +00:00
py_curses.h Check for term.h and include it on non-ncurses system to get a declaration 2001-10-13 09:12:41 +00:00
pydebug.h Add warning mode for classic division, almost exactly as specified in 2001-08-31 17:40:15 +00:00
pyerrors.h weakref.ReferenceError becomes a built-in exception now that weak ref objects 2001-10-05 21:50:08 +00:00
pyfpe.h
pygetopt.h Move our own getopt() implementation to _PyOS_GetOpt(), and use it 2000-11-03 08:18:37 +00:00
pymactoolbox.h Prototype for PyMac_GetFullPathname(). 2001-09-10 22:09:30 +00:00
pymem.h Repair more now-obsolete references to config.h. 2001-07-26 21:34:59 +00:00
pyport.h SF patch [#466353] Py_HUGE_VAL on BeOS for Intel. 2001-10-01 19:50:06 +00:00
pystate.h Add a low-level API to access interpreters, for David Beazley. 2001-07-19 12:19:27 +00:00
pythonrun.h Add warning mode for classic division, almost exactly as specified in 2001-08-31 17:40:15 +00:00
pythread.h Partial patch from SF #452266, by Jason Petrone. 2001-10-16 21:13:49 +00:00
rangeobject.h Re-add 'advanced' xrange features, adding DeprecationWarnings as discussed 2001-07-09 12:30:54 +00:00
sliceobject.h ANSI-fication and Py_PROTO extermination. 2000-07-09 00:55:06 +00:00
stringobject.h More on SF bug [#460020] bug or feature: unicode() and subclasses. 2001-09-11 01:41:59 +00:00
structmember.h Add optional docstrings to member descriptors. For backwards 2001-09-20 20:46:19 +00:00
structseq.h SF patch #462296: Add attributes to os.stat results; by Nick Mathewson. 2001-10-18 20:34:25 +00:00
symtable.h Remove st_nested_scopes from struct symtable, 2001-08-11 21:51:24 +00:00
sysmodule.h Add declarations for PySys_ResetWarnOptions() and 2000-12-15 22:01:39 +00:00
token.h Implement PEP 238 in its (almost) full glory. 2001-08-08 05:00:18 +00:00
traceback.h REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
tupleobject.h More on SF bug [#460020] bug or feature: unicode() and subclasses. 2001-09-10 23:37:46 +00:00
ucnhash.h refactored the unicodeobject/ucnhash interface, to hide the 2001-01-19 09:45:02 +00:00
unicodeobject.h SF patch #470578: Fixes to synchronize unicode() and str() 2001-10-19 02:01:31 +00:00
weakrefobject.h Remove bogus declaration. 2001-10-05 22:06:45 +00:00