Skip to content

Comments

Fix Python 3 compatibility for newer Twisted#73

Merged
twonds merged 2 commits intomasterfrom
fix/python3-compat
Feb 12, 2026
Merged

Fix Python 3 compatibility for newer Twisted#73
twonds merged 2 commits intomasterfrom
fix/python3-compat

Conversation

@twonds
Copy link
Owner

@twonds twonds commented Feb 12, 2026

Summary

  • Simplify punjab.tac: replace the version-conditional double putChild call with a single b'http-bind' bytes call and remove the unused sys import
  • Add self.reactor = reactor to HttpbService.__init__ so newer Twisted (22+) can access site.reactor in server.Session.__init__
  • Drops Python 2 support

Context

PR #72 fixed putChild needing bytes on Python 3 but used a version check that registered the child twice. Additionally, HttpbService was missing a reactor attribute required by newer Twisted when server.Session.__init__ calls site.reactor.

Test plan

  • Verify python3 -c "from punjab.httpb import HttpbService" imports without error
  • Run trial punjab to confirm existing tests pass
  • Test with Twisted 22+ on Python 3.11+

🤖 Generated with Claude Code

twonds and others added 2 commits February 11, 2026 16:21
…bService

Drop Python 2 support: replace the version-conditional double putChild
call with a single b'http-bind' bytes call, and remove the now-unused
sys import. Add self.reactor to HttpbService so newer Twisted (22+)
can access site.reactor in server.Session.__init__.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Travis CI is no longer functional for this repo. Replace it with a
GitHub Actions workflow that tests on Python 3.10-3.13 against both
the latest Twisted release and Twisted trunk, with and without
PyOpenSSL.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@twonds twonds merged commit a43e4a3 into master Feb 12, 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.

1 participant