mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
[Bug #1164912] Ensure Datetime wrapper class .value attribute is an 8-bit string, not a Unicode string
This commit is contained in:
parent
47a39b0112
commit
bdb3901001
2 changed files with 11 additions and 0 deletions
|
@ -76,6 +76,16 @@ class XMLRPCTestCase(unittest.TestCase):
|
|||
(newdt,), m = xmlrpclib.loads(s, use_datetime=0)
|
||||
self.assertEquals(newdt, xmlrpclib.DateTime('%sT11:41:23'%today))
|
||||
|
||||
def test_bug_1164912 (self):
|
||||
d = xmlrpclib.DateTime()
|
||||
((new_d,), dummy) = xmlrpclib.loads(xmlrpclib.dumps((d,),
|
||||
methodresponse=True))
|
||||
self.assert_(isinstance(new_d.value, str))
|
||||
|
||||
# Check that the output of dumps() is still an 8-bit string
|
||||
s = xmlrpclib.dumps((new_d,), methodresponse=True)
|
||||
self.assert_(isinstance(s, str))
|
||||
|
||||
def test_dump_big_long(self):
|
||||
self.assertRaises(OverflowError, xmlrpclib.dumps, (2L**99,))
|
||||
|
||||
|
|
|
@ -388,6 +388,7 @@ class DateTime:
|
|||
return "<DateTime %s at %x>" % (repr(self.value), id(self))
|
||||
|
||||
def decode(self, data):
|
||||
data = str(data)
|
||||
self.value = string.strip(data)
|
||||
|
||||
def encode(self, out):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue