FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

BUG: Fix comparator function signatures by charris · Pull Request #20845 · numpy/numpy · GitHub

/ numpy Public

BUG: Fix comparator function signatures - #20845

Merged
charris merged 1 commit into
numpy:maintenance/1.22.xfrom
charris:backport-20833
Jan 17, 2022
Merged

charris merged 1 commit into
numpy:maintenance/1.22.xfrom
charris:backport-20833

Conversation

charris commented Jan 17, 2022

Copy link
Copy Markdown
Member

Backport of #20833.

The comparator functions are expected to have signature int f(void *, void*, PyArrayObject *).
Some of the comparators drop the third argument because they don't use them. Because the
comparators are unused, with most architectures this works fine. However, calling a function
pointer that has been cast to have a different number of arguments is undefined in the C
specification. With web assembly targets, it crashes at runtime.

This fixes the comparators defined in arraytypes.c.src to all take three arguments.

See also related work:
258ce25
23c05e6

The comparator functions are expected to have signature int f(void *, void*, PyArrayObject *).
Some of the comparators drop the third argument because they don't use them. Because the
comparators are unused, with most architectures this works fine. However, calling a function
pointer that has been cast to have a different number of arguments is undefined in the C
specification. With web assembly targets, it crashes at runtime.

This fixes the comparators defined in arraytypes.c.src to all take three arguments.

See also related work:
258ce25
23c05e6
charris added 00 - Bug 08 - Backport Used to tag backport PRs labels Jan 17, 2022
charris added this to the 1.22.2 release milestone Jan 17, 2022
charris merged commit 9f31c32 into numpy:maintenance/1.22.x Jan 17, 2022
charris deleted the backport-20833 branch January 17, 2022 20:18
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

Labels

00 - Bug 08 - Backport Used to tag backport PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL