Uploaded image for project: 'mod_python'
  1. mod_python
  2. MODPYTHON-189

repr() for various objects doesn't convert data members correctly.

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.3.x, 3.2.10
    • Fix Version/s: 3.3.1
    • Component/s: core
    • Labels:
      None

      Description

      The repr() methods of various objects, eg., tableobject, use code like:

      PyString_ConcatAndDel(&s, PyString_FromString("'"));
      PyString_ConcatAndDel(&s, PyString_FromString(elts[i].key));
      PyString_ConcatAndDel(&s, PyString_FromString("': '"));
      PyString_ConcatAndDel(&s, PyString_FromString(elts[i].val));
      PyString_ConcatAndDel(&s, PyString_FromString("'"));

      to construct the string. This doesn't though consider that values could have quotes in them.

      Instead of outputting quotes and string in between, should use something like:

      t = PyString_FromString(elts[i].val);
      PyString_ConcatAndDel(&s, PyObject_Repr(t));
      Py_XDECREF(t);

      Ie., let the repr() routine of the string to quote as appropriate.

      Since the repr() outputs of these objects are only used for debugging and can't be used to reconstruct objects, not too big a deal, but should be addressed.

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            Unassigned
            Reporter:
            grahamd Graham Dumpleton
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development