summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorFelipe Gasper <felipe@felipegasper.com>2022-11-21 10:26:52 -0500
committerTony Cook <tony@develop-help.com>2022-11-23 10:29:22 +1100
commit12c7085de6f5d5be7f82f08e9004b47bb11a5b6b (patch)
tree7a8f4ed931d76246f28fde27d2822e26dac333da /op.c
parentb06fe7cd385b906678c23d196beb73ae02812551 (diff)
downloadperl-12c7085de6f5d5be7f82f08e9004b47bb11a5b6b.tar.gz
Fix XS modules (e.g., Function::Parameters) that create anonsubs.
Issue #20384: Commit 20d507b5869b116c3b1f8aeea48fbfbf68dfce60 broke CPAN’s Function::Parameters. This updates that logic to (hopefully) differentiate OP_ANONCODE from an XS module versus from Perl.
Diffstat (limited to 'op.c')
-rw-r--r--op.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/op.c b/op.c
index 74825a58eb..4b054480e6 100644
--- a/op.c
+++ b/op.c
@@ -3454,7 +3454,16 @@ Perl_op_lvalue_flags(pTHX_ OP *o, I32 type, U32 flags)
* set flag here.
* See also https://github.com/Perl/perl5/issues/20384
*/
- goto nomod;
+
+ // Perl always sets OPf_REF as of 5.37.5.
+ //
+ if (LIKELY(o->op_flags & OPf_REF)) goto nomod;
+
+ // If we got here, then our op came from an XS module that predates
+ // 5.37.5’s change to the op tree, which we have to handle a bit
+ // diffrently to preserve backward compatibility.
+ //
+ goto do_next;
}
/* [20011101.069 (#7861)] File test operators interpret OPf_REF to mean that