Title: gh-108494: Argument clinic: Improve the `parse_file()` API by AlexWaygood · Pull Request #108575 · python/cpython · GitHub
Open Graph Title: gh-108494: Argument clinic: Improve the `parse_file()` API by AlexWaygood · Pull Request #108575 · python/cpython
X Title: gh-108494: Argument clinic: Improve the `parse_file()` API by AlexWaygood · Pull Request #108575 · python/cpython
Description: Get rid of the ns argument to parse_file(); restore the verify argument that was removed in 1dd9510. Add a limited_capi argument to parse_file(). Make the limited_capi argument to both Clinic.__init__ and parse_file required, so that callers always have to be explicit about whether the limited C API is desired or not. This means that there is a "single source of truth" about what the default is, rather than this being duplicated between the global constant and the logic in the create_cli() function. Get rid of MockClinic from the test file, which was added in 1dd9510: just use our existing _make_clinic() helper function instead. With this PR, we would need to make only these changes if we wanted to change it tomorrow so that the limited C API is the default for AC-generated code (plus a few fixes to some tests that currently depend on being able to use our internal C API): diff --git a/Lib/test/test_clinic.py b/Lib/test/test_clinic.py index efc6a922c5..f4f8b2dd20 100644 --- a/Lib/test/test_clinic.py +++ b/Lib/test/test_clinic.py @@ -20,7 +20,7 @@ import clinic from clinic import DSLParser -DEFAULT_LIMITED_C_API = False +DEFAULT_LIMITED_C_API = True def _make_clinic(*, filename='clinic_tests'): diff --git a/Tools/clinic/clinic.py b/Tools/clinic/clinic.py index 2a4b6ff3b7..1a82ff7e57 100755 --- a/Tools/clinic/clinic.py +++ b/Tools/clinic/clinic.py @@ -6096,8 +6096,8 @@ def create_cli() -> argparse.ArgumentParser: cmdline.add_argument("--exclude", type=str, action="append", help=("a file to exclude in --make mode; " "can be given multiple times")) - cmdline.add_argument("--limited", dest="limited_capi", action='store_true', - help="use the Limited C API") + cmdline.add_argument("--no-limited", dest="limited_capi", action='store_false', + help="Don't use the Limited C API") cmdline.add_argument("filename", metavar="FILE", type=str, nargs="*", help="the list of files to process") return cmdline Closes #108504 Issue: gh-108494
Open Graph Description: Get rid of the ns argument to parse_file(); restore the verify argument that was removed in 1dd9510. Add a limited_capi argument to parse_file(). Make the limited_capi argument to both Clinic.__ini...
X Description: Get rid of the ns argument to parse_file(); restore the verify argument that was removed in 1dd9510. Add a limited_capi argument to parse_file(). Make the limited_capi argument to both Clinic.__ini...
Opengraph URL: https://github.com/python/cpython/pull/108575
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:83a32f34-2f30-4385-41c0-e536609398ac |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | DA56:1A30B9:2945E36:3754F5C:6992F35C |
| html-safe-nonce | 0ea81e722276b1af7ffd8df4d76c658568f7330f6d8074968c02f8c73e76f03e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQTU2OjFBMzBCOToyOTQ1RTM2OjM3NTRGNUM6Njk5MkYzNUMiLCJ2aXNpdG9yX2lkIjoiMTg0MDY2MTA3MzE1OTcxMzYyOCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | e8cdab49a3f08351bffb304d9764fa75f9d16cddc09c9125f5c4be9ce4150b60 |
| hovercard-subject-tag | pull_request:1492410102 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/python/cpython/pull/108575/files |
| twitter:image | https://avatars.githubusercontent.com/u/66076021?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/66076021?s=400&v=4 |
| og:image:alt | Get rid of the ns argument to parse_file(); restore the verify argument that was removed in 1dd9510. Add a limited_capi argument to parse_file(). Make the limited_capi argument to both Clinic.__ini... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 348cc0594c4976eb4050dc9547ecf65057ee89a2b7ed0652b983b9b539f57145 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | ce72317238c729e85014e1d867fd30d09b7f94ba |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width