Skip to content
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

fix: adjust the inspect.signature behaviour to work with Python 3.8 #188

Merged

Conversation

tonyandrewmeyer
Copy link
Collaborator

Python 3.9 changes the behaviour of inspect.signature - in 3.8 if a class has a parent with a __new__ then the __new__ is used when getting the class signature, and in 3.9 (and above) the class's __init__ is used.

Instead of getting the class's signature, get the signature of __init__ explicitly (ignoring self), so that this works in 3.8 as well as 3.9 and above.

I've done uvx --python=3.{8,9,10,11,12} tox -e unit , so things should be good now.

Fixes #187

Copy link
Collaborator

@PietroPasotti PietroPasotti left a comment

Choose a reason for hiding this comment

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

ty!

@PietroPasotti PietroPasotti merged commit 29a50b7 into canonical:main Sep 9, 2024
2 checks passed
@tonyandrewmeyer tonyandrewmeyer deleted the fix-3.8-inspect-compat branch September 9, 2024 09:01
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.

Scenario 7.0 breaks with Python 3.8
2 participants