Numpy 2.3.0+ requires np.frombuffer instead of np.frombytes for binary data#21419
Open
onitake wants to merge 1 commit intoUltimaker:mainfrom
Open
Numpy 2.3.0+ requires np.frombuffer instead of np.frombytes for binary data#21419onitake wants to merge 1 commit intoUltimaker:mainfrom
onitake wants to merge 1 commit intoUltimaker:mainfrom
Conversation
Contributor
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
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.
Description
This PR replaces usage of np.fromstring with np.frombuffer, when the handling binary data.
Numpy 2.3.0 no longer supports the deprecated binary mode of np.fromstring, which would cause Cura to crash otherwise.
Fixes: #21418
See there for details.
Similar changes are required in Uranium, see Ultimaker/Uranium#1028 for a patch.
Type of change
How Has This Been Tested?
The patches have been tested against an older Cura version (5.0.0), with a system-installed numpy 2.4.0, as packaged in Debian sid. The affected Cura source code has not changed significantly since then, so the patches are more or less identical.
Patches used for the Debian version:
https://salsa.debian.org/3dprinting-team/uranium/-/blob/master/debian/patches/1001-numpy-tostring-deprecation.patch?ref_type=heads
https://salsa.debian.org/3dprinting-team/cura/-/blob/master/debian/patches/1012-numpy-fromstring-deprecation.patch?ref_type=heads
Tests done:
Test Configuration:
Checklist: