Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f66b992

Browse filesBrowse files
[3.12] gh-106368: Add test for Argument Clinic misbehaving custom converter_init() (GH-107496) (#107499)
(cherry picked from commit 2c5d206) Co-authored-by: Erlend E. Aasland <erlend@python.org>
1 parent 9f58d9e commit f66b992
Copy full SHA for f66b992

File tree

Expand file treeCollapse file tree

1 file changed

+20
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+20
-0
lines changed

‎Lib/test/test_clinic.py

Copy file name to clipboardExpand all lines: Lib/test/test_clinic.py
+20Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,26 @@ def test_unknown_destination_command(self):
314314
msg = "unknown destination command 'nosuchcommand'"
315315
self.assertIn(msg, out)
316316

317+
def test_no_access_to_members_in_converter_init(self):
318+
out = self.expect_failure("""
319+
/*[python input]
320+
class Custom_converter(CConverter):
321+
converter = "some_c_function"
322+
def converter_init(self):
323+
self.function.noaccess
324+
[python start generated code]*/
325+
/*[clinic input]
326+
module test
327+
test.fn
328+
a: Custom
329+
[clinic start generated code]*/
330+
""")
331+
msg = (
332+
"Stepped on a land mine, trying to access attribute 'noaccess':\n"
333+
"Don't access members of self.function inside converter_init!"
334+
)
335+
self.assertIn(msg, out)
336+
317337

318338
class ClinicGroupPermuterTest(TestCase):
319339
def _test(self, l, m, r, output):

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.