t.p.amp.AmpBox.serialize will _not_ return a string if any value is unicode
| Newsgroups | gmane.comp.python.twisted.bugs |
|---|---|
| Message-ID | <[email protected]> |
New submission from dotz <[email protected]>: If you place an unicode value in AmpBox, AmpBox.serialize will return an unicode string, not str. For example: {{{ >>> from twisted.protocols.amp import AmpBox >>> a = AmpBox(asdf = 'foo') >>> type(a.serialize()) <type 'str'> >>> a = AmpBox(asdf = u'foo') >>> type(a.serialize()) <type 'unicode'> }}} This will cause funny errors on some platforms (see #3930). This is also against AmpBox.serialize docstring, which says that it should return a str type, not unicode. {{{ def serialize(self): """ Convert me into a wire-encoded string. @return: a str encoded according to the rules described in the module docstring. """ }}} Please let me know what is the preferred way to get this fixed in trunk and I'll prepare a patch. ---------- Type : defect Component: core Keywords : Priority : normal Nosy : ---------- http://twistedmatrix.com/trac/ticket/3931