mirror of
https://github.com/python/cpython.git
synced 2025-08-22 17:55:18 +00:00
Rename buffer -> bytearray.
This commit is contained in:
parent
905a904723
commit
254348e201
31 changed files with 290 additions and 290 deletions
|
@ -1093,7 +1093,7 @@ class TestDate(HarmlessMixedComparison, unittest.TestCase):
|
|||
self.assertEqual(orig, derived)
|
||||
|
||||
def test_backdoor_resistance(self):
|
||||
# For fast unpickling, the constructor accepts a pickle string.
|
||||
# For fast unpickling, the constructor accepts a pickle byte string.
|
||||
# This is a low-overhead backdoor. A user can (by intent or
|
||||
# mistake) pass a string directly, which (if it's the right length)
|
||||
# will get treated like a pickle, and bypass the normal sanity
|
||||
|
@ -1101,17 +1101,17 @@ class TestDate(HarmlessMixedComparison, unittest.TestCase):
|
|||
# The constructor doesn't want to burn the time to validate all
|
||||
# fields, but does check the month field. This stops, e.g.,
|
||||
# datetime.datetime('1995-03-25') from yielding an insane object.
|
||||
base = '1995-03-25'
|
||||
base = b'1995-03-25'
|
||||
if not issubclass(self.theclass, datetime):
|
||||
base = base[:4]
|
||||
for month_byte in '9', chr(0), chr(13), '\xff':
|
||||
for month_byte in b'9', b'\0', b'\r', b'\xff':
|
||||
self.assertRaises(TypeError, self.theclass,
|
||||
base[:2] + month_byte + base[3:])
|
||||
for ord_byte in range(1, 13):
|
||||
# This shouldn't blow up because of the month byte alone. If
|
||||
# the implementation changes to do more-careful checking, it may
|
||||
# blow up because other fields are insane.
|
||||
self.theclass(buffer(base[:2] + chr(ord_byte) + base[3:], "ascii"))
|
||||
self.theclass(base[:2] + bytes([ord_byte]) + base[3:])
|
||||
|
||||
#############################################################################
|
||||
# datetime tests
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue