FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-106368: Add test for Argument Clinic misbehaving custom converter_init() by erlend-aasland · Pull Request #107496 · python/cpython · GitHub

/ cpython Public
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
20 changes: 20 additions & 0 deletions Lib/test/test_clinic.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,26 @@ def test_unknown_destination_command(self):
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):
Expand Down

Back | FazBrowse Home | New Git URL