Skip to content
Merged
5 changes: 3 additions & 2 deletions Lib/http/cookies.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,15 +266,16 @@ class Morsel(dict):
"samesite" : "SameSite",
}

_reserved_defaults = dict.fromkeys(_reserved, "")

_flags = {'secure', 'httponly'}

def __init__(self):
# Set defaults
self._key = self._value = self._coded_value = None

# Set default attributes
for key in self._reserved:
dict.__setitem__(self, key, "")
dict.update(self, self._reserved_defaults)

@property
def key(self):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Improved performances of creating :py:class:`~http.cookies.Morsel` objects by a factor of 3.8x.
Loading