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 — gh-106368: Argument Clinic: Add tests for cloned functions with custom C base names by erlend-aasland · Pull Request #107977 · python/cpython

Conversation

@erlend-aasland

@erlend-aasland erlend-aasland commented Aug 15, 2023 •
edited by bedevere-bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor
  • Issue: Increase Argument Clinic test coverage #106368

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@erlend-aasland
pythongh-106368: Argument Clinic: Add test for cloned function with c…
b7851c3
…ustom C base name
@erlend-aasland
erlend-aasland requested a review from AlexWaygood as a code owner August 15, 2023 14:23
@erlend-aasland erlend-aasland added the skip news label Aug 15, 2023
@bedevere-bot bedevere-bot added the awaiting core review label Aug 15, 2023
@bedevere-bot bedevere-bot mentioned this pull request Aug 15, 2023
Increase Argument Clinic test coverage #106368
Closed
@bedevere-bot bedevere-bot added the tests Tests in the Lib/test dir label Aug 15, 2023
@erlend-aasland erlend-aasland mentioned this pull request Aug 15, 2023
gh-104683: Argument Clinic: Extract parse_function_names() helper #107964
Merged
@erlend-aasland
Pull in main
a5e4bfe
AlexWaygood
AlexWaygood reviewed Aug 15, 2023
View reviewed changes

@AlexWaygood AlexWaygood left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

There is still one case in this block that is untested:

cpython/Tools/clinic/clinic.py

Lines 4888 to 4890 in e28b0dc

if (is_legal_py_identifier(full_name) and
(not c_basename or is_legal_c_identifier(c_basename)) and
is_legal_py_identifier(existing)):

What if is_legal_py_identifier(full_name) evaluates to True, not c_basename evaluates to False, is_legal_c_identifier(c_basename) evaluates to False and is_legal_py_identifier(existing) evaluates to True?

I.e., if I apply this diff to your PR branch, the assertion is never triggered:

-            if (is_legal_py_identifier(full_name) and
-                (not c_basename or is_legal_c_identifier(c_basename)) and
-                is_legal_py_identifier(existing)):
+            if is_legal_py_identifier(full_name) and is_legal_py_identifier(existing):
+                if c_basename:
+                    assert is_legal_c_identifier(c_basename)

...Could you also add a test with a cloned function with a custom C base name where the custom C base name is not a legal C identifier?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@AlexWaygood

AlexWaygood commented Aug 15, 2023

Copy link
Copy Markdown
Member

I'm getting warnings about the execution environment when I'm running python -m test test_clinic -v with this PR branch locally, btw:

Ran 243 tests in 0.620s

OK
Warning -- files was modified by test_clinic
Warning --   Before: []
Warning --   After:  ['clinic/']
Warning -- files was modified by test_clinic
Warning --   Before: []
Warning --   After:  ['clinic/']
test_clinic failed (env changed)

== Tests result: SUCCESS ==

1 test altered the execution environment:
    test_clinic

Total duration: 1.2 sec
Tests result: SUCCESS
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@AlexWaygood

AlexWaygood commented Aug 15, 2023

Copy link
Copy Markdown
Member

I'm getting warnings about the execution environment when I'm running python -m test test_clinic -v with this PR branch locally, btw:

Ah, and it looks like the CI is complaining about the same thing: https://github.com/python/cpython/actions/runs/5868181574/job/15910445072

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@erlend-aasland

erlend-aasland commented Aug 15, 2023

Copy link
Copy Markdown
Contributor Author

I'm getting warnings about the execution environment when I'm running python -m test test_clinic -v with this PR branch locally, btw:

Ah, and it looks like the CI is complaining about the same thing: https://github.com/python/cpython/actions/runs/5868181574/job/15910445072

Ah, yeah, I noticed earlier today, but got sidetracked. Since we're running a "expect success" test, we will actually generate clinic output in the added test (hence the sudden clinic/ directory). A workaround is to register a cleanUp() method, another is to just suppress all output, and yet another, is to run a destination file clear at the end of the clinic input.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@erlend-aasland

erlend-aasland commented Aug 15, 2023

Copy link
Copy Markdown
Contributor Author

I wonder why we're not seeing complaints about clinic/ directories for the other self.clinic.parse tests...

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@erlend-aasland

erlend-aasland commented Aug 15, 2023

Copy link
Copy Markdown
Contributor Author

I wonder why we're not seeing complaints about clinic/ directories for the other self.clinic.parse tests...

... because they don't create output; either they're dumping to block or buffer, or they're testing some weird directive, or they're run with precomputed checksums in the input (hence no regenerated output).

AlexWaygood reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@erlend-aasland
Don't create spurious clinic directories
4c09da8
@erlend-aasland

erlend-aasland commented Aug 15, 2023

Copy link
Copy Markdown
Contributor Author

...Could you also add a test with a cloned function with a custom C base name where the custom C base name is not a legal C identifier?

Ah, good call. On it!

AlexWaygood reacted with heart emoji
All reactions
  • ❤️ 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

erlend-aasland added 3 commits August 15, 2023 21:40
@erlend-aasland
Add test_cloned_with_illegal_c_basename
323041c
@erlend-aasland
Style
dc779dc
@erlend-aasland
Comment
734fb4a
@erlend-aasland
erlend-aasland requested a review from AlexWaygood August 15, 2023 19:53
@AlexWaygood AlexWaygood changed the title gh-106368: Argument Clinic: Add test for cloned function with custom C base name gh-106368: Argument Clinic: Add tests for cloned functions with custom C base names Aug 15, 2023
AlexWaygood
AlexWaygood approved these changes Aug 15, 2023
View reviewed changes

@AlexWaygood AlexWaygood left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Looks great, thank you!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

erlend-aasland reacted with hooray emoji
All reactions
  • 🎉 1 reaction
@AlexWaygood AlexWaygood added skip news and removed skip news labels Aug 15, 2023
@erlend-aasland

erlend-aasland commented Aug 15, 2023

Copy link
Copy Markdown
Contributor Author

thank you!

Likewise!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@erlend-aasland
erlend-aasland enabled auto-merge (squash) August 15, 2023 20:41
@erlend-aasland
erlend-aasland merged commit bb456a0 into python:main Aug 15, 2023
@bedevere-bot bedevere-bot added awaiting merge and removed awaiting core review awaiting merge labels Aug 15, 2023
@erlend-aasland
erlend-aasland deleted the clinic/add-cloned-with-custom-c-basename-test branch August 15, 2023 20:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@AlexWaygood AlexWaygood AlexWaygood approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

skip news tests Tests in the Lib/test dir

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@erlend-aasland @AlexWaygood @bedevere-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.