Skip to content

Import UserDict and TemporaryFile from stdlib in cookie.py - #155

Merged
mpounsett merged 2 commits into
mainfrom
t3/refactor-cookie-compat
Nov 24, 2026
Merged

mpounsett merged 2 commits into
mainfrom
t3/refactor-cookie-compat

Conversation

@mpounsett

Copy link
Copy Markdown
Owner

Closes #154

cookie.py imported UserDict and TemporaryFile from the deprecated compat module. It now imports them from collections and tempfile directly.

The single TemporaryFile call (TemporaryFile('w+', encoding='ascii', prefix='oblivious_cookie_')) is unchanged: mode is the first positional parameter in both signatures and the other arguments are passed by keyword, which is how the compat wrapper forwarded them to tempfile.TemporaryFile anyway.

compat.py itself is left in place; tests/test_runtime.py still imports StringIO from it.

Testing

  • pytest tests/test_cookie.py: 12 passed
  • Exercised the oblivious-cookie path (Cookie() with no state file) by hand: opens, commits and closes cleanly

@mpounsett
mpounsett merged commit e48a21d into main Nov 24, 2026
12 checks passed
@mpounsett
mpounsett deleted the t3/refactor-cookie-compat branch November 24, 2026 23:47
@mpounsett mpounsett added this to the 1.5.0 milestone Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cookie.py imports from compat.py which is being deprecated

1 participant