mirror of
https://github.com/python/cpython.git
synced 2025-08-01 07:33:08 +00:00
[3.13] gh-132171: Fix _interpreters.run_string
crash on string subclass (GH-132173) (#132219)
gh-132171: Fix `_interpreters.run_string` crash on string subclass (GH-132173)
(cherry picked from commit 3980718710
)
Co-authored-by: sobolevn <mail@sobolevn.me>
This commit is contained in:
parent
71b537572a
commit
6afab81f72
3 changed files with 8 additions and 1 deletions
|
@ -745,6 +745,12 @@ class RunStringTests(TestBase):
|
|||
with self.assertRaises(TypeError):
|
||||
_interpreters.run_string(self.id, b'print("spam")')
|
||||
|
||||
def test_str_subclass_string(self):
|
||||
class StrSubclass(str): pass
|
||||
|
||||
output = _run_output(self.id, StrSubclass('print(1 + 2)'))
|
||||
self.assertEqual(output, '3\n')
|
||||
|
||||
def test_with_shared(self):
|
||||
r, w = os.pipe()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue