In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/b14845b4fc65ba895fe9fe5f9cc346c5c235c28b?hp=ae073b6b0ee43101d6f58b772fe59ff4f3a2df20>

- Log -----------------------------------------------------------------
commit b14845b4fc65ba895fe9fe5f9cc346c5c235c28b
Author: Father Chrysostomos <[email protected]>
Date:   Thu Apr 19 16:32:08 2012 -0700

    [perl #111980] Don’t allow ‘my $♠’
    
    For consistency with ‘my $!’, ‘my $-’, etc., forbid lexical punctua-
    tion variables made up of non-ASCII characters.  It was by mistake
    that 204e6232679 allowed this.
-----------------------------------------------------------------------

Summary of changes:
 op.c           |    5 +++--
 t/lib/croak/op |   14 ++++++++++++++
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/op.c b/op.c
index 3deb025..6253462 100644
--- a/op.c
+++ b/op.c
@@ -428,11 +428,12 @@ Perl_allocmy(pTHX_ const char *const name, const STRLEN 
len, const U32 flags)
     if (len &&
        !(is_our ||
          isALPHA(name[1]) ||
-         ((flags & SVf_UTF8) && UTF8_IS_START(name[1])) ||
+         ((flags & SVf_UTF8) && isIDFIRST_utf8((U8 *)name+1)) ||
          (name[1] == '_' && (*name == '$' || len > 2))))
     {
        /* name[2] is true if strlen(name) > 2  */
-       if (!isPRINT(name[1]) || strchr("\t\n\r\f", name[1])) {
+       if (!(flags & SVf_UTF8 && UTF8_IS_START(name[1]))
+        && (!isPRINT(name[1]) || strchr("\t\n\r\f", name[1]))) {
            yyerror(Perl_form(aTHX_ "Can't use global %c^%c%.*s in \"%s\"",
                              name[0], toCTRL(name[1]), (int)(len - 2), name + 
2,
                              PL_parser->in_my == KEY_state ? "state" : "my"));
diff --git a/t/lib/croak/op b/t/lib/croak/op
index d47e828..eb5974f 100644
--- a/t/lib/croak/op
+++ b/t/lib/croak/op
@@ -1,4 +1,18 @@
 __END__
+# NAME my $<special>
+my $!;
+EXPECT
+Can't use global $! in "my" at - line 1, near "my $!"
+Execution of - aborted due to compilation errors.
+########
+# NAME my $<special_unicode>
+use utf8;
+BEGIN { binmode STDERR, ":utf8" }
+my $♠;
+EXPECT
+Can't use global $♠ in "my" at - line 3, near "my $♠"
+Execution of - aborted due to compilation errors.
+########
 # NAME OP_HELEM fields
 package Foo;
 use fields qw(a b);

--
Perl5 Master Repository

Reply via email to