diff options
author | Michał Górny <mgorny@gentoo.org> | 2023-05-29 10:56:39 +0200 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2023-05-29 11:40:05 +0200 |
commit | 4ca6682d11871a4b64d0b8443798f882302046a0 (patch) | |
tree | 34400b4673352fbc9e812e7284c54fbbf3a82d5f | |
parent | dev-python/urllib3: Keyword 2.0.2-r1 sparc, #905137 (diff) | |
download | gentoo-4ca6682d.tar.gz gentoo-4ca6682d.tar.bz2 gentoo-4ca6682d.zip |
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@gentoo.org>
-rw-r--r-- | dev-python/werkzeug/files/werkzeug-2.3.4-iri-bytes.patch | 64 | ||||
-rw-r--r-- | dev-python/werkzeug/werkzeug-2.3.4-r1.ebuild (renamed from dev-python/werkzeug/werkzeug-2.3.4.ebuild) | 5 |
2 files changed, 69 insertions, 0 deletions
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 <git@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 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 |