Skip to content
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

[PATCH] CPAN RT 96254 and 96329: Correct the handling of subclasses #13931

Closed
p5pRT opened this issue Jun 17, 2014 · 7 comments
Closed

[PATCH] CPAN RT 96254 and 96329: Correct the handling of subclasses #13931

p5pRT opened this issue Jun 17, 2014 · 7 comments

Comments

@p5pRT
Copy link

p5pRT commented Jun 17, 2014

Migrated from rt.perl.org#122118 (status was 'resolved')

Searchable as RT122118$

@p5pRT
Copy link
Author

p5pRT commented Jun 17, 2014

From @pjacklam

This patch fixes two related CPAN RTs. Without this patch, I can reproduce the error, without the patch, everything looks fine.

@p5pRT
Copy link
Author

p5pRT commented Jun 17, 2014

From @pjacklam

0001-CPAN-RT-96254-and-96329-Correct-the-handling-of-subc.patch
From 0ab501997776ffa2c34bbfbf50a0286ecab46e21 Mon Sep 17 00:00:00 2001
From: pjacklam <pjacklam@gmail.com>
Date: Sun, 15 Jun 2014 18:46:52 +0200
Subject: [PATCH] CPAN RT 96254 and 96329: Correct the handling of subclasses.

Don't check for an exact class name; trust inheritance.
---
 dist/Math-BigInt/lib/Math/BigInt.pm |   18 ++++++------------
 1 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/dist/Math-BigInt/lib/Math/BigInt.pm b/dist/Math-BigInt/lib/Math/BigInt.pm
index 7dd3d41..6bcc13f 100644
--- a/dist/Math-BigInt/lib/Math/BigInt.pm
+++ b/dist/Math-BigInt/lib/Math/BigInt.pm
@@ -2675,28 +2675,22 @@ sub objectify {
     for my $i (1 .. $count) {
         my $ref = ref $a[$i];
 
-        # If it is an object of the right class, all is fine.
-
-        if ($ref eq $a[0]) {
-            next;
-        }
-
-        # Don't do anything with undefs.
+        # Perl scalars are fed to the appropriate constructor.
 
-        unless (defined($a[$i])) {
+        unless ($ref) {
+            $a[$i] = $a[0] -> new($a[$i]);
             next;
         }
 
-        # Perl scalars are fed to the appropriate constructor.
+        # If it is an object of the right class, all is fine.
 
-        unless ($ref) {
-            $a[$i] = $a[0] -> new($a[$i]);
+        if ($ref -> isa($a[0])) {
             next;
         }
 
         # Upgrading is OK, so skip further tests if the argument is upgraded.
 
-        if (defined $up && $ref eq $up) {
+        if (defined $up && $ref -> isa($up)) {
             next;
         }
 
-- 
1.7.9

@p5pRT
Copy link
Author

p5pRT commented Jun 18, 2014

From @tonycoz

On Tue Jun 17 01​:40​:08 2014, pjacklam wrote​:

This patch fixes two related CPAN RTs. Without this patch, I can
reproduce the error, without the patch, everything looks fine.

This patch uses a different email address to your usual patch address​:

  From​: pjacklam <pjacklam@​gmail.com>

Is that intentional?

If not, I can amend to change it to your usual "Peter John Acklam <pjacklam@​online.no>".

Tony

@p5pRT
Copy link
Author

p5pRT commented Jun 18, 2014

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Jun 18, 2014

From @pjacklam

Tony Cook via RT [perlbug-followup@​perl.org]​:

This patch uses a different email address to your usual patch address​:

From​: pjacklam <pjacklam@​gmail.com>

Is that intentional?

If not, I can amend to change it to your usual "Peter John Acklam <pjacklam@​online.no>".

That was a mistanke on my part. Please change to pjacklam@​online.no.

Sorry for the inconvenience.

Best regards,
Peter

@p5pRT
Copy link
Author

p5pRT commented Jun 25, 2014

From @tonycoz

On Tue Jun 17 01​:40​:08 2014, pjacklam wrote​:

This patch fixes two related CPAN RTs. Without this patch, I can
reproduce the error, without the patch, everything looks fine.

Thanks, applied as 0f9d285 with the agreed upon author rewrite.

Tony

@p5pRT
Copy link
Author

p5pRT commented Jun 25, 2014

@tonycoz - Status changed from 'open' to 'resolved'

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

No branches or pull requests

1 participant