New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Doing split on the result of a slurped empty file results in a Null PMC Access in rakudo #268
Comments
From @masakr30374: $ < empty ./perl6 -e 'say $*IN.slurp.WHAT' # yes |
From @ronaldxs
The following variation of your script may provide some insight into < empty ./perl6 -e 'my $x = ""; my The script outputs when run: split simple empty str |
The RT System itself - Status changed from 'new' to 'open' |
From @ronaldxs
Two proposed patches attached. The patch to src/pmc/parrotiio.pmc seems Ron |
From @ronaldxsfix_empty_io.patchIndex: src/pmc/parrotio.pmc
===================================================================
--- src/pmc/parrotio.pmc (revision 30637)
+++ src/pmc/parrotio.pmc (working copy)
@@ -307,7 +307,7 @@
Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_PIO_ERROR,
"Cannot slurp from empty filehandle");
- result = NULL;
+ result = string_make_empty(INTERP, enum_stringrep_one, 0);
do {
STRING * const part = PIO_reads(INTERP, SELF, 4096);
Index: languages/perl6/src/classes/Str.pir
===================================================================
--- languages/perl6/src/classes/Str.pir (revision 30637)
+++ languages/perl6/src/classes/Str.pir (working copy)
@@ -46,7 +46,7 @@
.return(retv)
.end
-.sub 'split' :method :multi('Perl6Str')
+.sub 'split' :method
.param string delim
.local string objst
.local pmc pieces
|
From @masak---------- Forwarded message ----------
Two proposed patches attached. The patch to src/pmc/parrotiio.pmc seems Ron |
From @masakfix_empty_io.patchIndex: src/pmc/parrotio.pmc
===================================================================
--- src/pmc/parrotio.pmc (revision 30637)
+++ src/pmc/parrotio.pmc (working copy)
@@ -307,7 +307,7 @@
Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_PIO_ERROR,
"Cannot slurp from empty filehandle");
- result = NULL;
+ result = string_make_empty(INTERP, enum_stringrep_one, 0);
do {
STRING * const part = PIO_reads(INTERP, SELF, 4096);
Index: languages/perl6/src/classes/Str.pir
===================================================================
--- languages/perl6/src/classes/Str.pir (revision 30637)
+++ languages/perl6/src/classes/Str.pir (working copy)
@@ -46,7 +46,7 @@
.return(retv)
.end
-.sub 'split' :method :multi('Perl6Str')
+.sub 'split' :method
.param string delim
.local string objst
.local pmc pieces
|
From @jnthnOn Fri Aug 29 13:14:19 2008, ronaldxs wrote:
Thanks for the patches! The first one to ParrotIO, I fully agree with so The second patch was not quite correct - we need to have it :multi for .sub 'split' :method :multi('String') So it's a bit more liberal about what sorts of strings it gets for now. Thanks! Jonathan |
@jnthn - Status changed from 'open' to 'resolved' |
From @pmichaudOn Thu, Sep 11, 2008 at 05:34:14AM -0700, jnthn@jnthn.net via RT wrote:
Not only that, but split needs to go into Any so that we can Pm |
Migrated from rt.perl.org#58150 (status was 'resolved')
Searchable as RT58150$
The text was updated successfully, but these errors were encountered: