8000 gh-102378: don't bother stripping `/` from __text_signature__ by davidhewitt · Pull Request #102379 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-102378: don't bother stripping / from __text_signature__ #102379

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

Merged
merged 1 commit into from
Mar 9, 2023

Conversation

davidhewitt
Copy link
Contributor
@davidhewitt davidhewitt commented Mar 2, 2023

Closes #102378

I assume that it's ok to do this, because it's a private helper function. If not, please just close this!

Copy link
Member
@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

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

The feature itself and the implementation looks good to me! Thanks!

(The only thing that got me confused is that kind is not an actual argument, but uses a clojure)

@sobolevn
Copy link
Member
sobolevn commented Mar 3, 2023

You will need a NEWS entry for this :)

@skirpichev
Copy link
Contributor

You will need a NEWS entry for this :)

@sobolevn, is this really required? This PR touches a private function, that's used to handle a private attribute. This doesn't affect public interfaces or performance. Should be invisible for users (even among cpython developers)...

@sobolevn
Copy link
Member
sobolevn commented Mar 3, 2023

Why not? :)

Since some projects use __text_signature__ we might need to notify them.

@davidhewitt
Copy link
Contributor Author

Thanks! Added a NEWS entry.

@davidhewitt
Copy link
Contributor Author

@sobolevn just a gentle ping that I think this is ready to merge now the NEWS entry is added?

@sobolevn
Copy link
Member
sobolevn commented Mar 7, 2023

@JelleZijlstra can you please take a look as well? :)

Copy link
Member
@JelleZijlstra JelleZijlstra left a comment

Choose a reason for hiding this comment

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

Thanks, this seems like an improvement. Am I correct in thinking that this shouldn't affect the output of any public API?

I am inclined to not backport this as it doesn't fix a user-visible bug and might break users who use the private helper function.

@davidhewitt
Copy link
Contributor Author

Thanks, this seems like an improvement. Am I correct in thinking that this shouldn't affect the output of any public API?

The single usage of _signature_strip_non_python_syntax which I find in the codebase (excluding tests) is inside _signature_fromstr, for which the output is not affected. So yes, this is intended to be an opportunistic simplification and should not change any public APIs.

I am inclined to not backport this as it doesn't fix a user-visible bug and might break users who use the private helper function.

Fully agree with this, I was not expecting this would warrant a backport.

@davidhewitt
Copy link
Contributor Author

Since some projects use __text_signature__ we might need to notify them.

Just for posterity, this isn't expected to change any rules about what __text_signature__ is valid, anything which parsed previously should parse now, just with a simpler algorithm.

@JelleZijlstra JelleZijlstra merged commit 71cf7c3 into python:main Mar 9, 2023
@davidhewitt davidhewitt deleted the inspect-posargs branch March 9, 2023 23:18
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.

inspect._signature_strip_non_python_syntax doesn't need to strip /
5 participants
0