Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

more fixes for NumPy2 #6100

Merged
merged 1 commit into from Mar 23, 2024
Merged

more fixes for NumPy2 #6100

merged 1 commit into from Mar 23, 2024

Conversation

mattip
Copy link
Contributor

@mattip mattip commented Mar 20, 2024

Continuation of #6076 to make tests pass on NumPy2 and still support NumPy1.

The complex changes incorporate the fix for numpy/numpy#26029. Unfortunately on C++, NumPy no longer supports a[1].real += 1. It still works in C, but not in C++. This is documented in the migration guide (last paragraph in that section).

@mattip
Copy link
Contributor Author

mattip commented Mar 20, 2024

One CI run failed to update with apt, and a windows/python3.13 one failed in test_initvar_is_specified.

@scoder
Copy link
Contributor

scoder commented Mar 23, 2024 via email

@da-woods da-woods added this to the 3.0.10 milestone Mar 23, 2024
@da-woods da-woods merged commit 2cc9aea into cython:master Mar 23, 2024
62 of 64 checks passed
da-woods pushed a commit that referenced this pull request Mar 23, 2024
@da-woods
Copy link
Contributor

3.0.x commit 4f3c1ba

@scoder
Copy link
Contributor

scoder commented Mar 24, 2024

I now see C compile failures in 3.0.x, both in C and C++:
https://github.com/cython/cython/actions/runs/8401443347/job/23009827687

In file included from numpy_test.c:32:
numpy_test.c:3882:42: error: request for member ‘imag’ in something not a structure or union
   {&__Pyx_TypeInfo_long__double, "imag", offsetof(__pyx_t_5numpy_clongdouble_t, imag)},
                                          ^~~~~~~~
numpy_test.c:3882:42: warning: initialization of ‘long unsigned int’ from ‘__Pyx_StructField *’ {aka ‘struct __Pyx_StructField_ *’} makes integer from pointer without a cast [-Wint-conversion]
   {&__Pyx_TypeInfo_long__double, "imag", offsetof(__pyx_t_5numpy_clongdouble_t, imag)},
                                          ^~~~~~~~
numpy_test.c:3882:42: note: (near initialization for ‘__Pyx_StructFields_nn___pyx_t_5numpy_clongdouble_t[1].offset’)
In file included from numpy_test.c:32:
numpy_test.c:3882:42: error: initializer element is not constant
   {&__Pyx_TypeInfo_long__double, "imag", offsetof(__pyx_t_5numpy_clongdouble_t, imag)},
                                          ^~~~~~~~
numpy_test.c:3882:42: note: (near initialization for ‘__Pyx_StructFields_nn___pyx_t_5numpy_clongdouble_t[1].offset’)
numpy_test.cpp:3896:81: error: ‘__pyx_t_5numpy_clongdouble_t’ {aka ‘struct npy_clongdouble’} has no member named ‘real’; did you mean ‘_Val’?
   {&__Pyx_TypeInfo_long__double, "real", offsetof(__pyx_t_5numpy_clongdouble_t, real)},
                                                                                 ^~~~
numpy_test.cpp:3897:81: error: ‘__pyx_t_5numpy_clongdouble_t’ {aka ‘struct npy_clongdouble’} has no member named ‘imag’
   {&__Pyx_TypeInfo_long__double, "imag", offsetof(__pyx_t_5numpy_clongdouble_t, imag)},
                                                                                 ^~~~

@mattip
Copy link
Contributor Author

mattip commented Mar 24, 2024

Huh. I tested this with python3.11, maybe something changed with python3.12? Investigating...

@mattip
Copy link
Contributor Author

mattip commented Mar 24, 2024

Ahh, of course. This needs latest numpy HEAD to pull in the changes made in numpy/numpy#26080 after the release of 2.0.0b1, so it will fail until the release of 2.0.0rc1. So what should be done here?

  • There are newer "nightly" wheels available, they can be used with pip install -i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple numpy==2.1.0.dev0. Should I submit a PR to use that until a better release is on PyPI?
  • Disable the test as long as NumPy version == 2.0.0b1
  • Live with the failure until the rc1 release, which could happen in a week or twp

@mattip
Copy link
Contributor Author

mattip commented Mar 24, 2024

Another option is to pin 3.0.x to use numpy<2 on 3.12 like master, at least until after the rc1 release.

@scoder
Copy link
Contributor

scoder commented Mar 24, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants