summaryrefslogtreecommitdiff
path: root/dist/Data-Dumper/Dumper.xs
diff options
context:
space:
mode:
authorAaron Crane <arc@cpan.org>2018-04-21 20:16:05 +0200
committerAaron Crane <arc@cpan.org>2018-07-22 13:41:37 +0100
commit32c3a17ab0b35b1efd5eb34c121492d3e7bfefcc (patch)
tree15798a118dabce2895fda2912bfce0aaf452a4bc /dist/Data-Dumper/Dumper.xs
parent00ec40a9bf1e535ebdff5b68456e4a06aa171211 (diff)
downloadperl-32c3a17ab0b35b1efd5eb34c121492d3e7bfefcc.tar.gz
Data::Dumper: restore XS-mode deparse support in older Perls
Diffstat (limited to 'dist/Data-Dumper/Dumper.xs')
-rw-r--r--dist/Data-Dumper/Dumper.xs15
1 files changed, 15 insertions, 0 deletions
diff --git a/dist/Data-Dumper/Dumper.xs b/dist/Data-Dumper/Dumper.xs
index 95571913ea..66bd1fd530 100644
--- a/dist/Data-Dumper/Dumper.xs
+++ b/dist/Data-Dumper/Dumper.xs
@@ -555,8 +555,23 @@ deparsed_output(pTHX_ SV *val)
* modifies it (so we also can't reuse it below) */
SV *pkg = newSVpvs("B::Deparse");
+ /* Commit ebdc88085efa6fca8a1b0afaa388f0491bdccd5a (first released as part
+ * of 5.19.7) changed core S_process_special_blocks() to use a new stack
+ * for anything using a BEGIN block, on the grounds that doing so "avoids
+ * the stack moving underneath anything that directly or indirectly calls
+ * Perl_load_module()". If we're in an older Perl, we can't rely on that
+ * stack, and must create a fresh sacrificial stack of our own. */
+#if PERL_VERSION < 20
+ PUSHSTACKi(PERLSI_REQUIRE);
+#endif
+
load_module(PERL_LOADMOD_NOIMPORT, pkg, 0);
+#if PERL_VERSION < 20
+ POPSTACK;
+ SPAGAIN;
+#endif
+
SAVETMPS;
PUSHMARK(SP);