[rt.cpan.org #143774] [PATCH] Explicitly return a string SV from Wx::InputStream::READLINE

[email protected] ("gregor herrmann via RT") Fri, 15 Jul 2022 15:05:59 -0400
Newsgroups perl.wxperl.users
Message-ID <[email protected]>
------------=_1657911959-6005-8
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit

Fri Jul 15 15:05:59 2022: Request 143774 was acted upon.
Transaction: Correspondence added by GREGOA
       Queue: Wx
     Subject: [PATCH] Explicitly return a string SV from Wx::InputStream::READLINE
   Broken in: (no value)
    Severity: (no value)
       Owner: Nobody
  Requestors: [email protected]
      Status: new
 Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=143774 >


Here is the current version of the patch.

------------=_1657911959-6005-8
Content-Type: text/x-diff;
 charset="ascii";
 name="0001-Explicitly-return-a-string-SV-from-Wx-InputStream-RE.patch"
Content-Disposition: attachment;
 filename="0001-Explicitly-return-a-string-SV-from-Wx-InputStream-RE.patch"
Content-Transfer-Encoding: 7bit
RT-Attachment: 143774/2293241/1081754

From 41bcb4f309b5a8f13dfa9c6d417369938cbe6060 Mon Sep 17 00:00:00 2001
From: Niko Tyni <[email protected]>
Date: Sun, 10 Jul 2022 16:53:10 +0100
Subject: [PATCH] Explicitly return a string SV from Wx::InputStream::READLINE

Perl 5.35.9 changed SV integer / string handling slightly, resulting in
the return value from READLINE() to evaluate as false regardless of its
string contents, because it is initially created as the integer 0 and no
longer gets marked as a valid string. This broke the Wx-Perl-ProcessStream
distribution test suite.

Fix the regression by explicitly setting SvPOK on the return value,
mirroring the sibling READ() method.

Bug-Debian: https://bugs.debian.org/1014295
---
 XS/Stream.xs | 1 +
 1 file changed, 1 insertion(+)

diff --git a/XS/Stream.xs b/XS/Stream.xs
index b6ef184..f680394 100644
--- a/XS/Stream.xs
+++ b/XS/Stream.xs
@@ -97,6 +97,7 @@ Wx_InputStream::READLINE()
     if( THIS->Eof() ) { XSRETURN_UNDEF; }
     RETVAL = newSViv( 0 );
     buff = SvPV_nolen( RETVAL );
+    SvPOK_on( RETVAL );
 
     while( THIS->CanRead() && THIS->Read( &c, 1 ).LastRead() != 0 )
     {
-- 
2.35.2


------------=_1657911959-6005-8--