From: Vincent Pit Date: Tue, 14 Jul 2009 12:25:22 +0000 (+0200) Subject: Only enable the pragma during compile time X-Git-Tag: rt47866 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=36d7d348a3f321577d4700e01ac61a7fd0a60a65;p=perl%2Fmodules%2Findirect.git Only enable the pragma during compile time In particular, don't handle OPs that are created as part of load_module(). This solves RT #47866. --- diff --git a/MANIFEST b/MANIFEST index a07400d..4088973 100644 --- 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 diff --git a/indirect.xs b/indirect.xs index 12e83d5..45309ce 100644 --- a/indirect.xs +++ b/indirect.xs @@ -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 index 0000000..7d05c82 --- /dev/null +++ b/t/80-regressions.t @@ -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'; +}