Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: 2efb6d394e29488b611089b2bf29ecb774d18e86
      
https://github.com/Perl/perl5/commit/2efb6d394e29488b611089b2bf29ecb774d18e86
  Author: Richard Leach <richardle...@users.noreply.github.com>
  Date:   2024-11-25 (Mon, 25 Nov 2024)

  Changed paths:
    M ext/B/t/optree_varinit.t
    M op.c
    M pod/perldelta.pod
    M t/op/state.t

  Log Message:
  -----------
  S_newONCEOP: correctly copy array/hash at subroutine exit

Should a _state_ array or hash be declared immediately prior to
returning, the error "Bizarre copy of HASH in subroutine exit" error
would be triggered. Now, the array or hash is returned without error.

Specifically:
 * Instead of always creating a PADSV, the appropriate padop is created.
 * The OPf_REF flag is switched off, allowing the return of the
   container variable's contents rather than the container SV itself.
 * The OPf_MOD & OPf_SPECIAL flags are switches off, as they are not
   relevant to this version of the padop.

Note: The op created has been renamed from "other" to "nextop", since
it is linked to the ONCE op via op_next, not op_other.

Fixes GH#18630


  Commit: 1b81858b3f393b37f2ee28aa7caaa5ee380894a4
      
https://github.com/Perl/perl5/commit/1b81858b3f393b37f2ee28aa7caaa5ee380894a4
  Author: Richard Leach <richardle...@users.noreply.github.com>
  Date:   2024-11-25 (Mon, 25 Nov 2024)

  Changed paths:
    M ext/B/t/optree_varinit.t
    M op.c
    M t/op/state.t

  Log Message:
  -----------
  S_newONCEOP/Perl_scalarvoid: skip over padops useless in void context

Prior to this commit, padops associated with OP_ONCE might serve no
purpose in a void context. Since the context is not known at the point
of the OP_ONCE creation, the padops have retained the STATE flag, but
not the LVINTRO flag. This prevented Perl_scalarvoid from warning
"Useless use of private variable in void context".

In this commit, the STATE flag is removed and Perl_scalarvoid modified
such that when a OP_ONCE padop is found in void context, the op_next
pointer on the OP_ONCE is silently modified to skip over the padop.


Compare: https://github.com/Perl/perl5/compare/883bf45bbc7f...1b81858b3f39

To unsubscribe from these emails, change your notification settings at 
https://github.com/Perl/perl5/settings/notifications

Reply via email to