This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: xmlrpclib.DateTime.decode() should stringify argument
Type: Stage:
Components: Library (Lib) Versions: Python 2.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: akuchling Nosy List: akuchling, asaddi
Priority: normal Keywords:

Created on 2005-03-17 00:27 by asaddi, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
xmlrpclib.diff asaddi, 2005-03-17 00:27 Patch against CVS rev 1.36 of xmlrpclib.py
Messages (2)
msg24665 - (view) Author: Allan Saddi (asaddi) Date: 2005-03-17 00:27
DateTime.decode() is allowing unicode strings to be assigned to 
self.value.

Python 2.4 (#2, Feb 17 2005, 09:44:14) 
[GCC 2.95.4 20020320 [FreeBSD]] on freebsd4
Type "help", "copyright", "credits" or "license" for more information.
>>> from xmlrpclib import *
>>> s = loads(dumps((DateTime(),), methodresponse=True))
>>> print s
((<DateTime u'20050316T16:10:20' at 81ca38c>,), None)

When this DateTime object with unicode value is subsequently 
passed to dumps(), dumps() will either return the result as a unicode 
string (which I don't believe is the correct behavior), or it will raise a 
UnicodeDecodeError.

>>> dumps(s[0])
u'<params>\n<param>\n<value><dateTime.iso8601>20050316T16:
10:20</dateTime.iso8601></value>\n</param>\n</params>\n'

(UnicodeDecodeError is raised when marshalling other unicode 
strings that do not have a simple ascii representation with the 
resultant DateTime.)
msg24666 - (view) Author: A.M. Kuchling (akuchling) * (Python committer) Date: 2005-12-04 19:13
Logged In: YES 
user_id=11375

I've added the str() call to xmlrpclib in rev41594.  Thanks
for reporting this.

History
Date User Action Args
2022-04-11 14:56:10adminsetgithub: 41709
2005-03-17 00:27:33asaddicreate