diff --git a/NEWS.md b/NEWS.md index ee51abed4..f5f83a6c7 100644 --- a/NEWS.md +++ b/NEWS.md @@ -8,6 +8,8 @@ ## BUG FIXES +1. `test.data.table()` could fail the 2nd time it is run by a user in the same R session on Windows due to not resetting locale properly after testing Chinese translation, [#4630](https://github.com/Rdatatable/data.table/pull/4630). Thanks to Cole Miller for investigating and fixing. + ## NOTES 1. `bit64` v4.0.2 released on 30th July broke `data.table`'s tests. It seems that reverse dependency testing of `bit64` (i.e. testing of the packages which use `bit64`) did not include `data.table` because `data.table` merely suggests `bit64` and does not depend on it. Like other packages on our `Suggest` list, we test `data.table` works with `bit64` in our tests. In testing of our own reverse dependencies (packages which use `data.table`) we do include packages which suggest `data.table`, although it appears it is not CRAN policy to do so. We have requested that CRAN policy be changed to include suggests in reverse dependency testing. diff --git a/inst/tests/tests.Rraw b/inst/tests/tests.Rraw index a7430c8e1..f71cb37ba 100644 --- a/inst/tests/tests.Rraw +++ b/inst/tests/tests.Rraw @@ -16970,12 +16970,8 @@ if (.Platform$OS.type=="windows") local({ LC_NUMERIC = "C", LC_TIME = "Chinese (Simplified)_China.936" ) - for (i in seq_along(x)) { - lc = names(x)[[i]] - old = Sys.getlocale(lc) - Sys.setlocale(lc, x[[i]]) - on.exit(Sys.setlocale(lc, old), add = TRUE) - } + x_old = Map(Sys.getlocale, names(x)) + invisible(Map(Sys.setlocale, names(x), x)) old = Sys.getenv('LANGUAGE') Sys.setenv('LANGUAGE' = 'zh_CN') on.exit({ @@ -16983,6 +16979,7 @@ if (.Platform$OS.type=="windows") local({ Sys.setenv('LANGUAGE' = old) else Sys.unsetenv('LANGUAGE') + invisible(Map(Sys.setlocale, names(x_old), x_old)) }, add = TRUE) # triggered segfault here in #4402, Windows-only under translation. # test that the argument order changes correctly (the 'item 2' moves to the beginning of the message)