GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Improve the readability and maintainability of test_capi using the AC · Issue #104469 · python/cpython

Improve the readability and maintainability of test_capi using the AC #104469

New issue
Copy link
New issue
Copy link
Closed
Closed
Improve the readability and maintainability of test_capi using the AC#104469
Copy link
Labels
testsTests in the Lib/test dirTests in the Lib/test dirtopic-C-API

Description

@corona10
corona10
opened on May 14, 2023
Issue body actions

Currently, most of test_capi modules do not use the Argument Clinic tool.
As a result, we manually implement docstrings containing explanations for the test codes and handle parameter parsing manually: PyArg_ParseTuple .
To maintain code consistency in test_capi, I suggest using the Argument Clinic tool.

While some might criticize this as code churn, I believe it is necessary for maintaining consistent test code writing practices. I will attach a sample PR to illustrate how it can help improve the understanding of the test code. I hope this will help clarify the rationale behind it.

cc @erlend-aasland @sobolevn

Linked PRs

  • gh-104469 Convert _testcapi/float.c to use AC #104470
  • gh-104469 Convert _testcapi/exceptions to use AC #104502
  • gh-104469: Convert _testcapi/watchers.c to use AC #104503
  • gh-104469: Update README.txt for _testcapi #104529
  • gh-104469: Convert _testcapi/long to use AC #104720
  • gh-104469 Convert_testcapi/vectorcall.c to use AC #106557
  • gh-104469 : Convert _testcapi/vectorcall_limited.c to use AC #107857
  • gh-104469 : Convert _testcapi/dict.c to use AC #107859
  • gh-104469 : Convert _testcapi/mem.c to use AC #107860
  • Revert "gh-104469 : Convert _testcapi/vectorcall_limited.c to use AC … #107951
  • gh-104469 Fix limited C API issue for WASI #107953
  • gh-104469: Disallow using Py_LIMITED_API with Py_BUILD_CORE #109690
  • gh-104469: Convert _testcapi/vectorcall_limited.c to use AC #109691
Reacted by sunmy2019, Oleg Iarygin, Erlend E. Aasland and 길재은
Reacted by 길재은

Activity

Next
  1. corona10
    added
    testsTests in the Lib/test dirTests in the Lib/test dir
    topic-C-API
    on May 14, 2023
  2. corona10
    added a commit that references this issue on May 14, 2023

    pythongh-104469 Convert _testcapi/flaot.c to use AC

    f0ce379
  3. corona10
    changed the title [-]Improve the readability and maintainability of test_capi using the Argument Clinic tool[/-] [+]Improve the readability and maintainability of test_capi using the AC[/+] on May 14, 2023
  4. corona10
    added a commit that references this issue on May 14, 2023

    pythongh-104469 Convert _testcapi/flaot.c to use AC

    f7f249c
  5. sunmy2019 commented on May 14, 2023

    @sunmy2019
    sunmy2019
    on May 14, 2023
    Member
    More actions

    LGTM

  6. corona10
    added a commit that references this issue on May 15, 2023

    gh-104469 Convert _testcapi/float.c to use AC (gh-104470)

    48b3617
  7. corona10 commented on May 15, 2023

    @corona10
    corona10
    on May 15, 2023
    MemberAuthor
    More actions

    I am working on test_exceptions.

    Reacted by Erlend E. Aasland
  8. corona10
    added a commit that references this issue on May 15, 2023

    pythongh-104469 Convert _testcapi/exceptions to use AC

    4912e14
  9. sobolevn commented on May 15, 2023

    @sobolevn
    sobolevn
    on May 15, 2023
    Member
    More actions

    I am working on _testcapi/watchers.c 👍

    Reacted by Erlend E. Aasland
  10. sobolevn
    added a commit that references this issue on May 15, 2023

    pythongh-104469: Convert _testcapi/watchers.c to use AC

    559d74f
  11. erlend-aasland commented on May 15, 2023

    @erlend-aasland
    erlend-aasland
    on May 15, 2023
    Contributor
    More actions

    Let's establish some guidelines:

    • For the sake of readability (which is one of the goals here), please add a newline between the argument spec and the docstring
    • If purpose is obvious given a function name, omit the docstring
    • If a description is needed, make sure the added docstring clearly and succinctly describes purpose of the function
    • DRY, use the clone feature of Argument Clinic
    • Try to avoid adding new interned strings; reuse existing parameter names if possible and use the as feature to override the C name

    cc. @sobolevn @corona10

    Reacted by sobolevn and Donghee Na
  12. sobolevn commented on May 15, 2023

    @sobolevn
    sobolevn
    on May 15, 2023
    Member
    More actions

    Agreed, updated my PR.

  13. corona10 commented on May 15, 2023

    @corona10
    corona10
    on May 15, 2023
    MemberAuthor
    More actions

    Let's establish some guidelines:

    +1, Super great
    Update README.txt? (I prefer to update it to README.md either)
    or publish it to https://devguide.python.org/developer-workflow/c-api/#c-api here?

  14. carljm
    added a commit that references this issue on May 15, 2023

    Merge branch 'main' into supermon

    343867a
  15. 23 remaining items

  16. corona10
    added 4 commits that reference this issue on Aug 14, 2023

    Revert "pythongh-104469 : Convert _testcapi/vectorcall_limited.c to u…

    26ba468

    pythongh-104469 Fix limited C API issue for WASI

    b1aefa6

    pythongh-104469 Fix limited C API issue for WASI

    4ce1852

    Revert "gh-104469 : Convert _testcapi/vectorcall_limited.c to use AC … (

    580f357
  17. iritkatriel
    added a commit that references this issue on Aug 16, 2023

    Revert "pythongh-104469 : Convert _testcapi/vectorcall_limited.c to u…

    2237015
  18. vstinner
    added 6 commits that reference this issue on Sep 21, 2023

    pythongh-104469: Disallow using Py_LIMITED_API with Py_BUILD_CORE

    efd60c0

    pythongh-104469: Disallow using Py_LIMITED_API with Py_BUILD_CORE

    e2a7d7f

    pythongh-104469: Convert _testcapi/vectorcall_limited.c to use AC

    8004d79

    pythongh-104469: Disallow using Py_LIMITED_API with Py_BUILD_CORE

    3dcbb46

    gh-104469: Disallow using Py_LIMITED_API with Py_BUILD_CORE (#109690)

    3f5c564

    gh-104469: Convert _testcapi/vectorcall_limited.c to use AC (#109691)

    8c521f0
  19. csm10495
    added 2 commits that reference this issue on Sep 28, 2023

    pythongh-104469: Disallow using Py_LIMITED_API with Py_BUILD_CORE (py…

    c91677e

    pythongh-104469: Convert _testcapi/vectorcall_limited.c to use AC (py…

    4ede466
  20. Glyphack
    added 2 commits that reference this issue on Sep 2, 2024

    pythongh-104469: Disallow using Py_LIMITED_API with Py_BUILD_CORE (py…

    06c6027

    pythongh-104469: Convert _testcapi/vectorcall_limited.c to use AC (py…

    062b6c5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    testsTests in the Lib/test dirTests in the Lib/test dirtopic-C-API

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.