[3.11] gh-106844: Fix issues in _winapi.LCMapStringEx (GH-107832) (GH-107875)

* Strings with length from 2**31-1 to 2**32-2 always caused MemoryError,
   it doesn't matter how much memory is available.
* Strings with length exactly 2**32-1 caused OSError.
* Strings longer than 2**32-1 characters were truncated due to integer overflow bug.

Now strings longer than 2**31-1 characters caused OverflowError.
(cherry picked from commit 04cc01453d)
This commit is contained in:
Serhiy Storchaka 2023-08-12 14:06:56 +03:00 committed by GitHub
parent 4ddfb04260
commit ec254c5dfa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 15 deletions

View file

@ -908,6 +908,7 @@ class PathLikeTests(NtpathTestCase):
self._check_function(self.path.normcase)
if sys.platform == 'win32':
self.assertEqual(ntpath.normcase('\u03a9\u2126'), 'ωΩ')
self.assertEqual(ntpath.normcase('abc\x00def'), 'abc\x00def')
def test_path_isabs(self):
self._check_function(self.path.isabs)