Repository navigation
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
M-Colley
force-pushed
the
fix/issues-8-11
branch
from
November 24, 2026 11:25
2b012b8 to
c546d75
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #103 +/- ##
==========================================
+ Coverage 75.93% 76.72% +0.78%
==========================================
Files 70 70
Lines 7429 7453 +24
Branches 1476 1469 -7
==========================================
+ Hits 5641 5718 +77
+ Misses 1257 1224 -33
+ Partials 531 511 -20
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
MLopez-Ibanez
force-pushed
the
fix/issues-8-11
branch
from
November 25, 2026 08:31
d6cb54b to
bc2fe53
Compare
Contributor
|
Could you please separate the two fixes from the new tests to separate commits? They can stay in the same PR but it will be easier to bisect a bug if not everything is in the same commit. |
Contributor
Author
|
@MLopez-Ibanez Thanks for the review. I rebased the branch onto
|
M-Colley
force-pushed
the
fix/issues-8-11
branch
from
December 1, 2026 09:28
bc2fe53 to
1a8a2da
Compare
This branch has not been deployed
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.
Closes #8
The allocation checks for #11 that were part of this PR are now in #108.
Changes
python/tests/test_immutability.pynow calls every public function that takes arrays throughimmutable_call(). Functions with amaximiseargument run withmaximise=False,Trueand a mixed boolean array, since the maximisation paths are where an input copy is most often missing.whv_rect,total_whv_rectandlargest_eafdiffonly support minimisation, so they run once. Functions without array inputs (generate_ndset,generate_sequence,get_dataset,get_dataset_path,read_datasets) are not covered.The new test found a bug.
whv_rect()andtotal_whv_rect()modified bothpointsandrectangles. The C functionrect_weighted_hv2d()sorted the points in place, andwhv_preprocess_rectangles()clipped and sorted the rectangles in place. The Python wrapper passes the NumPy buffer directly when the input is a C-contiguous float64 array, so the caller's arrays were reordered and clipped. The R wrapper passest(x)andt(rectangles), which are copies, so R was not affected.Fix:
rect_weighted_hv2d()now takesconstinputs and sorts a copy of the points.whv_preprocess_rectangles()writes the clipped rectangles into a new array, which also removes theskiparray.Overlap with #108: both PRs change
whv_preprocess_rectangles()inc/whv.cand the NEWS filesc/NEWS.mdandpython/doc/source/whatsnew/index.rst, so whichever PR merges second needs a rebase that keeps the rewrittenwhv_preprocess_rectangles()from this PR.How I verified it
Function 'whv_rect' mutated positional arg 0and the same fortotal_whv_rect. All other functions pass. After the fix,test_immutability.pypasses (98 passed, 1 existing xfail).pytest --doctest-modules tests src/moocore/_moocore.py): 195 passed, 2 xfailed. The extension was built with MSVC.rect_weighted_hv2d()is also used by Rwhv_rect(). RtestthatwithNOT_CRAN=true: 0 failures, 0 errors, 0 skipped.c/whv.ccompiles without warnings with GCC 14.3 and-Wall -Wextra -Wpedantic -Werror, withDEBUG=0andDEBUG=1.Environment: Windows 11, Python 3.13, R 4.6.1, GCC 14.3 from Rtools 4.5, MSVC from Visual Studio 18. I have not tested on Linux or macOS locally, so CI covers those.
AI assistance was used to prepare and review this patch.
🤖 Generated with Claude Code