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 infinite recursion for dolfinx.fem.Constant.__float__() calls #2482

Merged
merged 6 commits into from
Dec 19, 2022

Conversation

mikics
Copy link
Contributor

@mikics mikics commented Dec 12, 2022

This PR may solve the infinite recursion related to GH issue #2481 by adding __int__, __float__ and __complex__ methods directly to the dolfinx.fem.Constant class, instead of inheriting them from parents' classes.

@mikics mikics added the bug Something isn't working label Dec 12, 2022
@mikics mikics linked an issue Dec 12, 2022 that may be closed by this pull request
@mikics mikics marked this pull request as ready for review December 12, 2022 10:04
@jhale
Copy link
Member

jhale commented Dec 19, 2022

Thanks for this! A couple of small points

  1. Can you add some test coverage? I suppose we never call these methods in our tests, so the issue was never picked up.
  2. Is the __int__ method necessary? Under what circumstances would it be called?

@mikics
Copy link
Contributor Author

mikics commented Dec 19, 2022

Sure, I can add some tests!

For the __int__ method: I checked my code, and indeed it is not needed to solve the bug. I will remove it.

@mikics
Copy link
Contributor Author

mikics commented Dec 19, 2022

Tests added!

@jhale jhale merged commit b096796 into FEniCS:main Dec 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG]: Infinite recursion when calling dolfinx.fem.Constant.__float__()
2 participants