Bug report
Bug description:
import unittest
try:
    from _testcapi import PY_SSIZE_T_MIN, PY_SSIZE_T_MAX
except ImportError:
    _testcapi = None
class CAPITest(unittest.TestCase):
    def test_new(self):
        from _testcapi import unicode_new as new
        for maxchar in (0, 97, 4096, 20320, 128512, 1114111):
            self.assertRaises(MemoryError, new, PY_SSIZE_T_MAX, maxchar)
        self.assertEqual(new(-1, 1114112), '')
if __name__ == '__main__':
    unittest.main()CPython versions tested on:
3.15
Operating systems tested on:
Linux