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

[3.12] gh-107609: Fix duplicate module check in Argument Clinic (GH-107610) by miss-islington · Pull Request #107612 · python/cpython · GitHub

/ cpython Public
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .c  (1) .py  (2) .rst  (1) All 3 file types 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
10 changes: 10 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 @@ -334,6 +334,16 @@ def converter_init(self):
)
self.assertIn(msg, out)

def test_module_already_got_one(self):
err = "Already defined module 'm'!"
block = """
/*[clinic input]
module m
module m
[clinic start generated code]*/
"""
self.expect_failure(block, err, lineno=3)


class ClinicGroupPermuterTest(TestCase):
def _test(self, l, m, r, output):
Expand Down
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
@@ -0,0 +1,3 @@
Fix duplicate module check in Argument Clinic. Previously, a duplicate
definition would incorrectly be silently accepted. Patch by Erlend E.
Aasland.
3 changes: 1 addition & 2 deletions Modules/_testcapi/vectorcall.c
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 @@ -157,10 +157,9 @@ VectorCallClass_vectorcall(PyObject *callable,
}

/*[clinic input]
module _testcapi
class _testcapi.VectorCallClass "PyObject *" "&PyType_Type"
[clinic start generated code]*/
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=8423a8e919f2f0df]*/
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=95c63c1a47f9a995]*/

/*[clinic input]
_testcapi.VectorCallClass.set_vectorcall
Expand Down
2 changes: 1 addition & 1 deletion Tools/clinic/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 @@ -4324,7 +4324,7 @@ def directive_module(self, name: str) -> None:
if cls:
fail("Can't nest a module inside a class!")

if name in module.classes:
if name in module.modules:
fail("Already defined module " + repr(name) + "!")

m = Module(name, module)
Expand Down

Back | FazBrowse Home | New Git URL