diff options
author | Guido van Rossum <guido@python.org> | 2020-06-28 00:35:05 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-28 00:35:05 (GMT) |
commit | e653369e76d7da6bcbcf1f09a141f47fb77df6c3 (patch) | |
tree | 4b49461500a8246c0d2d5e3a1a592ee72ad6ddbc /Lib/test/test_capi.py | |
parent | 749d3bc04177ff9e2ddfd58d919b84cb4f6cf894 (diff) | |
download | cpython-e653369e76d7da6bcbcf1f09a141f47fb77df6c3.zip cpython-e653369e76d7da6bcbcf1f09a141f47fb77df6c3.tar.gz cpython-e653369e76d7da6bcbcf1f09a141f47fb77df6c3.tar.bz2 |
[3.8] bpo-35975: Only use cf_feature_version if PyCF_ONLY_AST in cf_flags (#21023)
Diffstat (limited to 'Lib/test/test_capi.py')
-rw-r--r-- | Lib/test/test_capi.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/Lib/test/test_capi.py b/Lib/test/test_capi.py index 584c104..d1506bc 100644 --- a/Lib/test/test_capi.py +++ b/Lib/test/test_capi.py @@ -584,6 +584,26 @@ class SubinterpreterTest(unittest.TestCase): self.assertNotEqual(pickle.load(f), id(sys.modules)) self.assertNotEqual(pickle.load(f), id(builtins)) + def test_subinterps_recent_language_features(self): + r, w = os.pipe() + code = """if 1: + import pickle + with open({:d}, "wb") as f: + + def noop(x): return x + + a = (b := f'1{{2}}3') + noop('x') # Py 3.8 (:=) / 3.6 (f'') + + async def foo(arg): return await arg # Py 3.5 + + pickle.dump(dict(a=a, b=b), f) + """.format(w) + + with open(r, "rb") as f: + ret = support.run_in_subinterp(code) + self.assertEqual(ret, 0) + self.assertEqual(pickle.load(f), {'a': '123x', 'b': '123'}) + def test_mutate_exception(self): """ Exceptions saved in global module state get shared between |