Skip to content

Conversation

Tishj
Copy link
Contributor

@Tishj Tishj commented Feb 26, 2025

This PR fixes #16370

Numpy has deprecated access to numpy.core in 2.0.0, we need to make sure multiarray does not get imported by a non-main thread for the first time, as this causes a segfault.

multiarray is sadly not exposed through the public API, so we kind of jump through a couple hoops to not trigger the warning anymore, while still remaining backwards compatible.

What does scare me a little is that I did not run into the DeprecationWarning during testing, so I wonder if accessing multiarray in this roundabout fashion is taking the right path, if it's not then we could still run the risk of running into the aforementioned segfault.

@Tishj
Copy link
Contributor Author

Tishj commented Feb 27, 2025

@Mytherin I'm also pointing this at v1.2, I think the changes are small enough for that

@Tishj Tishj force-pushed the numpy_core_deprecation_warning branch from f796de4 to f29b159 Compare February 27, 2025 12:40
@Tishj Tishj changed the base branch from main to v1.2-histrionicus February 27, 2025 12:41
@duckdb-draftbot duckdb-draftbot marked this pull request as draft February 27, 2025 12:41
@Mytherin Mytherin marked this pull request as ready for review February 27, 2025 13:32
@Mytherin
Copy link
Collaborator

Given that this doesn't really fix anything yet and you indicate there is some risk to this maybe pushing it into main is better for now?

@Tishj
Copy link
Contributor Author

Tishj commented Feb 27, 2025

I wrote that before the CI was green, but yes that's something to be mindful off.
It does fix something, it removes the annoying wall of text that numpy decides to output when you try to access numpy.core in numpy>=2.0.0

I can run nightly on my fork and see what the results of that are, if that's green I think it should make 1.2.1
https://github.com/Tishj/duckdb/actions/runs/13571136499

@Mytherin Mytherin merged commit d9673ba into duckdb:v1.2-histrionicus Mar 6, 2025
21 checks passed
@Mytherin
Copy link
Collaborator

Mytherin commented Mar 6, 2025

Thanks!

krlmlr added a commit to duckdb/duckdb-r that referenced this pull request Apr 8, 2025
Give preference to quote=escape if we can't do better (duckdb/duckdb#16584)
Fixup problems connected to prep to 1.2.1 (duckdb/duckdb#16578)
[Python Dev] No longer trigger a DeprecationWarning when using a UDF (duckdb/duckdb#16433)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

create_function raises a DeprecationWarning with python 3.13
2 participants