Skip to content

Commit 1c33371

Browse files
committed
sv.c: Clone interpreter with locale set to C
A thread is supposed to start with the locale set to the C locale. We were duping the parent values, and later overriding. Better to set to C from the beginning.
1 parent 2c8e798 commit 1c33371

File tree

1 file changed

+20
-19
lines changed

1 file changed

+20
-19
lines changed

sv.c

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15888,31 +15888,32 @@ perl_clone_using(PerlInterpreter *proto_perl, UV flags,
1588815888

1588915889
#ifdef USE_PL_CURLOCALES
1589015890
for (i = 0; i < (int) C_ARRAY_LENGTH(PL_curlocales); i++) {
15891-
PL_curlocales[i] = SAVEPV(proto_perl->Icurlocales[i]);
15891+
PL_curlocales[i] = SAVEPV("C");
1589215892
}
1589315893
#endif
1589415894
#ifdef USE_LOCALE_CTYPE
15895-
Copy(proto_perl->Ifold_locale, PL_fold_locale, 256, U8);
15895+
Copy(PL_fold, PL_fold_locale, 256, U8);
15896+
1589615897
/* Should we warn if uses locale? */
15897-
PL_ctype_name = SAVEPV(proto_perl->Ictype_name);
15898+
PL_ctype_name = SAVEPV("C");
1589815899
PL_warn_locale = sv_dup_inc(proto_perl->Iwarn_locale, param);
15899-
PL_in_utf8_CTYPE_locale = proto_perl->Iin_utf8_CTYPE_locale;
15900-
PL_in_utf8_turkic_locale = proto_perl->Iin_utf8_turkic_locale;
15900+
PL_in_utf8_CTYPE_locale = false;
15901+
PL_in_utf8_turkic_locale = false;
1590115902
#endif
1590215903

1590315904
/* Did the locale setup indicate UTF-8? */
15904-
PL_utf8locale = proto_perl->Iutf8locale;
15905+
PL_utf8locale = false;
1590515906

1590615907
#ifdef USE_LOCALE_COLLATE
15907-
PL_in_utf8_COLLATE_locale = proto_perl->Iin_utf8_COLLATE_locale;
15908-
PL_collation_name = SAVEPV(proto_perl->Icollation_name);
15908+
PL_in_utf8_COLLATE_locale = false;
15909+
PL_collation_name = SAVEPV("C");
1590915910
PL_collation_ix = proto_perl->Icollation_ix;
15910-
PL_collation_standard = proto_perl->Icollation_standard;
15911-
PL_collxfrm_base = proto_perl->Icollxfrm_base;
15912-
PL_collxfrm_mult = proto_perl->Icollxfrm_mult;
15913-
PL_strxfrm_max_cp = proto_perl->Istrxfrm_max_cp;
15911+
PL_collation_standard = true;
15912+
PL_collxfrm_base = 0;
15913+
PL_collxfrm_mult = 0;
15914+
PL_strxfrm_max_cp = 0;
1591415915
PL_strxfrm_is_behaved = proto_perl->Istrxfrm_is_behaved;
15915-
PL_strxfrm_NUL_replacement = proto_perl->Istrxfrm_NUL_replacement;
15916+
PL_strxfrm_NUL_replacement = '\0';
1591615917
#endif /* USE_LOCALE_COLLATE */
1591715918

1591815919
#ifdef USE_LOCALE_THREADS
@@ -15921,12 +15922,12 @@ perl_clone_using(PerlInterpreter *proto_perl, UV flags,
1592115922
#endif
1592215923

1592315924
#ifdef USE_LOCALE_NUMERIC
15924-
PL_numeric_name = SAVEPV(proto_perl->Inumeric_name);
15925-
PL_numeric_radix_sv = sv_dup_inc(proto_perl->Inumeric_radix_sv, param);
15926-
PL_underlying_radix_sv = sv_dup_inc(proto_perl->Iunderlying_radix_sv, param);
15927-
PL_numeric_standard = proto_perl->Inumeric_standard;
15928-
PL_numeric_underlying = proto_perl->Inumeric_underlying;
15929-
PL_numeric_underlying_is_standard = proto_perl->Inumeric_underlying_is_standard;
15925+
PL_numeric_name = SAVEPV("C");
15926+
PL_numeric_radix_sv = newSVpvs(".");
15927+
PL_underlying_radix_sv = newSVpvs(".");
15928+
PL_numeric_standard = true;
15929+
PL_numeric_underlying = true;
15930+
PL_numeric_underlying_is_standard = true;
1593015931

1593115932
# if defined(USE_POSIX_2008_LOCALE)
1593215933
PL_underlying_numeric_obj = NULL;

0 commit comments

Comments
 (0)