diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2023-07-31 15:57:25 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-31 15:57:25 (GMT) |
commit | f66b992e27e7af534606132a48837b190db2d81c (patch) | |
tree | e3b0c3170477626712b919af33945f1bbd8b9ee0 /Lib/test | |
parent | 9f58d9ec9061f1e6ec37432b6031b7c9a580fb6c (diff) | |
download | cpython-f66b992e27e7af534606132a48837b190db2d81c.zip cpython-f66b992e27e7af534606132a48837b190db2d81c.tar.gz cpython-f66b992e27e7af534606132a48837b190db2d81c.tar.bz2 |
[3.12] gh-106368: Add test for Argument Clinic misbehaving custom converter_init() (GH-107496) (#107499)
(cherry picked from commit 2c5d206b33e4cdcafaaaf1eeaa189c10de332dc5)
Co-authored-by: Erlend E. Aasland <erlend@python.org>
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_clinic.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/Lib/test/test_clinic.py b/Lib/test/test_clinic.py index 3d74091..520cc51 100644 --- a/Lib/test/test_clinic.py +++ b/Lib/test/test_clinic.py @@ -314,6 +314,26 @@ class ClinicWholeFileTest(_ParserBase): msg = "unknown destination command 'nosuchcommand'" self.assertIn(msg, out) + def test_no_access_to_members_in_converter_init(self): + out = self.expect_failure(""" + /*[python input] + class Custom_converter(CConverter): + converter = "some_c_function" + def converter_init(self): + self.function.noaccess + [python start generated code]*/ + /*[clinic input] + module test + test.fn + a: Custom + [clinic start generated code]*/ + """) + msg = ( + "Stepped on a land mine, trying to access attribute 'noaccess':\n" + "Don't access members of self.function inside converter_init!" + ) + self.assertIn(msg, out) + class ClinicGroupPermuterTest(TestCase): def _test(self, l, m, r, output): |