Skip to content

gh-92062: inspect.Parameter checks whether name is a keyword#92065

Merged
miss-islington merged 3 commits into
python:mainfrom
Zac-HD:zac-hd/error-on-keyword-params
May 3, 2022
Merged

gh-92062: inspect.Parameter checks whether name is a keyword#92065
miss-islington merged 3 commits into
python:mainfrom
Zac-HD:zac-hd/error-on-keyword-params

Conversation

@Zac-HD

@Zac-HD Zac-HD commented Apr 30, 2022

Copy link
Copy Markdown
Contributor

Fixes #92062.

Automerge-Triggered-By: GH:pganssle

@AlexWaygood AlexWaygood added type-feature A feature request or enhancement stdlib Standard Library Python modules in the Lib/ directory labels Apr 30, 2022
@Zac-HD

Zac-HD commented Apr 30, 2022

Copy link
Copy Markdown
Contributor Author

I just can't understand why make patchcheck is complaining about whitespace in inspect.py 😕

@JelleZijlstra

Copy link
Copy Markdown
Member

I just can't understand why make patchcheck is complaining about whitespace in inspect.py 😕

There is some pre-existing trailing whitespace in the file (around lines 1648 and 1686). make patchcheck runs only on changed files and we don't have a check to make sure it passes on unchanged files (sorry for that). You should probably just fix the trailing whitespace.

Zac-HD added 2 commits April 29, 2022 22:37
Jelle pointed out that this might occur in C functions, and so to avoid breaking any existing (if strange) code we'll only check params which can be called with named arguments.
@Zac-HD

Zac-HD commented Apr 30, 2022

Copy link
Copy Markdown
Contributor Author

Oh, easy to fix now that I know what's happening! Thanks for the quick response 🤩

(Perhaps the patchcheck job could also run a git diff so that contributors can see the problem?)

@miss-islington
miss-islington merged commit 65f88a6 into python:main May 3, 2022
@Zac-HD
Zac-HD deleted the zac-hd/error-on-keyword-params branch May 3, 2022 20:52
@pganssle

pganssle commented May 3, 2022

Copy link
Copy Markdown
Member

This seems like it should be uncontroversial enough (famous last words — I'm sure someone is going to show up complaining that they use invalid signature objects as some load-bearing part of their workflow).

@Ark-kun

Ark-kun commented May 24, 2025

Copy link
Copy Markdown

I'm sure someone is going to show up complaining that they use invalid signature objects as some load-bearing part of their workflow

Sorry for making you wait so long.

So, for many years we were dynamically generating functions based on interface described in YAML files. With Python 3.9 our tests started to fail. Turns out we had some cases where a parameter with name in was being generated. I wonder whether the actual generated low-level functions worked in this case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stdlib Standard Library Python modules in the Lib/ directory type-feature A feature request or enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

inspect.Parameter checks that name is an identifier, but does not check for keywords

7 participants