Uh oh!
There was an error while loading. Please reload this page.
gh-95065: Argument Clinic: Add functional tests of deprecated positionals - #107768
Conversation
…ositionals Move the "deprecated positinal" tests from clinic.test.c to _testclinic.c. Mock PY_VERSION_HEX in order to prevent the generated compiler warnings/errors to trigger. Put clinic code for deprecated positionals in Modules/clinic/_testclinic_depr_star.c.h for easy inspection of the generated code.
erlend-aasland
commented
Aug 8, 2023
The big diff is caused by moving the generated clinic code. |
Uh oh!
There was an error while loading. Please reload this page.
erlend-aasland
commented
Aug 8, 2023
@serhiy-storchaka, IMO this is better than visual inspection of the generated code. We want to prevent regressions because of future refactorings, features and bugfixes. |
AlexWaygood
commented
Aug 8, 2023
The CI currently isn't running on this PR due to merge conflicts -- I tried building with it locally, but it causes build failures on Windows: |
Uh oh!
There was an error while loading. Please reload this page.
erlend-aasland
commented
Aug 8, 2023
Does it still happen? |
| output push | ||
| destination deprstar new file '{dirname}/clinic/_testclinic_depr_star.c.h' | ||
| output everything deprstar | ||
| #output methoddef_ifndef buffer 1 |
There was a problem hiding this comment.
The output directive has a bug that prevents us from specifying the stack index. We should fix that in a separate PR.
AlexWaygood
commented
Aug 9, 2023
Nope! Builds fine locally now :) |
Uh oh!
There was an error while loading. Please reload this page.
serhiy-storchaka
left a comment
There was a problem hiding this comment.
Would not be better to use version like 100.200 to avoid rewriting tests every year?
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
erlend-aasland
commented
Aug 9, 2023
No need, we mock the version. |
serhiy-storchaka
left a comment
There was a problem hiding this comment.
Do the test fail if change the stacklevel argument in PyErr_WarnEx() from 1 to 2?
erlend-aasland
commented
Aug 9, 2023
They do not. The same filename is produced for both stack levels. |
serhiy-storchaka
commented
Aug 9, 2023
And wrong stacklevel is a common error. Even your original code did have it wrong initially. Therefore, I think it is important to check it using one of the methods I suggested above. |
erlend-aasland
commented
Aug 9, 2023
Note: we will get merge conflicts from #107808. |
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
AlexWaygood
left a comment
There was a problem hiding this comment.
I agree with Serhiy that explicitly testing the stacklevel would be good. Other than that, this is looking much better now, thanks! The readabiliy is much improved :)
AlexWaygood
left a comment
There was a problem hiding this comment.
I'm happy if Serhiy's happy!
serhiy-storchaka
left a comment
There was a problem hiding this comment.
Few nitpicks and LGTM.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
erlend-aasland
commented
Aug 10, 2023
Thank you Serhiy and Alex; this PR is in much better shape now! With this, we've got a nice framework for similar tests in place. I'll start working on what's left in clinic.test.c. |
Move the "deprecated positinal" tests from clinic.test.c to
_testclinic.c. Mock PY_VERSION_HEX in order to prevent the generated
compiler warnings/errors to trigger. Put clinic code for deprecated
positionals in Modules/clinic/_testclinic_depr_star.c.h for easy
inspection of the generated code.