Only enable the pragma during compile time rt47866
authorVincent Pit <vince@profvince.com>
Tue, 14 Jul 2009 12:25:22 +0000 (14:25 +0200)
committerVincent Pit <vince@profvince.com>
Tue, 14 Jul 2009 12:26:29 +0000 (14:26 +0200)
In particular, don't handle OPs that are created as part of load_module().
This solves RT #47866.

MANIFEST
indirect.xs
t/80-regressions.t [new file with mode: 0644]

index a07400d..4088973 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -17,6 +17,7 @@ t/30-scope.t
 t/40-threads.t
 t/41-memory.t
 t/42-stress.t
+t/80-regressions.t
 t/91-pod.t
 t/92-pod-coverage.t
 t/95-portability-files.t
index 12e83d5..45309ce 100644 (file)
@@ -351,6 +351,10 @@ STATIC U32 indirect_hash = 0;
 STATIC SV *indirect_hint(pTHX) {
 #define indirect_hint() indirect_hint(aTHX)
  SV *hint;
+
+ if (IN_PERL_RUNTIME)
+  return NULL;
+
 #if I_HAS_PERL(5, 9, 5)
  hint = Perl_refcounted_he_fetch(aTHX_ PL_curcop->cop_hints_hash,
                                        NULL,
@@ -358,11 +362,13 @@ STATIC SV *indirect_hint(pTHX) {
                                        0,
                                        indirect_hash);
 #else
- SV **val = hv_fetch(GvHV(PL_hintgv), __PACKAGE__, __PACKAGE_LEN__,
+ {
+  SV **val = hv_fetch(GvHV(PL_hintgv), __PACKAGE__, __PACKAGE_LEN__,
                                                                  indirect_hash);
- if (!val)
-  return 0;
- hint = *val;
+  if (!val)
+   return 0;
+  hint = *val;
+ }
 #endif
  return indirect_detag(hint);
 }
diff --git a/t/80-regressions.t b/t/80-regressions.t
new file mode 100644 (file)
index 0000000..7d05c82
--- /dev/null
@@ -0,0 +1,18 @@
+#!perl
+
+use strict;
+use warnings;
+
+use Test::More tests => 1;
+
+sub run_perl {
+ my $code = shift;
+
+ local %ENV;
+ system { $^X } $^X, '-T', map("-I$_", @INC), '-e', $code;
+}
+
+{
+ my $status = run_perl 'no indirect; print "a\x{100}b" =~ /\A[\x00-\x7f]*\z/;';
+ is $status, 0, 'RT #47866';
+}