GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — BUG: Handle ``iso_c_type`` mappings more consistently by charris · Pull Request #25480 · numpy/numpy

Conversation

@charris

@charris charris commented Dec 23, 2023

Copy link
Copy Markdown
Member

Backport of #25226.

Closes #25207. This one could use a backport. Needs:

  • Scoping TODOs (can't rewrite the entire cfuncs here)
  • Tests
  • Check that SciPy builds

As discussed below, there were basically two deficiencies:

  • Type maps were not propagated
  • Fortran types (iso_c_binding) were mapped to ignored C types
    • This is the default behavior, but is silent and the maps are done to basic (lowest precision) corresponding types

This PR fixes (pragmatically) both these deficiences, for the first problem, the fix is a simple refactor and cleanup.

The second issue is a little trickier. For now, the pragmatic solution (as done by users anyway) is to map the iso_c_binding kinds to supported f2py types, i.e. to one of:

c2py_map = {'double': 'float',
            'float': 'float',                          # forced casting
            'long_double': 'float',                    # forced casting
            'char': 'int',                             # forced casting
            'signed_char': 'int',                      # forced casting
            'unsigned_char': 'int',                    # forced casting
            'short': 'int',                            # forced casting
            'unsigned_short': 'int',                   # forced casting
            'int': 'int',                              # forced casting
            'long': 'int',
            'long_long': 'long',
            'unsigned': 'int',                         # forced casting
            'complex_float': 'complex',                # forced casting
            'complex_double': 'complex',
            'complex_long_double': 'complex',          # forced casting
            'string': 'string',
            'character': 'bytes',
            }

Pending a more complete overhaul of the generated bindings (tracked in #25229, which @Pranavchiku is also looking into) this is the optimal bugfix for #25207.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
HaoZeke added 9 commits December 23, 2023 15:05
@HaoZeke @charris
TST: Add one for numpygh-25207
3e6606e
@HaoZeke @charris
BUG: Work with the ISOC_BINDINGS more consisently
d7e78b6
Closes numpygh-25207
@HaoZeke @charris
MAINT: Kill now unused deep-merge [f2py]
47dfd65
@HaoZeke @charris
ENH: Populate all maps for iso_c bindings
05d161f
@HaoZeke @charris
MAINT: Correctly return mapped types [f2py]
1e127aa
@HaoZeke @charris
DOC: Add a note on the iso_c2py_map implementation
62676de
@HaoZeke @charris
MAINT: Reduce chatter to pass tests
2368305
@HaoZeke @charris
BUG: Map to types with bindings [f2py]
599e427
Fixes numpygh-25226

MAINT: Cleanup and scope fix better [f2py]
@HaoZeke @charris
TST: Add a another test for numpygh-25207
da7713d
@charris charris added 00 - Bug component: numpy.f2py 08 - Backport Used to tag backport PRs labels Dec 23, 2023
@charris charris added this to the 1.26.3 release milestone Dec 23, 2023
@charris
charris merged commit 0a39198 into numpy:maintenance/1.26.x Dec 23, 2023
@charris
charris deleted the backport-25226 branch December 23, 2023 23:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

00 - Bug 08 - Backport Used to tag backport PRs component: numpy.f2py

Projects

None yet

Milestone

1.26.3 release

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@charris @HaoZeke
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.