[issue1820] Enhance Object/structseq.c to match namedtuple and tuple api

Raymond Hettinger report at bugs.python.org
Mon Jul 13 00:48:17 CEST 2009


Raymond Hettinger <rhettinger at users.sourceforge.net> added the comment:

In Py3.x, this fails:
    "%s.%s.%s-%s-%s" % sys.version_info

The reason is that PyUnicode_Format() expects a real tuple, not a tuple
lookalike.  The fix is to either have structseq inherit from tuple or to
modify PyUnicode_Format() to handle structseq:

   if (PyCheck_StructSeq(args)) {
      newargs = PyTuple_FromSequence(args);
      if (newargs == NULL)
          return NULL;
      result = PyUncode_Format(format, newargs);
      Py_DECREF(newargs);
      return result;
   }

----------
versions: +Python 3.2

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


More information about the Python-bugs-list mailing list