mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
[3.12] gh-106368: Add test for Argument Clinic misbehaving custom converter_init() (GH-107496) (#107499)
(cherry picked from commit 2c5d206b33
)
Co-authored-by: Erlend E. Aasland <erlend@python.org>
This commit is contained in:
parent
9f58d9ec90
commit
f66b992e27
1 changed files with 20 additions and 0 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue