mirror of
https://github.com/python/cpython.git
synced 2025-10-24 02:13:49 +00:00
[3.14] gh-135855: Raise TypeError When Passing Non-dict Object to _interpreters.set___main___attrs (gh-135900)
(cherry picked from commit 4e6f0d116, AKA gh-135856)
Co-authored-by: Brian Schubert <brianm.schubert@gmail.com>
This commit is contained in:
parent
fa74331a4c
commit
090a42b5eb
4 changed files with 29 additions and 12 deletions
|
|
@ -485,6 +485,21 @@ def test_signatures(self):
|
|||
msg = r'_interpreters.run_func\(\) argument 3 must be dict, not int'
|
||||
with self.assertRaisesRegex(TypeError, msg):
|
||||
_interpreters.run_func(self.id, lambda: None, shared=1)
|
||||
# See https://github.com/python/cpython/issues/135855
|
||||
msg = r'_interpreters.set___main___attrs\(\) argument 2 must be dict, not int'
|
||||
with self.assertRaisesRegex(TypeError, msg):
|
||||
_interpreters.set___main___attrs(self.id, 1)
|
||||
|
||||
def test_invalid_shared_none(self):
|
||||
msg = r'must be dict, not None'
|
||||
with self.assertRaisesRegex(TypeError, msg):
|
||||
_interpreters.exec(self.id, 'a', shared=None)
|
||||
with self.assertRaisesRegex(TypeError, msg):
|
||||
_interpreters.run_string(self.id, 'a', shared=None)
|
||||
with self.assertRaisesRegex(TypeError, msg):
|
||||
_interpreters.run_func(self.id, lambda: None, shared=None)
|
||||
with self.assertRaisesRegex(TypeError, msg):
|
||||
_interpreters.set___main___attrs(self.id, None)
|
||||
|
||||
def test_invalid_shared_encoding(self):
|
||||
# See https://github.com/python/cpython/issues/127196
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue