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
Bleadperl v5.19.1-480-g9baac1a breaks COWENS/autobox-dump-20090426.1746.tar.gz, APLA/Project-Easy-0.30.tar.gz #13113
Comments
From @andkgit bisect commit 9baac1a Data::Dumper: useqq implementation for xs diagnostics http://www.cpantesters.org/cpan/report/9054ada6-eefd-11e2-8c2c-94abf1ff63fb No new enough reports yet available on cpantesters for autobox-dump. perl -V Summary of my perl5 (revision 5 version 19 subversion 2) configuration: Characteristics of this binary (from libperl): -- |
From @tonycozOn Fri Jul 19 02:50:51 2013, andreas.koenig.7os6VVqR@franz.ak.mind.de wrote:
The failure in Project::Easy is from it fiddling directly with the Project::Easy::Config::Format::perl contains the code: { and then forces Useqq later to try to force the perl Dump() to be used. Since the XS dumper doesn't call sub qquote() the replacement doesn't occur. autobox-dump looks like a different problem. Tony |
The RT System itself - Status changed from 'new' to 'open' |
From @tonycozOn Sun Jul 21 18:28:32 2013, tonyc wrote:
Which it is. The pure-perl dumper (with or without useqq) outputs SVs which can be The XS non-useqq code however doesn't do this. rather than probably The attached patch, which I'll apply post 5.19.2 (and probably with a I don't plan on any changes to support Project::Easy, that's purely a Tony |
From @tonycozOn Sun Jul 21 22:31:54 2013, tonyc wrote:
Now with more attachment. Tony |
From @tonycoz0001-perl-74798-improved-useqq-compatibility-with-the-pur.patchFrom f8e039f96e269609b4b496ca3fc8f15b1ea8c393 Mon Sep 17 00:00:00 2001
From: Tony Cook <tony@develop-help.com>
Date: Mon, 22 Jul 2013 14:59:57 +1000
Subject: [PATCH] [perl #74798] improved useqq compatibility with the pure
perl version
Currently for non-useqq, the pure perl and XS output for numbers like
these is different, but XS useqq is new, so try to remain vaguely
compatible.
---
dist/Data-Dumper/Dumper.xs | 45 +++++++++++++++++++++++++++++++++++++++++++
dist/Data-Dumper/t/dumper.t | 21 ++++++++++++++++++--
2 files changed, 64 insertions(+), 2 deletions(-)
diff --git a/dist/Data-Dumper/Dumper.xs b/dist/Data-Dumper/Dumper.xs
index 0194a2c..3bcb2f4 100644
--- a/dist/Data-Dumper/Dumper.xs
+++ b/dist/Data-Dumper/Dumper.xs
@@ -119,6 +119,42 @@ TOP:
return 0;
}
+/* Check that the SV can be represented as a simple decimal integer.
+ *
+ * The perl code does this by matching against /^(?:0|-?[1-9]\d{0,8})\z/
+*/
+static I32
+safe_decimal_number(SV *val) {
+ STRLEN len;
+ const char *p = SvPV(val, len);
+
+ if (len == 1 && *p == '0')
+ return TRUE;
+
+ if (len && *p == '-') {
+ ++p;
+ --len;
+ }
+
+ if (len == 0 || *p < '1' || *p > '9')
+ return FALSE;
+
+ ++p;
+ --len;
+
+ if (len > 8)
+ return FALSE;
+
+ while (len > 0) {
+ /* the perl code checks /\d/ but we don't want unicode digits here */
+ if (*p < '0' || *p > '9')
+ return FALSE;
+ ++p;
+ --len;
+ }
+ return TRUE;
+}
+
/* count the number of "'"s and "\"s in string */
static I32
num_q(const char *s, STRLEN slen)
@@ -1115,6 +1151,15 @@ DD_dump(pTHX_ SV *val, const char *name, STRLEN namelen, SV *retval, HV *seenhv,
sv_catpvn(retval, (const char *)mg->mg_ptr, mg->mg_len);
}
#endif
+
+ /* the pure perl and XS non-qq outputs have historically been
+ * different in this case, but for useqq, let's try to match
+ * the pure perl code.
+ * see [perl #74798]
+ */
+ else if (useqq && safe_decimal_number(val)) {
+ sv_catsv(retval, val);
+ }
else {
integer_came_from_string:
c = SvPV(val, i);
diff --git a/dist/Data-Dumper/t/dumper.t b/dist/Data-Dumper/t/dumper.t
index 0a3c28c..dbc6d5e 100644
--- a/dist/Data-Dumper/t/dumper.t
+++ b/dist/Data-Dumper/t/dumper.t
@@ -83,11 +83,11 @@ sub SKIP_TEST {
$Data::Dumper::Useperl = 1;
if (defined &Data::Dumper::Dumpxs) {
print "### XS extension loaded, will run XS tests\n";
- $TMAX = 420; $XS = 1;
+ $TMAX = 426; $XS = 1;
}
else {
print "### XS extensions not loaded, will NOT run XS tests\n";
- $TMAX = 210; $XS = 0;
+ $TMAX = 213; $XS = 0;
}
print "1..$TMAX\n";
@@ -1555,4 +1555,21 @@ EOW
"\\ octal followed by unicode digit";
TEST q(Data::Dumper->Dumpxs(["\\x00\\x{0660}"])), '\\ octal followed by unicode digit (xs)'
if $XS;
+
+ # [perl #118933 - handling of digits
+$WANT = <<'EOW';
+#$VAR1 = 0;
+#$VAR2 = 1;
+#$VAR3 = 90;
+#$VAR4 = -10;
+#$VAR5 = "010";
+#$VAR6 = 112345678;
+#$VAR7 = "1234567890";
+EOW
+ TEST q(Data::Dumper->Dump([0, 1, 90, -10, "010", "112345678", "1234567890" ])),
+ "numbers and number-like scalars";
+
+ TEST q(Data::Dumper->Dumpxs([0, 1, 90, -10, "010", "112345678", "1234567890" ])),
+ "numbers and number-like scalars"
+ if $XS;
}
--
1.7.10.4
|
From @nwc10On Sun, Jul 21, 2013 at 10:34:22PM -0700, Tony Cook via RT wrote:
Wouldn't that be better as static BOOL? Nicholas Clark |
From @tonycozOn Mon, Jul 22, 2013 at 08:01:34AM +0100, Nicholas Clark wrote:
I'll fix that. Tony |
From @tonycozOn Mon Jul 22 02:57:17 2013, tonyc wrote:
Applied with fix as 059639d. I've opened a ticket against Project::Easy: https://rt.cpan.org/Ticket/Display.html?id=87171 Tony |
From @tonycozOn Mon Jul 22 16:54:17 2013, tonyc wrote:
Since I've fixed the problem causing autobox-dump to fail, and reported Tony |
@tonycoz - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#118933 (status was 'resolved')
Searchable as RT118933$
The text was updated successfully, but these errors were encountered: