Sebastian is talking about the temporary elision checks, which happen on
Mac and Linux for sufficient large arrays by doing a somewhat cursed check
involving stack unwinding to verify that numpy or Python created the array,
and not a C extension.

Python 3.14 changed the semantics for this, now it’s possible more often
for an object to have a reference count of 1 but not actually be a
temporary.

See
https://github.com/numpy/numpy/issues/28681
 for the issue tracking the provlem and
https://github.com/numpy/numpy/pull/29649 where I fixed this in NumPy 2.x.

Also see
https://github.com/python/cpython/issues/133140 for the CPython issue about
this.

Now, for what to do about this, I think maybe it is worth uploading a new
1.x release that errors out more usefully on 3.14. I’m not sure how painful
that is and we also need to make sure we don’t accidentally break older
Python versions.

On Sun, Dec 14, 2025 at 5:20 AM Peter Wang via NumPy-Discussion <
[email protected]> wrote:

> Thanks for the heads up, Sebastian. Out of curiosity, what is the trick?
> (Or can you link to a ticket on the issue tracker?)
>
> Thanks,
> Peter
>
> On Sun, Dec 14, 2025 at 6:15 AM Sebastian Berg <[email protected]>
> wrote:
>
>> Hi all,
>>
>> a small piece of information:
>>
>> NumPy 1.x was not released with support for Python 3.14.
>>
>> Most of the time, a too new Python versions (in recent past) just broke
>> compilation. However, this time around optimization work together with
>> the one bit of arcane optimization tricks in NumPy *will* cause
>> silently incorrect results in most non-trivial code [1].
>>
>> There are no releases to yank or upper bounds to set so I didn't think
>> we can actually do anything about it. But this just came up again (this
>> time in pandas).
>> IThe only (new) idea I have would be to upload a Python 1.26 + Python
>> 3.14 wheel that includes no code besides raising an error at install
>> time.
>> (Anyone who is running into issues is compiling NumPy from scratch, but
>> I guess they would probably use the wheel first if available.)
>>
>> Cheers,
>>
>> Sebastian
>>
>>
>> [1] May affect windows builds less badly, where NumPy doesn't do this
>> trick, but what does it matter....
>> _______________________________________________
>> NumPy-Discussion mailing list -- [email protected]
>> To unsubscribe send an email to [email protected]
>> https://mail.python.org/mailman3//lists/numpy-discussion.python.org
>> Member address: [email protected]
>>
> _______________________________________________
> NumPy-Discussion mailing list -- [email protected]
> To unsubscribe send an email to [email protected]
> https://mail.python.org/mailman3//lists/numpy-discussion.python.org
> Member address: [email protected]
>
_______________________________________________
NumPy-Discussion mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/numpy-discussion.python.org
Member address: [email protected]

Reply via email to