mirror of
https://github.com/python/cpython.git
synced 2024-11-30 18:51:15 +01:00
6912d4ddf0
NEEDS DOC CHANGES. This one surprised me! While I expected tuple() to be a no-brainer, turns out it's actually dripping with consequences: 1. It will *allow* the popular PySequence_Fast() to work with any iterable object (code for that not yet checked in, but should be trivial). 2. It caused two std tests to fail. This because some places used PyTuple_Sequence() (the C spelling of tuple()) as an indirect way to test whether something *is* a sequence. But tuple() code only looked for the existence of sq->item to determine that, and e.g. an instance passed that test whether or not it supported the other operations tuple() needed (e.g., __len__). So some things the tests *expected* to fail with an AttributeError now fail with a TypeError instead. This looks like an improvement to me; e.g., test_coercion used to produce 559 TypeErrors and 2 AttributeErrors, and now they're all TypeErrors. The error details are more informative too, because the places calling this were *looking* for TypeErrors in order to replace the generic tuple() "not a sequence" msg with their own more specific text, and AttributeErrors snuck by that. |
||
---|---|---|
.. | ||
abstract.h | ||
bitset.h | ||
bufferobject.h | ||
cellobject.h | ||
ceval.h | ||
classobject.h | ||
cobject.h | ||
codecs.h | ||
compile.h | ||
complexobject.h | ||
config.h | ||
cStringIO.h | ||
dictobject.h | ||
errcode.h | ||
eval.h | ||
fileobject.h | ||
floatobject.h | ||
frameobject.h | ||
funcobject.h | ||
graminit.h | ||
grammar.h | ||
import.h | ||
intobject.h | ||
intrcheck.h | ||
iterobject.h | ||
listobject.h | ||
longintrepr.h | ||
longobject.h | ||
marshal.h | ||
metagrammar.h | ||
methodobject.h | ||
modsupport.h | ||
moduleobject.h | ||
node.h | ||
object.h | ||
objimpl.h | ||
opcode.h | ||
osdefs.h | ||
parsetok.h | ||
patchlevel.h | ||
pgenheaders.h | ||
py_curses.h | ||
pydebug.h | ||
pyerrors.h | ||
pyfpe.h | ||
pygetopt.h | ||
pymem.h | ||
pyport.h | ||
pystate.h | ||
Python.h | ||
pythonrun.h | ||
pythread.h | ||
rangeobject.h | ||
rename1.h | ||
sliceobject.h | ||
stringobject.h | ||
structmember.h | ||
symtable.h | ||
sysmodule.h | ||
token.h | ||
traceback.h | ||
tupleobject.h | ||
ucnhash.h | ||
unicodeobject.h |