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 — MAINT: support python 3.10 by tacaswell · Pull Request #16417 · numpy/numpy

Conversation

@tacaswell

@tacaswell tacaswell commented May 28, 2020 •
edited by charris
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

In python/cpython#20290 CPython changed
Py_TYPE from a macro to an inline function. This requires a code
change to us Py_SET_TYPE instead when using Py_TYPE() as a lvalue
in c code.

This is a draft (and I expect it to fail all of the tests) because Py_SET_TYPE was only introduced in py39. Can I please have some guidance on how to do version gating (or have someone who knows take over this PR ;) )

Sorry, something went wrong.

Uh oh!

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

All reactions
@charris

charris commented May 28, 2020

Copy link
Copy Markdown
Member

Ugh. Is it certain that this change will persist to release?

All reactions

Sorry, something went wrong.

Uh oh!

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

@eric-wieser

eric-wieser commented May 28, 2020 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

Something like this in npy3k.h (or however it's spelt) would do it:

#if PY_VERSION_HEX < 0x030a0000
    #define Py_SET_TYPE(obj, typ) (Py_TYPE(obj) = typ)
#endif
All reactions

Sorry, something went wrong.

Uh oh!

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

@tacaswell

tacaswell commented May 28, 2020

Copy link
Copy Markdown
Contributor Author

This is part of a series of intentional API breaks to try and condense the python c-api so I am pretty confident that this will persist.

All reactions

Sorry, something went wrong.

Uh oh!

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

@seberg

seberg commented May 28, 2020

Copy link
Copy Markdown
Member

It seems like we should also replace all ob_type then... But, I guess no need to try and get ahead of Python here...

All reactions

Sorry, something went wrong.

Uh oh!

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

@charris

charris commented May 28, 2020

Copy link
Copy Markdown
Member

This is part of a series of intentional API breaks

We might want to make a compatibility include file to use until Python3.9 gets dropped. Probably need to use new names to avoid redefinitions.

All reactions

Sorry, something went wrong.

Uh oh!

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

@seberg seberg added 03 - Maintenance component: numpy._core labels May 28, 2020
eric-wieser
eric-wieser reviewed May 29, 2020
View reviewed changes
Comment thread numpy/core/include/numpy/npy_3kcompat.h Resolved

Uh oh!

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

@charris charris changed the title MNT: support python 3.10 MAINT: support python 3.10 May 29, 2020
@charris

charris commented May 29, 2020

Copy link
Copy Markdown
Member

We are running tests against 3.9-dev, so that should validate that this works.

All reactions

Sorry, something went wrong.

Uh oh!

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

tacaswell added 2 commits May 29, 2020 11:02
@tacaswell
MNT: support python 3.10
405c6de
In python/cpython#20290 CPython changed
`Py_TYPE` from a macro to an inline function.  This requires a code
change to us `Py_SET_TYPE` instead when using `Py_TYPE()` as a lvalue
in c code.

In python/cpython#20429 CPython changed
`Py_SIZE` from a macro to an inline function.  This requires a code
change to us `Py_SET_SIZE` instead of using `Py_SIZE` as a lvalue in c
code.
@tacaswell
MNT: define macros supplied in py39 and above
4bf06ad
To support the change to Py_SIZE and Py_TYPE the Py_SET_SIZE and
Py_SET_TYPE macros are provided in py39.  This provides the same
macros falling back to the old method for < py39.
@tacaswell
tacaswell force-pushed the fix_py310_compat branch from cf7a282 to 4bf06ad Compare May 29, 2020 15:02
@charris charris added the 09 - Backport-Candidate PRs tagged should be backported label May 29, 2020
charris
charris reviewed May 29, 2020
View reviewed changes
Comment thread numpy/core/include/numpy/npy_3kcompat.h Outdated

@charris charris May 29, 2020 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might look better up top with the similar compatibility hacks.

Sorry, something went wrong.

Uh oh!

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

All reactions

@tacaswell tacaswell May 29, 2020

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should also add a reference for the other one.

Sorry, something went wrong.

Uh oh!

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

All reactions
@tacaswell
tacaswell marked this pull request as ready for review May 29, 2020 17:00
@charris

charris commented May 29, 2020

Copy link
Copy Markdown
Member

The testing error is on the azure end and may be ignored.

All reactions

Sorry, something went wrong.

Uh oh!

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

@tacaswell
tacaswell force-pushed the fix_py310_compat branch from 6afdd10 to 0b7907d Compare May 29, 2020 21:22
@tacaswell @eric-wieser
MNT: be more precise about version support
77c2c23
Co-authored-by: Eric Wieser <[email protected]>
@tacaswell
tacaswell force-pushed the fix_py310_compat branch from 0b7907d to 77c2c23 Compare May 29, 2020 21:27
charris
charris approved these changes May 29, 2020
View reviewed changes
@charris
charris merged commit a96b18e into numpy:master May 29, 2020
@charris

charris commented May 29, 2020

Copy link
Copy Markdown
Member

Thanks Thomas.

seberg reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

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

@charris charris mentioned this pull request May 29, 2020
MAINT: support python 3.10 #16437
Merged
@charris charris removed the 09 - Backport-Candidate PRs tagged should be backported label May 29, 2020
@tacaswell
tacaswell deleted the fix_py310_compat branch May 30, 2020 00:17
This was referenced May 30, 2020
MAINT: Catch remaining cases of Py_SIZE and Py_TYPE as lvalues #16438
Merged
Mnt py310 compat pycurl/pycurl#636
Closed
bpo-39573: Porting to Python 3.10: Py_SET_SIZE() macro python/cpython#20610
Merged
@charris charris mentioned this pull request Jun 9, 2020
BUG: NumPy build failure with Python nightly #16553
Closed
akihikodaki added a commit to akihikodaki/dts that referenced this pull request Feb 11, 2023
@akihikodaki
Update numpy from 1.18.5 to 1.24.2
0d4ebed
This includes a fix for Python 3.10:
numpy/numpy#16417

Signed-off-by: Akihiko Odaki <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@eric-wieser eric-wieser eric-wieser left review comments
@charris charris charris approved these changes

Uh oh!

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

Assignees

No one assigned

Labels

03 - Maintenance component: numpy._core

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

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

4 participants

@tacaswell @charris @eric-wieser @seberg
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 01402520 — 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.