diff options
author | Tim Peters <tim.peters@gmail.com> | 2001-09-14 00:25:33 +0000 |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2001-09-14 00:25:33 +0000 |
commit | 0ab085c4cba79c1743288a300425b3c9050250ba (patch) | |
tree | aa0436b634cc45a83f710bdf94289deefd540d9b /Lib/compiler/pycodegen.py | |
parent | 742dfd6f178c3880248c32d64322e2cff8cea23f (diff) | |
download | cpython-git-0ab085c4cba79c1743288a300425b3c9050250ba.tar.gz |
Changed the dict implementation to take "string shortcuts" only when
keys are true strings -- no subclasses need apply. This may be debatable.
The problem is that a str subclass may very well want to override __eq__
and/or __hash__ (see the new example of case-insensitive strings in
test_descr), but go-fast shortcuts for strings are ubiquitous in our dicts
(and subclass overrides aren't even looked for then). Another go-fast
reason for the change is that PyCheck_StringExact() is a quicker test
than PyCheck_String(), and we make such a test on virtually every access
to every dict.
OTOH, a str subclass may also be perfectly happy using the base str eq
and hash, and this change slows them a lot. But those cases are still
hypothetical, while Python's own reliance on true-string dicts is not.
Diffstat (limited to 'Lib/compiler/pycodegen.py')
0 files changed, 0 insertions, 0 deletions