This hack makes Guile default to UTF-8. This avoids calls to `iconv_open'; `iconv_open' tries to open shared objects that aren't available during bootstrap, so using UTF-8 avoids that (and UTF-8 has built-in conversions in glibc, too.) diff --git a/libguile/bytevectors.c b/libguile/bytevectors.c index cf41f2f..facfb91 100644 --- a/libguile/bytevectors.c +++ b/libguile/bytevectors.c @@ -1887,7 +1887,7 @@ utf_encoding_name (char *name, size_t utf_width, SCM endianness) if (scm_i_is_narrow_string (str)) \ { \ err = mem_iconveh (scm_i_string_chars (str), c_strlen, \ - "ISO-8859-1", c_utf_name, \ + "UTF-8", c_utf_name, \ iconveh_question_mark, NULL, \ &c_utf, &c_utf_len); \ if (SCM_UNLIKELY (err)) \ diff --git a/libguile/ports.c b/libguile/ports.c index 301bc44..b0ea2e6 100644 --- a/libguile/ports.c +++ b/libguile/ports.c @@ -1750,7 +1750,7 @@ scm_ungetc (scm_t_wchar c, SCM port) if (pt->encoding != NULL) encoding = pt->encoding; else - encoding = "ISO-8859-1"; + encoding = "UTF-8"; len = sizeof (result_buf); result = u32_conv_to_encoding (encoding, @@ -2212,7 +2212,7 @@ scm_i_set_port_encoding_x (SCM port, const char *encoding) pt = SCM_PTAB_ENTRY (port); if (encoding == NULL) - encoding = "ISO-8859-1"; + encoding = "UTF-8"; if (pt->encoding != encoding) pt->encoding = scm_gc_strdup (encoding, "port"); diff --git a/libguile/posix.c b/libguile/posix.c index 4f8b8ac..fea7f74 100644 --- a/libguile/posix.c +++ b/libguile/posix.c @@ -1740,7 +1740,7 @@ SCM_DEFINE (scm_setlocale, "setlocale", 1, 1, 0, SCM_SYSERROR;
Do not leave open files behind as this triggers 'ResourceWarning' and leads these tests to fail. --- Werkzeug-1.0.1/tests/test_datastructures.py 2020-03-31 19:48:06.000000000 +0200 +++ Werkzeug-1.0.1/tests/test_datastructures.py 2021-11-21 18:19:11.304369878 +0100 @@ -1238,9 +1238,10 @@ def test_save_to_pathlib_dst(self, tmp_path): src = tmp_path / "src.txt" src.write_text(u"test") - storage = self.storage_class(src.open("rb")) - dst = tmp_path / "dst.txt" - storage.save(dst) + with src.open("rb") as input: + storage = self.storage_class(input) + dst = tmp_path / "dst.txt" + storage.save(dst) assert dst.read_text() == "test" def test_save_to_bytes_io(self): @@ -1251,11 +1252,12 @@ def test_save_to_file(self, tmp_path): path = tmp_path / "file.data" - storage = self.storage_class(io.BytesIO(b"one\ntwo")) - with path.open("wb") as dst: - storage.save(dst) - with path.open("rb") as src: - assert src.read() == b"one\ntwo" + with io.BytesIO(b"one\ntwo") as input: + storage = self.storage_class(input) + with path.open("wb") as dst: + storage.save(dst) + with path.open("rb") as src: + assert src.read() == b"one\ntwo" @pytest.mark.parametrize("ranges", ([(0, 1), (-5, None)], [(5, None)])) --- Werkzeug-1.0.1/tests/test_formparser.py 2020-03-31 19:48:06.000000000 +0200 +++ Werkzeug-1.0.1/tests/test_formparser.py 2021-11-21 22:11:43.654622751 +0100 @@ -27,7 +27,7 @@ from werkzeug.test import create_environ from werkzeug.wrappers import Request from werkzeug.wrappers import Response - +import warnings @Request.application def form_data_consumer(request): @@ -242,6 +244,9 @@ class TestMultiPart(object): def test_basic(self): + # Ignore leaked file descriptor of unknown origin. + warnings.filterwarnings(action="ignore", message="unclosed", category=ResourceWarning) + resources = join(dirname(__file__), "multipart") client = Client(form_data_consumer, Response)