Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-104389: Add 'unused' keyword to Argument Clinic C converters #104390

Merged
merged 5 commits into from
May 12, 2023

Conversation

erlend-aasland
Copy link
Contributor

@erlend-aasland erlend-aasland commented May 11, 2023

Use the unused keyword param in the converter to explicitly
mark an argument as unused:

/*[clinic input]
BaseClass.interface
    flag: bool(unused=True)

📚 Documentation preview 📚: https://cpython-previews--104390.org.readthedocs.build/

Use the unused keyword param in the converter to explicitly
mark an argument as unused:

    /*[clinic input]
    BaseClass.interface
        flag: bool(unused=True)
@erlend-aasland
Copy link
Contributor Author

The _io change is to show the feature; we can revert it before landing.

Copy link
Member

@corona10 corona10 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@erlend-aasland erlend-aasland changed the title gh-104389: Argument Clinic now wraps unused args with Py_UNUSED gh-104389: Add 'unused' keyword to Argument Clinic C converters May 11, 2023
@vstinner
Copy link
Member

Do you have at least one use case for this addition?

Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. It would be nice to have directly an user of this feature, but I'm fine with adding support for it, and later have a separated PR using it. I see where you will use it in the _io extension ;-)

@erlend-aasland
Copy link
Contributor Author

LGTM. It would be nice to have directly an user of this feature, but I'm fine with adding support for it, and later have a separated PR using it. I see where you will use it in the _io extension ;-)

Yes, I'll create PRs for usage quite soon :)

Anyway, I got two approvals here, a couple of thumbs up on the PR, five likes on the Discourse topic. I'll land this soon.

@erlend-aasland erlend-aasland merged commit b2c1b4d into python:main May 12, 2023
@erlend-aasland erlend-aasland deleted the clinic-unused branch May 12, 2023 08:34
@erlend-aasland erlend-aasland linked an issue May 12, 2023 that may be closed by this pull request
@erlend-aasland
Copy link
Contributor Author

LGTM. It would be nice to have directly an user of this feature, but I'm fine with adding support for it, and later have a separated PR using it. I see where you will use it in the _io extension ;-)

PR for _io usage:

@bedevere-bot
Copy link

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot AMD64 Debian root 3.x has failed when building commit b2c1b4d.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/all/#builders/345/builds/4762) and take a look at the build logs.
  4. Check if the failure is related to this commit (b2c1b4d) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/all/#builders/345/builds/4762

Failed tests:

  • test_threading
  • test_multiprocessing_forkserver

Summary of the results of the build (if available):

==

Click to see traceback logs
remote: Enumerating objects: 46, done.        
remote: Counting objects:   2% (1/46)        
remote: Counting objects:   4% (2/46)        
remote: Counting objects:   6% (3/46)        
remote: Counting objects:   8% (4/46)        
remote: Counting objects:  10% (5/46)        
remote: Counting objects:  13% (6/46)        
remote: Counting objects:  15% (7/46)        
remote: Counting objects:  17% (8/46)        
remote: Counting objects:  19% (9/46)        
remote: Counting objects:  21% (10/46)        
remote: Counting objects:  23% (11/46)        
remote: Counting objects:  26% (12/46)        
remote: Counting objects:  28% (13/46)        
remote: Counting objects:  30% (14/46)        
remote: Counting objects:  32% (15/46)        
remote: Counting objects:  34% (16/46)        
remote: Counting objects:  36% (17/46)        
remote: Counting objects:  39% (18/46)        
remote: Counting objects:  41% (19/46)        
remote: Counting objects:  43% (20/46)        
remote: Counting objects:  45% (21/46)        
remote: Counting objects:  47% (22/46)        
remote: Counting objects:  50% (23/46)        
remote: Counting objects:  52% (24/46)        
remote: Counting objects:  54% (25/46)        
remote: Counting objects:  56% (26/46)        
remote: Counting objects:  58% (27/46)        
remote: Counting objects:  60% (28/46)        
remote: Counting objects:  63% (29/46)        
remote: Counting objects:  65% (30/46)        
remote: Counting objects:  67% (31/46)        
remote: Counting objects:  69% (32/46)        
remote: Counting objects:  71% (33/46)        
remote: Counting objects:  73% (34/46)        
remote: Counting objects:  76% (35/46)        
remote: Counting objects:  78% (36/46)        
remote: Counting objects:  80% (37/46)        
remote: Counting objects:  82% (38/46)        
remote: Counting objects:  84% (39/46)        
remote: Counting objects:  86% (40/46)        
remote: Counting objects:  89% (41/46)        
remote: Counting objects:  91% (42/46)        
remote: Counting objects:  93% (43/46)        
remote: Counting objects:  95% (44/46)        
remote: Counting objects:  97% (45/46)        
remote: Counting objects: 100% (46/46)        
remote: Counting objects: 100% (46/46), done.        
remote: Compressing objects:   4% (1/22)        
remote: Compressing objects:   9% (2/22)        
remote: Compressing objects:  13% (3/22)        
remote: Compressing objects:  18% (4/22)        
remote: Compressing objects:  22% (5/22)        
remote: Compressing objects:  27% (6/22)        
remote: Compressing objects:  31% (7/22)        
remote: Compressing objects:  36% (8/22)        
remote: Compressing objects:  40% (9/22)        
remote: Compressing objects:  45% (10/22)        
remote: Compressing objects:  50% (11/22)        
remote: Compressing objects:  54% (12/22)        
remote: Compressing objects:  59% (13/22)        
remote: Compressing objects:  63% (14/22)        
remote: Compressing objects:  68% (15/22)        
remote: Compressing objects:  72% (16/22)        
remote: Compressing objects:  77% (17/22)        
remote: Compressing objects:  81% (18/22)        
remote: Compressing objects:  86% (19/22)        
remote: Compressing objects:  90% (20/22)        
remote: Compressing objects:  95% (21/22)        
remote: Compressing objects: 100% (22/22)        
remote: Compressing objects: 100% (22/22), done.        
remote: Total 25 (delta 20), reused 7 (delta 3), pack-reused 0        
From https://github.com/python/cpython
 * branch                  main       -> FETCH_HEAD
Note: switching to 'b2c1b4da1935639cb89fbbad0ce170a1182537bd'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at b2c1b4da19 gh-104389: Add 'unused' keyword to Argument Clinic C converters (#104390)
Switched to and reset branch 'main'

configure: WARNING: pkg-config is missing. Some dependencies may not be detected correctly.

Fatal Python error: Segmentation fault

Thread 0x00007f974f0fa280 (most recent call first):
  File "/root/buildarea/3.x.angelico-debian-amd64/build/Lib/unittest/runner.py", line 74 in _write_status
  File "/root/buildarea/3.x.angelico-debian-amd64/build/Lib/unittest/runner.py", line 95 in addSuccess
  File "/root/buildarea/3.x.angelico-debian-amd64/build/Lib/test/support/testresult.py", line 122 in addSuccess
  File "/root/buildarea/3.x.angelico-debian-amd64/build/Lib/unittest/case.py", line 648 in run
  File "/root/buildarea/3.x.angelico-debian-amd64/build/Lib/unittest/case.py", line 690 in __call__
  File "/root/buildarea/3.x.angelico-debian-amd64/build/Lib/unittest/suite.py", line 122 in run
  File "/root/buildarea/3.x.angelico-debian-amd64/build/Lib/unittest/suite.py", line 84 in __call__
  File "/root/buildarea/3.x.angelico-debian-amd64/build/Lib/unittest/suite.py", line 122 in run
  File "/root/buildarea/3.x.angelico-debian-amd64/build/Lib/unittest/suite.py", line 84 in __call__
  File "/root/buildarea/3.x.angelico-debian-amd64/build/Lib/unittest/suite.py", line 122 in run
  File "/root/buildarea/3.x.angelico-debian-amd64/build/Lib/unittest/suite.py", line 84 in __call__
  File "/root/buildarea/3.x.angelico-debian-amd64/build/Lib/unittest/runner.py", line 240 in run
  File "/root/buildarea/3.x.angelico-debian-amd64/build/Lib/test/support/__init__.py", line 1106 in _run_suite
  File "/root/buildarea/3.x.angelico-debian-amd64/build/Lib/test/support/__init__.py", line 1232 in run_unittest
  File "/root/buildarea/3.x.angelico-debian-amd64/build/Lib/test/libregrtest/runtest.py", line 294 in _test_module
  File "/root/buildarea/3.x.angelico-debian-amd64/build/Lib/test/libregrtest/runtest.py", line 330 in _runtest_inner2
  File "/root/buildarea/3.x.angelico-debian-amd64/build/Lib/test/libregrtest/runtest.py", line 373 in _runtest_inner
  File "/root/buildarea/3.x.angelico-debian-amd64/build/Lib/test/libregrtest/runtest.py", line 248 in _runtest
  File "/root/buildarea/3.x.angelico-debian-amd64/build/Lib/test/libregrtest/runtest.py", line 278 in runtest
  File "/root/buildarea/3.x.angelico-debian-amd64/build/Lib/test/libregrtest/main.py", line 365 in rerun_failed_tests
  File "/root/buildarea/3.x.angelico-debian-amd64/build/Lib/test/libregrtest/main.py", line 783 in _main
  File "/root/buildarea/3.x.angelico-debian-amd64/build/Lib/test/libregrtest/main.py", line 738 in main
  File "/root/buildarea/3.x.angelico-debian-amd64/build/Lib/test/libregrtest/main.py", line 802 in main
  File "/root/buildarea/3.x.angelico-debian-amd64/build/Lib/test/__main__.py", line 2 in <module>
  File "/root/buildarea/3.x.angelico-debian-amd64/build/Lib/runpy.py", line 88 in _run_code
  File "/root/buildarea/3.x.angelico-debian-amd64/build/Lib/runpy.py", line 198 in _run_module_as_main

Extension modules: _testcapi (total: 1)
Segmentation fault
make: *** [Makefile:1956: buildbottest] Error 139

Cannot open file '/root/buildarea/3.x.angelico-debian-amd64/build/test-results.xml' for upload

carljm added a commit to carljm/cpython that referenced this pull request May 12, 2023
* main:
  pythongh-91896: Fixup some docs issues following ByteString deprecation (python#104422)
  pythonGH-104371: check return value of calling `mv.release` (python#104417)
  pythongh-104415: Fix refleak tests for `typing.ByteString` deprecation (python#104416)
  pythonGH-86275: Implementation of hypothesis stubs for property-based tests, with zoneinfo tests (python#22863)
  pythonGH-103082: Filter LINE events in VM, to simplify tool implementation. (pythonGH-104387)
  pythongh-93649: Split gc- and allocation tests from _testcapimodule.c (pythonGH-104403)
  pythongh-104389: Add 'unused' keyword to Argument Clinic C converters (python#104390)
  pythongh-101819: Prepare _io._IOBase for module state (python#104386)
  pythongh-104413: Fix refleak when super attribute throws AttributeError (python#104414)
  Fix refleak in `super_descr_get` (python#104408)
  pythongh-87526: Remove dead initialization from _zoneinfo parse_abbr() (python#24700)
  pythongh-91896: Improve visibility of `ByteString` deprecation warnings (python#104294)
  pythongh-104371: Fix calls to `__release_buffer__` while an exception is active (python#104378)
  pythongh-104377: fix cell in comprehension that is free in outer scope (python#104394)
  pythongh-104392: Remove _paramspec_tvars from typing (python#104393)
  pythongh-104396: uuid.py to skip platform check for emscripten and wasi (pythongh-104397)
  pythongh-99108: Refresh HACL* from upstream (python#104401)
  pythongh-104301: Allow leading whitespace in disambiguated pdb statements (python#104342)
erlend-aasland added a commit to erlend-aasland/devguide that referenced this pull request Sep 8, 2023
…erters (python/cpython#104390)

Use the unused keyword param in the converter to explicitly
mark an argument as unused:

    /*[clinic input]
    SomeBaseClass.stubmethod
        flag: bool(unused=True)
    [clinic start generated code]*/
AA-Turner pushed a commit to AA-Turner/devguide that referenced this pull request Sep 13, 2023
…erters (python/cpython#104390)

Use the unused keyword param in the converter to explicitly
mark an argument as unused:

    /*[clinic input]
    SomeBaseClass.stubmethod
        flag: bool(unused=True)
    [clinic start generated code]*/
erlend-aasland added a commit to python/devguide that referenced this pull request Sep 26, 2023
…erters (python/cpython#104390)

Use the unused keyword param in the converter to explicitly
mark an argument as unused:

    /*[clinic input]
    SomeBaseClass.stubmethod
        flag: bool(unused=True)
    [clinic start generated code]*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make it possible to mark Argument Clinic args as unused
4 participants