-
Notifications
You must be signed in to change notification settings - Fork 61
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
Fixes re List::Util::uniqint #108
base: master
Are you sure you want to change the base?
Conversation
…loats" (test 5) Also removed the (pointless) re-run of that test where the same values were supplied as strings.
@sisyphus I see a lot of improvements for I'd suggest to add also these tests: use List::Util qw( uniqint );
use Math::BigInt;
my $obj;
$obj = Math::BigInt->new(5);
is_deeply( [ uniqint $obj, $obj ],
[ $obj ],
'uniqint compares Math::BigInt objects' );
$obj = bless {}, __PACKAGE__;
is_deeply( [ uniqint $obj, $obj ],
[ $obj ],
'uniqint compares non-numerical objects' ); Segmentation violation exists both in current and your code. @leonerd am I right that we don't want any segfaults from such a code? UPD: created another PR with fix: #137 |
I think this should be treated as a separate issue, as it's not related to anything being done by this PR (AFAICS). You can work around it by using
Of course, it also outputs a "Useless use of ..." warning, even though we have just proven that our "use" was not "useless" ;-) A proper fix would address the issue inside ListUtil.xs such that the segfault is avoided. |
Some more digging, and inside uniq() in ListUtils.xs, there's the line of code (line 1376):
The segfault is happening when the That's odd - because, in another script, I had already checked to see whether
That all ran fine, and produced the output of "1". Hopefully there are people here who can pinpoint the problem. |
@sisyphus thanks for your research and help! Actually, the issue is with So you think it'd be better to deliver it via another PR? |
Done with it: #137 |
Looks good !! |
This PR addresses all of the uniqint issues that I've come across to date.
I don't guarantee that there are no more issues yet to be uncovered.
A good sample of the problems presented by the current implementation of uniqint (in Scalar-List-Utils-1.55) can be seen by running this PR's modified t/uniq.t against Scalar-List-Utils-1.55
Also tidied up a test in t/uniqnum.t.
Cheers,
Rob