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 inheritance safe subclasses #992

Merged
merged 3 commits into from
May 29, 2024

Conversation

falvaradorodriguez
Copy link
Contributor

@falvaradorodriguez falvaradorodriguez commented May 29, 2024

Closes #972

There was a problem when passing parameters to the __new__ method of the superclass in the constructor of the Safe class. These parameters must be passed in the __init__ method but not in the __new__ method.

If you directly instantiated a class that inherits from Safe, such as SafeV141, instead of passing it through the __new__ constructor of the Safe class, the same problem occurred.

A test case is added to validate the explicit condition in the Safe class constructor.

@falvaradorodriguez falvaradorodriguez requested a review from a team as a code owner May 29, 2024 09:52
@falvaradorodriguez falvaradorodriguez self-assigned this May 29, 2024
@coveralls
Copy link

coveralls commented May 29, 2024

Pull Request Test Coverage Report for Build 9289626205

Details

  • 14 of 14 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.05%) to 93.539%

Totals Coverage Status
Change from base Build 9158604981: 0.05%
Covered Lines: 8049
Relevant Lines: 8605

💛 - Coveralls

Copy link
Member

@Uxio0 Uxio0 left a comment

Choose a reason for hiding this comment

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

Really nice job and Python understanding to implement this fix

@falvaradorodriguez falvaradorodriguez merged commit 9134a7b into main May 29, 2024
7 checks passed
@falvaradorodriguez falvaradorodriguez deleted the fix_inheritance_safe_subclasses branch May 29, 2024 16:24
@github-actions github-actions bot locked and limited conversation to collaborators May 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

subclassing safe doesn't work
3 participants