Skip to content

Commit

Permalink
remove urllib.parse copy
Browse files Browse the repository at this point in the history
  • Loading branch information
davidism committed Aug 14, 2023
1 parent 43d6cdc commit 0266f51
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 1,530 deletions.
6 changes: 4 additions & 2 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ Version 3.0.0

Unreleased

- Remove previously deprecated code. :pr:`2768`


Version 2.3.8
-------------
Expand Down Expand Up @@ -1796,8 +1798,8 @@ Version 0.9.2

(bugfix release, released on July 18th 2013)

- Added `unsafe` parameter to :func:`~werkzeug.urls.url_quote`.
- Fixed an issue with :func:`~werkzeug.urls.url_quote_plus` not quoting
- Added ``unsafe`` parameter to ``urls.url_quote``.
- Fixed an issue with ``urls.url_quote_plus`` not quoting
`'+'` correctly.
- Ported remaining parts of :class:`~werkzeug.contrib.RedisCache` to
Python 3.3.
Expand Down
25 changes: 0 additions & 25 deletions src/werkzeug/_internal.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,31 +287,6 @@ def __repr__(self) -> str:
return f"<{type(self).__name__} {self.name}>"


def _decode_idna(domain: str) -> str:
try:
data = domain.encode("ascii")
except UnicodeEncodeError:
# If the domain is not ASCII, it's decoded already.
return domain

try:
# Try decoding in one shot.
return data.decode("idna")
except UnicodeDecodeError:
pass

# Decode each part separately, leaving invalid parts as punycode.
parts = []

for part in data.split(b"."):
try:
parts.append(part.decode("idna"))
except UnicodeDecodeError:
parts.append(part.decode("ascii"))

return ".".join(parts)


_plain_int_re = re.compile(r"-?\d+", re.ASCII)


Expand Down
4 changes: 1 addition & 3 deletions src/werkzeug/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,9 +354,7 @@ def __init__(
self.path = iri_to_uri(request_uri.path)
self.request_uri = path
if base_url is not None:
base_url = iri_to_uri(
base_url, charset=charset if charset != "utf-8" else None
)
base_url = iri_to_uri(base_url)
self.base_url = base_url # type: ignore
if isinstance(query_string, str):
self.query_string = query_string
Expand Down
Loading

0 comments on commit 0266f51

Please sign in to comment.