diff options
-rw-r--r-- | cop.h | 4 | ||||
-rw-r--r-- | t/comp/parser.t | 7 |
2 files changed, 8 insertions, 3 deletions
@@ -429,8 +429,8 @@ struct cop { #define CopFILESV(c) (CopFILEGV(c) ? GvSV(CopFILEGV(c)) : NULL) #define CopFILEAV(c) (CopFILEGV(c) ? GvAV(CopFILEGV(c)) : NULL) #define CopFILEAVx(c) (assert_(CopFILEGV(c)) GvAV(CopFILEGV(c))) -#define CopFILE(c) (CopFILEGV(c) && GvSV(CopFILEGV(c)) \ - ? SvPVX(GvSV(CopFILEGV(c))) : NULL) +#define CopFILE(c) (CopFILEGV(c) \ + ? GvNAME(CopFILEGV(c))+2 : NULL) #define CopSTASHPV(c) (CopSTASH(c) ? HvNAME_get(CopSTASH(c)) : NULL) /* cop_stash is not refcounted */ #define CopSTASHPV_set(c,pv) CopSTASH_set((c), gv_stashpv(pv,GV_ADD)) diff --git a/t/comp/parser.t b/t/comp/parser.t index 5f0d40734d..a9b044a518 100644 --- a/t/comp/parser.t +++ b/t/comp/parser.t @@ -8,7 +8,7 @@ BEGIN { chdir 't'; } -print "1..157\n"; +print "1..158\n"; sub failed { my ($got, $expected, $name) = @_; @@ -482,6 +482,11 @@ for(__PACKAGE__) { is $_, 'main', '__PACKAGE__ is read-only'; } +$file = __FILE__; +BEGIN{ ${"_<".__FILE__} = \1 } +is __FILE__, $file, + 'no __FILE__ corruption when setting CopFILESV to a ref'; + # Add new tests HERE (above this line) # bug #74022: Loop on characters in \p{OtherIDContinue} |