|
14 | 14 | """ |
15 | 15 |
|
16 | 16 | FOUND_UNDOCUMENTED = f"""\ |
17 | | -Found some undocumented C API! |
| 17 | +Found some undocumented C API(s)! |
18 | 18 |
|
19 | | -Python requires documentation on all public C API functions. |
| 19 | +Python requires documentation on all public C API symbols, macros, and types. |
20 | 20 | If these API(s) were not meant to be public, please prefix them with a |
21 | 21 | leading underscore (_PySomething_API) or move them to the internal C API |
22 | 22 | (pycore_*.h files). |
@@ -144,20 +144,19 @@ def main() -> None: |
144 | 144 | all_missing += missing |
145 | 145 |
|
146 | 146 | fail = False |
147 | | - if all_missing != []: |
148 | | - s = "s" if len(all_missing) != 1 else "" |
149 | | - print(f"-- {len(all_missing)} missing C API{s} --") |
150 | | - for name in all_missing: |
151 | | - print(f" - {name}") |
152 | | - print(FOUND_UNDOCUMENTED) |
153 | | - fail = True |
| 147 | + to_check = [ |
| 148 | + (all_missing, "missing", FOUND_UNDOCUMENTED), |
| 149 | + (all_found_ignored, "documented but ignored", FOUND_IGNORED_DOCUMENTED), |
| 150 | + ] |
| 151 | + for name_list, what, message in to_check: |
| 152 | + if not name_list: |
| 153 | + continue |
154 | 154 |
|
155 | | - if all_found_ignored != []: |
156 | | - s = "s" if len(all_found_ignored) != 1 else "" |
157 | | - print(f"-- Found {len(all_found_ignored)} documented but ignored C API{s} --") |
158 | | - for name in all_found_ignored: |
| 155 | + s = "s" if len(name_list) != 1 else "" |
| 156 | + print(f"-- {len(name_list)} {what} C API{s} --") |
| 157 | + for name in all_missing: |
159 | 158 | print(f" - {name}") |
160 | | - print(FOUND_IGNORED_DOCUMENTED) |
| 159 | + print(message) |
161 | 160 | fail = True |
162 | 161 |
|
163 | 162 | sys.exit(1 if fail else 0) |
|
0 commit comments