mirror of
https://github.com/python/cpython.git
synced 2025-11-01 22:21:35 +00:00
gh-138192: Fix Context initialization so that all subinterpreters are assigned the MISSING value. (gh-138503)
--------- Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
This commit is contained in:
parent
9d6b94afe7
commit
f070f54c5f
3 changed files with 13 additions and 4 deletions
|
|
@ -2204,6 +2204,16 @@ def test_whence(self):
|
|||
whence = eval(text)
|
||||
self.assertEqual(whence, _interpreters.WHENCE_LEGACY_CAPI)
|
||||
|
||||
def test_contextvars_missing(self):
|
||||
script = f"""
|
||||
import contextvars
|
||||
print(getattr(contextvars.Token, "MISSING", "'doesn't exist'"))
|
||||
"""
|
||||
|
||||
orig = _interpreters.create()
|
||||
text = self.run_and_capture(orig, script)
|
||||
self.assertEqual(text.strip(), "<Token.MISSING>")
|
||||
|
||||
def test_is_running(self):
|
||||
def check(interpid, expected):
|
||||
with self.assertRaisesRegex(InterpreterError, 'unrecognized'):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue