[Python-3000-checkins] r58650 - python/branches/py3k/Lib/test/test_codeccallbacks.py

Georg Brandl g.brandl at gmx.net
Thu Nov 22 15:23:50 CET 2007


Guido van Rossum schrieb:
> I was looking at this too. The root cause of the test failure is that
> unicode_translate() calls PyDict_Copy() on its argument dict, and then
> modifies the copy to add extra keys. This seems awfully expensive.
> Isn't there another way? (I'm imagining that often the dict is rather
> large and the string rather short...)

I added that dict copy in order to make translate() more robust.
It used to directly call PyUnicode_TranslateCharmap which simply
ignores invalid entries and only accepts ordinals as keys, while
allowing ordinals and strings as values. Both these points made
its behavior confusing enough to warrant some extra comfort.

Georg



More information about the Python-3000-checkins mailing list