Skip to content

Remove Python 2 compatibility code. - #28

Merged
cristian-codorean merged 1 commit into
masterfrom
drop-python2-compat
Jun 10, 2026
Merged

Remove Python 2 compatibility code.#28
cristian-codorean merged 1 commit into
masterfrom
drop-python2-compat

Conversation

@cristian-codorean

Copy link
Copy Markdown
Collaborator

Follow-up to #27, which set requires-python = ">=3.8": remove the Python 2 compatibility code that is now dead.

  • Drop from __future__ import print_function.
  • Flatten the py2/py3 try/except ImportError into plain urllib/http.client imports.
  • Remove the import ssl guard: the module never uses ssl directly (urllib handles TLS), and sys.exit() at import time is hostile to embedding applications. Pythons built without SSL fail with a clear error on first HTTPS request anyway.
  • Ignore303.redirect_request: use req.data / req.origin_req_host directly (the get_data()/get_origin_req_host() fallbacks were for Python < 3.4).
  • Drop py2-style (object) bases.

No functional change intended. Verified locally: module compiles, imports, and the redirect handler preserves data/origin_req_host on 301/302 and returns None on 303, as before.

🤖 Generated with Claude Code

@cristian-codorean
cristian-codorean merged commit 05238b0 into master Jun 10, 2026
39 checks passed
@cristian-codorean
cristian-codorean deleted the drop-python2-compat branch June 10, 2026 18:02
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.

1 participant