8000 PoC @alias annotation by erlend-aasland · Pull Request #27 · Argument-Clinic/cpython · GitHub
[go: up one dir, main page]

Skip to content

PoC @alias annotation #27

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

erlend-aasland
Copy link
@erlend-aasland erlend-aasland commented Dec 20, 2023

TODO:

  • tests
  • more guards for special cases

See: python#113270

@erlend-aasland
Copy link
Author

cc. @eltoder

@erlend-aasland
Copy link
Author

As discussed in the upstream issue, this PR confirms that the @alias notation is straight-forward to implement. There are some corner cases to get rid of, and of course tests, before we can propose this on the CPython repo.

Copy link
@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

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

Seems reasonable!

Comment on lines +1779 to +1780
alias_def = alias_def.replace("methoddef_name",
"methoddef_alias")

Choose a reason for hiding this comment

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

This feels somewhat hacky, but I guess no more hacky than all the other times we're calling .replace() on templates in clinic.py :)

Copy link
Author

Choose a reason for hiding this comment

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

Yeah, it is a bit hacky. We could add some asserts, to make sure the code breaks sooner than later if the prototype template changes.

@erlend-aasland
Copy link
Author

I'll add some guards and tests and move this upstream.

@erlend-aasland
Copy link
Author

I'll add some guards and tests and move this upstream.

As noted on the upstream issue, we need to do some more refactoring before we can finally upstream this.

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.

2 participants
0