commit: 4ca6682d11871a4b64d0b8443798f882302046a0 Author: Michał Górny <mgorny <AT> gentoo <DOT> org> AuthorDate: Mon May 29 08:56:39 2023 +0000 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> CommitDate: Mon May 29 09:40:05 2023 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4ca6682d
dev-python/werkzeug: Add encoding patch from upstream bug tracker Add an encoding patch that was submitted upstream, fixing a bug affecting dev-python/httpbin. Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> .../werkzeug/files/werkzeug-2.3.4-iri-bytes.patch | 64 ++++++++++++++++++++++ ...kzeug-2.3.4.ebuild => werkzeug-2.3.4-r1.ebuild} | 5 ++ 2 files changed, 69 insertions(+) diff --git a/dev-python/werkzeug/files/werkzeug-2.3.4-iri-bytes.patch b/dev-python/werkzeug/files/werkzeug-2.3.4-iri-bytes.patch new file mode 100644 index 000000000000..1e06b0621cdd --- /dev/null +++ b/dev-python/werkzeug/files/werkzeug-2.3.4-iri-bytes.patch @@ -0,0 +1,64 @@ +From 3ba0fd5c52c9943c492ce098693bf9e651942fe5 Mon Sep 17 00:00:00 2001 +From: midchildan <g...@midchildan.org> +Date: Sat, 27 May 2023 01:03:02 +0900 +Subject: [PATCH] fix: iri_to_uri fails when the argument is a bytestring + +This was caused by the 'charset' variable being used before it was ready. +--- + CHANGES.rst | 4 ++++ + src/werkzeug/urls.py | 20 ++++++++++---------- + tests/test_urls.py | 3 +++ + 3 files changed, 17 insertions(+), 10 deletions(-) + +diff --git a/src/werkzeug/urls.py b/src/werkzeug/urls.py +index 89ef21943..f5760eb4c 100644 +--- a/src/werkzeug/urls.py ++++ b/src/werkzeug/urls.py +@@ -966,6 +966,16 @@ def iri_to_uri( + + .. versionadded:: 0.6 + """ ++ if charset is not None: ++ warnings.warn( ++ "The 'charset' parameter is deprecated and will be removed" ++ " in Werkzeug 3.0.", ++ DeprecationWarning, ++ stacklevel=2, ++ ) ++ else: ++ charset = "utf-8" ++ + if isinstance(iri, tuple): + warnings.warn( + "Passing a tuple is deprecated and will not be supported in Werkzeug 3.0.", +@@ -982,16 +992,6 @@ def iri_to_uri( + ) + iri = iri.decode(charset) + +- if charset is not None: +- warnings.warn( +- "The 'charset' parameter is deprecated and will be removed" +- " in Werkzeug 3.0.", +- DeprecationWarning, +- stacklevel=2, +- ) +- else: +- charset = "utf-8" +- + if errors is not None: + warnings.warn( + "The 'errors' parameter is deprecated and will be removed in Werkzeug 3.0.", +diff --git a/tests/test_urls.py b/tests/test_urls.py +index 56bca8e94..765d42546 100644 +--- a/tests/test_urls.py ++++ b/tests/test_urls.py +@@ -231,6 +231,9 @@ def test_iri_support(): + + assert urls.iri_to_uri("/foo") == "/foo" + ++ with pytest.deprecated_call(): ++ assert urls.iri_to_uri(b"/foo") == "/foo" ++ + assert ( + urls.iri_to_uri("http://föö.com:8080/bam/baz") + == "http://xn--f-1gaa.com:8080/bam/baz" diff --git a/dev-python/werkzeug/werkzeug-2.3.4.ebuild b/dev-python/werkzeug/werkzeug-2.3.4-r1.ebuild similarity index 94% rename from dev-python/werkzeug/werkzeug-2.3.4.ebuild rename to dev-python/werkzeug/werkzeug-2.3.4-r1.ebuild index 83abfac7697c..45e61e3a2b87 100644 --- a/dev-python/werkzeug/werkzeug-2.3.4.ebuild +++ b/dev-python/werkzeug/werkzeug-2.3.4-r1.ebuild @@ -48,6 +48,11 @@ BDEPEND=" distutils_enable_tests pytest +PATCHES=( + # https://github.com/pallets/werkzeug/pull/2709 + "${FILESDIR}/${P}-iri-bytes.patch" +) + python_test() { local EPYTEST_DESELECT=() if ! has_version "dev-python/cryptography[${PYTHON_USEDEP}]"; then