Remove a long-vestigial PUTBACK from the tied OPEN code in pp_send.
authorNicholas Clark <nick@ccl4.org>
Tue, 4 Jan 2011 10:13:42 +0000 (10:13 +0000)
committerNicholas Clark <nick@ccl4.org>
Tue, 4 Jan 2011 10:30:27 +0000 (10:30 +0000)
Commit 4592e6caefc41a75, from 1999, added the PUTBACK as part of the initial
implementation of tied OPEN. At this time, pp_open (as then was) popped the
arguments off the stack (to local variables), so the new tie code pushed them
back onto the stack, before calling the method. The stack position was
manipulated, hence the local variable sp had potentially diverged from the
global PL_stack_sp, hence the latter needed updating.

Commit a567e93b903bc984, from 2001, which added support for
open $fh, '|-', @array; refactored pp_open to avoid all stack manipulation.
Hence sp (the local variable) never changes along this code path, hence it
never needs to be written back to PL_stack_sp.

pp_sys.c

index cf6263a..5eb7000 100644 (file)
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -538,7 +538,6 @@ PP(pp_open)
            /* ... except handle is replaced by the object */
            PUSHMARK(MARK - 1);
            *MARK = SvTIED_obj(MUTABLE_SV(io), mg);
-           PUTBACK;
            ENTER_with_name("call_OPEN");
            call_method("OPEN", G_SCALAR);
            LEAVE_with_name("call_OPEN");