From ba6ff154b0d807025f5294b2c3e9623fd60a6e97 Mon Sep 17 00:00:00 2001 From: Father Chrysostomos Date: Sat, 1 Oct 2011 06:30:35 -0700 Subject: [PATCH] =?utf8?q?[perl=20#99984]=20Incorrect=20errmsg=20with=20ou?= =?utf8?q?r=20$::=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Having PL_parser->error_count set to non-zero when utf8_heavy.pl tries to do() one of its swashes results in ‘Compilation error’ being placed in $@ during the do, even if it was successful. This patch sets the error_count to 0 before calling SWASHNEW, to prevent that. It uses SAVEI8, to make sure it is restored on scope exit. --- t/uni/lex_utf8.t | 9 ++++++++- utf8.c | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/t/uni/lex_utf8.t b/t/uni/lex_utf8.t index e080245..368185f 100644 --- a/t/uni/lex_utf8.t +++ b/t/uni/lex_utf8.t @@ -12,7 +12,7 @@ BEGIN { use strict; -plan (tests => 10); +plan (tests => 11); use charnames ':full'; use utf8; @@ -40,6 +40,13 @@ do { is((join "", unpack("C*", $uname_last)), "98" . "198" . "129" . "194" . "181", 'b . char above 0x100 . \N{U+00B5}'); is((join "", unpack("C*", $octal_first)), "99" . "195" . "191" . "196" . "134", 'c . \377 . char above 0x100'); is((join "", unpack("C*", $octal_last)), "99" . "196" . "134" . "195" . "191", 'c . char above 0x100 . \377'); +}; + +{ + local $SIG{__WARN__} = sub {}; + eval "our $::\xe9; $\xe9"; + unlike $@, qr/utf8_heavy/, + 'No utf8_heavy errors with our() syntax errors'; } __END__ diff --git a/utf8.c b/utf8.c index 4bab3a9..003e3fc 100644 --- a/utf8.c +++ b/utf8.c @@ -2050,6 +2050,8 @@ Perl_swash_init(pTHX_ const char* pkg, const char* name, SV *listsv, I32 minbits ENTER; SAVEHINTS(); save_re_context(); + if (PL_parser && PL_parser->error_count) + SAVEI8(PL_parser->error_count), PL_parser->error_count = 0; method = gv_fetchmeth(stash, "SWASHNEW", 8, -1); if (!method) { /* demand load utf8 */ ENTER; -- 1.8.3.1