mirror of
https://github.com/python/cpython.git
synced 2025-08-10 03:49:18 +00:00
[3.12] gh-127903: Fix a crash on debug builds when calling Objects/unicodeobject::_copy_characters
(GH-127876) (#128459)
gh-127903: Fix a crash on debug builds when calling `Objects/unicodeobject::_copy_characters`` (GH-127876)
(cherry picked from commit 46cb6340d7
)
Co-authored-by: Alexander Shadchin <shadchin@yandex-team.com>
This commit is contained in:
parent
d9e199b491
commit
e44045924d
3 changed files with 15 additions and 3 deletions
|
@ -7,6 +7,7 @@ Written by Marc-Andre Lemburg (mal@lemburg.com).
|
|||
"""
|
||||
import _string
|
||||
import codecs
|
||||
import datetime
|
||||
import itertools
|
||||
import operator
|
||||
import pickle
|
||||
|
@ -1921,6 +1922,12 @@ class UnicodeTest(string_tests.CommonTest,
|
|||
self.assertRaises(UnicodeDecodeError,
|
||||
(b'\xF4'+cb+b'\xBF\xBF').decode, 'utf-8')
|
||||
|
||||
def test_issue127903(self):
|
||||
# gh-127903: ``_copy_characters`` crashes on DEBUG builds when
|
||||
# there is nothing to copy.
|
||||
d = datetime.datetime(2013, 11, 10, 14, 20, 59)
|
||||
self.assertEqual(d.strftime('%z'), '')
|
||||
|
||||
def test_issue8271(self):
|
||||
# Issue #8271: during the decoding of an invalid UTF-8 byte sequence,
|
||||
# only the start byte and the continuation byte(s) are now considered
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue