Skip to content

Commit

Permalink
fix: improve partitioned cookie back-compat patching for Python 3.13+ (
Browse files Browse the repository at this point in the history
…#297)

closes #274
  • Loading branch information
bdraco authored Nov 27, 2024
1 parent aa9b290 commit a352283
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/uiprotect/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from collections.abc import Callable
from datetime import datetime, timedelta
from functools import partial
from http import HTTPStatus
from http import HTTPStatus, cookies
from http.cookies import Morsel, SimpleCookie
from ipaddress import IPv4Address, IPv6Address
from pathlib import Path
Expand Down Expand Up @@ -67,9 +67,7 @@
)
from .websocket import Websocket, WebsocketState

if sys.version_info[:2] < (3, 13):
from http import cookies

if "partitioned" not in cookies.Morsel._reserved: # type: ignore[attr-defined]
# See: https://github.com/python/cpython/issues/112713
cookies.Morsel._reserved["partitioned"] = "partitioned" # type: ignore[attr-defined]
cookies.Morsel._flags.add("partitioned") # type: ignore[attr-defined]
Expand Down

0 comments on commit a352283

Please sign in to comment.