Fix getter/setter for polymorphic module-level variables - #376
Open
krystophny wants to merge 2 commits into
Open
Fix getter/setter for polymorphic module-level variables#376krystophny wants to merge 2 commits into
krystophny wants to merge 2 commits into
Conversation
Module-level variables of class types (derived types with type-bound procedures) generated getters and setters that pointed the ptr_type payload directly at the module variable, but for class types the payload is a wrapper_type holding a class pointer. The generated code failed to compile with 'Different types in pointer assignment'. Route module-level access through the wrapper obj pointer, matching the existing code path for class-typed components of derived types. Fixes jameskermode#374
numpy 2.5 ships only manylinux_2_28 wheels, so the cp312 and cp313 Linux wheel builds fall back to compiling numpy from source inside the default manylinux2014 container, where gcc 10.2.1 fails numpy's 'requires GCC >= 10.3' check. Build in the manylinux_2_28 image, whose toolchain is new enough and where numpy wheels install directly.
Contributor
Author
|
Wheel CI failed for cp312/cp313 on Linux: numpy 2.5 ships only manylinux_2_28 wheels, so the default manylinux2014 container built numpy from source and failed its gcc >= 10.3 check. Included a one-line workflow fix building Linux wheels in the manylinux_2_28 image. |
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.
Fixes #374.
For module-level variables of class types (derived types with type-bound procedures), the generated getter/setter pointed the
*_ptr_typepayload directly at the module variable. For class types the payload is a*_wrapper_typeholding aclasspointer, so the generated wrapper failed to compile. Route module-level access through the wrapperobjpointer, matching the existing code path for class-typed components of derived types. The handle encoding for class-typed values is nowptr_type -> wrapper_type -> objeverywhere, consistent with the method-call convention; the new example verifies this by calling a type-bound method on the retrieved global.Adds
examples/issue374_polymorphic_globalwith the reproducer from the issue: get/set of both a plain derived-type global and a polymorphic one, plus a method call on the retrieved global.Verification
Test fails on main
Test passes after fix
Class-related examples all pass after the change:
fortran_oo,issue235_allocatable_classes,issue258_derived_type_attributes,issue254_getter,derivedtypes,mockderivetype,extends,class_names. Unit tests: 38 passed (2 pre-existingtest_parse_dnadfailures addressed separately).@jameskermode ready for review.