Skip Menu |

This queue is for tickets about the Math-BigInt CPAN distribution.

Report information
The Basics
Id: 103844
Status: rejected
Priority: 0/
Queue: Math-BigInt

People
Owner: Nobody in particular
Requestors: cheako [...] mikemestnik.net
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: is_zero on unblessed reference line 506.
Date: Mon, 20 Apr 2015 18:22:36 -0500
To: bug-Math-BigInt [...] rt.cpan.org
From: Mike Mestnik <cheako [...] mikemestnik.net>
Looks like bcmp in VERSION 1.9991 does not handle scalars. Can't call method "is_zero" on unblessed reference at /usr/share/perl/5.20/Math/BigFloat.pm line 506. I've added the following to capture more information. die ref($x).":".ref($y) unless ($x->can('is_zero') && $y->can('is_zero'));
Subject: Re: [rt.cpan.org #103844] AutoReply: is_zero on unblessed reference line 506.
Date: Tue, 21 Apr 2015 08:18:31 -0500
To: bug-Math-BigInt [...] rt.cpan.org
From: Mike Mestnik <cheako [...] mikemestnik.net>
Resulted in Can't call method "can" on unblessed reference, so I changed the code: use Scalar::Util qw(blessed); die ref($x).":".blessed($x).", ".ref($y).":".blessed($y) unless ((ref($x) ? blessed($x) : 1)||(ref($y) ? blessed($y) : 1)); On Mon, Apr 20, 2015 at 6:22 PM, Bugs in Math-BigInt via RT <bug-Math-BigInt@rt.cpan.org> wrote: Show quoted text
> > Greetings, > > This message has been automatically generated in response to the > creation of a trouble ticket regarding: > "is_zero on unblessed reference line 506.", > a summary of which appears below. > > There is no need to reply to this message right now. Your ticket has been > assigned an ID of [rt.cpan.org #103844]. Your ticket is accessible > on the web at: > > https://rt.cpan.org/Ticket/Display.html?id=103844 > > Please include the string: > > [rt.cpan.org #103844] > > in the subject line of all future correspondence about this issue. To do so, > you may reply to this message. > > Thank you, > bug-Math-BigInt@rt.cpan.org > > ------------------------------------------------------------------------- > Looks like bcmp in VERSION 1.9991 does not handle scalars. > > Can't call method "is_zero" on unblessed reference at > /usr/share/perl/5.20/Math/BigFloat.pm line 506. > > I've added the following to capture more information. > die ref($x).":".ref($y) unless ($x->can('is_zero') && $y->can('is_zero'));
Subject: Re: [rt.cpan.org #103844] AutoReply: is_zero on unblessed reference line 506.
Date: Tue, 21 Apr 2015 19:50:53 -0500
To: bug-Math-BigInt [...] rt.cpan.org
From: Mike Mestnik <cheako [...] mikemestnik.net>
HASH:, Math::BigFloat:Math::BigFloat at /usr/share/perl/5.20/Math/BigFloat.pm line 507. I'll find out why a hash ref.
Subject: Re: [rt.cpan.org #103844] AutoReply: is_zero on unblessed reference line 506.
Date: Wed, 22 Apr 2015 17:31:01 -0500
To: bug-Math-BigInt [...] rt.cpan.org
From: Mike Mestnik <cheako [...] mikemestnik.net>
It was an empty hasref, trying to get a backtrace now. On Tue, Apr 21, 2015 at 7:50 PM, Mike Mestnik <cheako@mikemestnik.net> wrote: Show quoted text
> HASH:, Math::BigFloat:Math::BigFloat at > /usr/share/perl/5.20/Math/BigFloat.pm line 507. > > I'll find out why a hash ref.
Subject: Re: [rt.cpan.org #103844] AutoReply: is_zero on unblessed reference line 506.
Date: Wed, 22 Apr 2015 22:26:10 -0500
To: bug-Math-BigInt [...] rt.cpan.org
From: Mike Mestnik <cheako [...] mikemestnik.net>
I didn't have parentheses around something. Still should call Carp::confess instead of crashing. On Wed, Apr 22, 2015 at 5:31 PM, Mike Mestnik <cheako@mikemestnik.net> wrote: Show quoted text
> It was an empty hasref, trying to get a backtrace now. > > On Tue, Apr 21, 2015 at 7:50 PM, Mike Mestnik <cheako@mikemestnik.net> wrote:
>> HASH:, Math::BigFloat:Math::BigFloat at >> /usr/share/perl/5.20/Math/BigFloat.pm line 507. >> >> I'll find out why a hash ref.
If I understand you correctly, you are doing something like this $ perl -MMath::BigInt -wle '$x = {}; print $x -> is_zero()' Can't call method "is_zero" on unblessed reference at -e line 1. If that is the case, this has nothing to do with Math::BigInt. The error message is from Perl itself, not from Math::BigInt. Actually, your code is equivalent to the following, where there is no Math::BigInt involved. $ perl -wle '$x = {}; print $x -> is_zero()' Can't call method "is_zero" on unblessed reference at -e line 1. This is not a bug in Math::BigInt. It is a bug in your code. There is nothing I can do with Math::BigInt that will fix your code.
This is not a bug in the Math-BigInt distribution.
Subject: Re: [rt.cpan.org #103844] is_zero on unblessed reference line 506.
Date: Mon, 17 Aug 2015 10:13:01 -0500
To: bug-Math-BigInt [...] rt.cpan.org
From: Mike Mestnik <cheako [...] mikemestnik.net>
That may be. I don't have the code for this but I'd found that adding () around the hashref fixed this. So the above example didn't track as the same problem. Instead of letting perl handle the error and then point out a module as being the reason for the error, and it is the cause of perl crashing, the module should confes that it does not support hashref. This should give a stack trace that indicates the code that caused perl to crash. On Aug 15, 2015 1:05 PM, "Peter John Acklam via RT" < bug-Math-BigInt@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=103844 > > > If I understand you correctly, you are doing something like this > > $ perl -MMath::BigInt -wle '$x = {}; print $x -> is_zero()' > Can't call method "is_zero" on unblessed reference at -e line 1. > > If that is the case, this has nothing to do with Math::BigInt. The error > message is from Perl itself, not from Math::BigInt. Actually, your code > is equivalent to the following, where there is no Math::BigInt involved. > > $ perl -wle '$x = {}; print $x -> is_zero()' > Can't call method "is_zero" on unblessed reference at -e line 1. > > This is not a bug in Math::BigInt. It is a bug in your code. There is > nothing I can do with Math::BigInt that will fix your code. >
You say that the error happened at Math::BigFloat version 1.9991 at line 507. This is inside the bcmp() method. The code around line 507 looks like this: 506 my $xz = $x->is_zero(); 507 my $yz = $y->is_zero(); 508 return 0 if $xz && $yz; # 0 <=> 0 For some reason, $y is an unblessed reference. I have tried to reproduce the error you are seeing, but every attempt so far has made my program fail before it gets to line 507 of Math::BigFloat. If you want me to dig further into this, I am afraid you have to show me what $x and $y are in the call to bcmp().
Subject: Re: [rt.cpan.org #103844] is_zero on unblessed reference line 506.
Date: Mon, 17 Aug 2015 14:19:49 -0500
To: bug-Math-BigInt [...] rt.cpan.org
From: Mike Mestnik <cheako [...] mikemestnik.net>
The original report says 506, review that error msg. After I altered the code it says line 507, but there is now information about what $x is. The information says empty and unblessed hash ref, but the calling code was an equation, I'll see if I can't find it. The calling code was fixed by putting parentheses around something and I remember that they should have been a no-op in that they seemingly did nothing. So I'm asking for there to be handling in the case $x or $y are unblessed hash ref, even if it seems impossible for that code to ever run. On Aug 17, 2015 1:47 PM, "Peter John Acklam via RT" < bug-Math-BigInt@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=103844 > > > You say that the error happened at Math::BigFloat version 1.9991 at line > 507. This is inside the bcmp() method. The code around line 507 looks like > this: > > 506 my $xz = $x->is_zero(); > 507 my $yz = $y->is_zero(); > 508 return 0 if $xz && $yz; # 0 <=> 0 > > For some reason, $y is an unblessed reference. I have tried to reproduce > the error you are seeing, but every attempt so far has made my program fail > before it gets to line 507 of Math::BigFloat. > > If you want me to dig further into this, I am afraid you have to show me > what $x and $y are in the call to bcmp(). >