[issue19512] Avoid temporary Unicode strings, use identifiers to only create the string once

STINNER Victor report at bugs.python.org
Thu Nov 7 14:10:30 CET 2013


STINNER Victor added the comment:

>> Errors become more unlikely because objects are only initialized once, near startup. So it put also less pressure on code handling errors :) (it is usually the least tested part of the code)

> If there are bugs in code handling errors, they should be fixed in maintenance releases too.

Well, using identifiers doesn't solve directly all issues. For example, _PyDict_GetItemId() should be replaced with _PyDict_GetItemIdWithError() to be complelty safe. It just reduces the probability of bugs.

Using identifiers might add regressions for a minor gain (handling MemoryError better). As I did for issues #18048 and #19437 (related to issues found by failmalloc), I prefer to not backport such minor bugfixes to not risk a regression.

> You changed hundreds lines of code for speed up interactive mode by perhaps several microseconds.

Again, performance is not the main motivation, please read again msg202293. Or maybe you disagree with this message?

Sorry, I didn't explain my changes in first messages of this issue. I created the issue to group my changesets to an issue, to explain why I did them. I didn't expect any discussion :-) But thank you for all your remarks.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19512>
_______________________________________


More information about the Python-bugs-list mailing list