diff options
author | Erlend E. Aasland <erlend@python.org> | 2023-07-31 11:50:03 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-31 11:50:03 (GMT) |
commit | 2c5d206b33e4cdcafaaaf1eeaa189c10de332dc5 (patch) | |
tree | a6dd70b82ff0c8444ffce363a1ed51dcfc963ca5 /Lib/test/test_clinic.py | |
parent | a1c737b73d3658be0e1d072a340d42e3d96373c6 (diff) | |
download | cpython-2c5d206b33e4cdcafaaaf1eeaa189c10de332dc5.zip cpython-2c5d206b33e4cdcafaaaf1eeaa189c10de332dc5.tar.gz cpython-2c5d206b33e4cdcafaaaf1eeaa189c10de332dc5.tar.bz2 |
gh-106368: Add test for Argument Clinic misbehaving custom converter_init() (#107496)
Diffstat (limited to 'Lib/test/test_clinic.py')
-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 3ce27d1..2f94f01 100644 --- a/Lib/test/test_clinic.py +++ b/Lib/test/test_clinic.py @@ -318,6 +318,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): |