On 11/09/2016 09:21 PM, demerphq wrote: > On 9 November 2016 at 20:17, Hugo van der Sanden via RT > <perlbug-followup@perl.org> wrote: >> I was able to reduce it further to a standalone case: >> >> % cat lib/Unicode/EastAsianWidth.pm >> package Unicode::EastAsianWidth; >> use strict; >> use base 'Exporter'; >> >> our @EXPORT = qw(InFullwidth); >> >> sub InFullwidth { >> return <<END; >> END >> } >> >> 1; >> __END__ >> % perl -Ilib -e 'A::xx(); package A { use Unicode::EastAsianWidth; sub xx { split /[^\s\p{InFullwidth}]/, "x" } }' >> perl: util.c:1880: Perl_croak_no_modify: Assertion `0' failed. >> Aborted (core dumped) >> % >> >> Note that if the module is C<use>d before the package declaration, the assertion is not hit. > Oooh. ++ Even further: > > ./perl -Ilib -e 'A::xx(); package A; sub InFullwidth{ return "\n" } > sub xx { split /[^\s\p{InFullwidth}]/, "x" }' > SV = INVLIST(0x2391d00) at 0x2387178 > REFCNT = 1 > FLAGS = (READONLY,PROTECT) > PV = 0x2464530 > CUR = 0 > LEN = 9 > perl: util.c:1880: Perl_croak_no_modify: Assertion `0' failed. > Aborted > > If I replace the \s with its logical equivalent there is no assert: > > ./perl -Ilib -e 'A::xx(); package A { sub InFullwidth{ return "\n" } > sub xx { split /[^ \t\r\n\p{InFullwidth}]/, "x" } }' > > and if I replace it with \w there is also no assert, but with \s, \h, > \d there is. > > I have been poking around a bit more, and the place the invlist gets > its readonly flag turned on is the end of Perl__swash_to_invlist(). > > It looks to me like it gets compiled once, then for some reason we try > to compile it again, and it blows up. > > Yves I have enough info to debug now. User-defined properties are implemented by the user defining subroutines. A subroutine need not be defined at the lexical calling point. That's why these properties need to be deferable until runtime.Thread Previous | Thread Next