This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #126480] pipe() doesn't need the assertions
authorTony Cook <tony@develop-help.com>
Tue, 24 Nov 2015 03:37:35 +0000 (14:37 +1100)
committerTony Cook <tony@develop-help.com>
Tue, 24 Nov 2015 03:37:35 +0000 (14:37 +1100)
GvIOn() already performs the checks and produces a nice error message,
and similar functions, such as open() and socket(), don't have
assertions on this condition.

MANIFEST
pp_sys.c
t/lib/croak/pp_sys [new file with mode: 0644]

index c950e29..ca2c455 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -5047,6 +5047,7 @@ t/lib/croak/op                    Test croak calls from op.c
 t/lib/croak/pp                 Test croak calls from pp.c
 t/lib/croak/pp_ctl             Test croak calls from pp_ctl.c
 t/lib/croak/pp_hot             Test croak calls from pp_hot.c
+t/lib/croak/pp_sys             Test croak calls from pp_sys.c
 t/lib/croak.t                  Test calls to Perl_croak() in the C source.
 t/lib/croak/toke               Test croak calls from toke.c
 t/lib/cygwin.t                 Builtin cygwin function tests
index 373590f..15b4d8b 100644 (file)
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -695,8 +695,6 @@ PP(pp_pipe_op)
     GV * const wgv = MUTABLE_GV(POPs);
     GV * const rgv = MUTABLE_GV(POPs);
 
-    assert (isGV_with_GP(rgv));
-    assert (isGV_with_GP(wgv));
     rstio = GvIOn(rgv);
     if (IoIFP(rstio))
        do_close(rgv, FALSE);
diff --git a/t/lib/croak/pp_sys b/t/lib/croak/pp_sys
new file mode 100644 (file)
index 0000000..739b7e9
--- /dev/null
@@ -0,0 +1,16 @@
+__END__
+# pp_sys.c
+# NAME pipe() croaks on bad left side [perl #126480]
+# SKIP ? use Config; !$Config{d_pipe} && "No pipe() available"
+my $fh;
+pipe($$5, $fh)
+EXPECT
+Bad symbol for filehandle at - line 3.
+########
+# NAME pipe() croaks on bad right side [perl #126480]
+# SKIP ? use Config; !$Config{d_pipe} && "No pipe() available"
+my $fh;
+pipe($fh, $$5)
+EXPECT
+Bad symbol for filehandle at - line 2.
+########