Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

calls to iri_to_uri fails when the argument is a bytestring #2708

Closed
midchildan opened this issue May 26, 2023 · 0 comments · Fixed by #2709
Closed

calls to iri_to_uri fails when the argument is a bytestring #2708

midchildan opened this issue May 26, 2023 · 0 comments · Fixed by #2709
Milestone

Comments

@midchildan
Copy link
Contributor

Calls to iri_to_uri fails when the argument is a bytestring. Here's an example:

>>> from werkzeug import urls
>>> urls.iri_to_uri(b'/foo')
<stdin>:1: DeprecationWarning: Passing bytes is deprecated and will not be supported in Werkzeug 3.0.
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/midchildan/Documents/playground/werkzeug/lib/python3.10/site-packages/werkzeug/urls.py", line 983, in iri_to_uri
    iri = iri.decode(charset)
TypeError: decode() argument 'encoding' must be str, not None

This is what should've happened instead:

>>> from werkzeug import urls
>>> urls.iri_to_uri(b'/foo')
>>> '/foo'

Environment:

  • Python version: 3.10.11
  • Werkzeug version: 2.3.4
@davidism davidism added this to the 2.3.5 milestone May 26, 2023
@davidism davidism closed this as completed Jun 6, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants