[issue13093] Redundant code in PyUnicode_EncodeDecimal()

Stefan Krah report at bugs.python.org
Wed Nov 9 19:31:24 CET 2011


Stefan Krah <stefan-usenet at bytereef.org> added the comment:

Looking at it again, the intention was probably to increment
collend so that it points to the first non-garbage character
(or '\0'). If that's the case, the loop should be something
like this:

  while (collend < end) {
      if ((0 < *collend && *collend < 256) ||
          Py_UNICODE_ISSPACE(*collend) ||
          Py_UNICODE_TODECIMAL(*collend) >= 0)
          break;
      collend++;
  }


I can understand if no one wants to touch this given that
the function is deprecated, provided that you agree that
the existing code is redundant but harmless; i.e. it cannot
enter an infinite loop.

----------

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


More information about the Python-bugs-list mailing list