diff --git a/Tools/scripts/patchcheck.py b/Tools/scripts/patchcheck.py --- a/Tools/scripts/patchcheck.py +++ b/Tools/scripts/patchcheck.py @@ -148,6 +148,18 @@ def regenerated_pyconfig_h_in(file_paths else: return "not needed" +@status("Files with argument clinic comments changed", modal=True) +def argument_clinic_files_modified(file_paths): + """Check if files containing clinic comments have been modified.""" + for path in file_paths: + abspath = os.path.join(SRCDIR, path) + try: + with open(abspath, 'rb') as f: + lines = f.readlines() + return any([b"[clinic input]" in line for line in lines]) + except Exception as err: + print('Cannot fix %s: %s' % (path, err)) + def main(): file_paths = changed_files() python_files = [fn for fn in file_paths if fn.endswith('.py')] @@ -171,6 +183,8 @@ def main(): regenerated_configure(file_paths) # Regenerated pyconfig.h.in, if necessary. regenerated_pyconfig_h_in(file_paths) + # Sources files with argument clinic comments modified. + argument_clinic_files_modified(c_files) # Test suite run and passed. if python_files or c_files: