Repository navigation
Conversation
`kind=MinMaxFunc` gave `kind` the type alias as its default value rather
than as its annotation, so a call without `kind` reached the "Unknown
extrema" error instead of failing on the missing argument. That error
also lacked its f-prefix and printed `{kind}` literally.
`kind` is now annotated and required, as in find_cell_extrema. Every
working call already passed it, since without it the function raised.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…functions The function hard-coded the float64 cpp element and function space, so a float32 mesh failed when the function space was built. It now picks the classes by the mesh's geometry dtype, as create_geometry_function_space does, and builds both basix elements with that dtype. The dofmap array was allocated with np.zeros_like(cell_tag.values), so int64 cell tags gave an int64 array that AdjacencyList_int32 rejects. It is now always int32, as it holds positions into `tags`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
It was annotated as also taking a UFL expression, but an expression without a dtype, such as `u * v`, raised AttributeError on `.coefficients()`, which only forms have. Its two callers, assemble_scalar and norm, only pass forms, so the annotation now says so. No change at runtime. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
finsberg
added this pull request to stack #270
October 21, 2026 19:38
finsberg
removed this pull request from stack #270
October 21, 2026 19:40
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Three bugs that turned up while fixing the mypy errors on
finsberg/fenicsx-compat, one commit each.compute_extrema:kindwas a default value, not an annotationdef compute_extrema( u: ufl.core.expr.Expr, - kind=MinMaxFunc, + kind: MinMaxFunc, ... - raise ValueError("Unknown extrema {kind}, supports min and max only.") + raise ValueError(f"Unknown extrema {kind}, supports min and max only.")Without
kind, a call used to raise a misleading "Unknown extrema {kind}" error. Nowkindis required, as it already is infind_cell_extrema. Every working call already passed it.create_space_of_simple_functions: float32 meshes and int64 cell tagsThe float32/float64 choice follows
create_geometry_function_space._extract_dtype(private): typed for what it is givenIt was annotated as also taking a UFL expression, but a plain expression such as
u * vraisedAttributeError. Both callers (assemble_scalarandnorm) only pass forms, so the annotation now says that. No change at runtime.Evidence
Merge Danger
Door: two-way
Each fix is a small, separate commit and can be reverted on its own.
Blast Radius: callers
compute_extremawithoutkindnow raisesTypeErrorinstead ofValueError. Such a call never worked.create_space_of_simple_functionsnow accepts float32 meshes and int64 cell tags, which used to raise. float64 meshes with int32 tags behave as before.🤖 Generated with Claude Code