Opened 4 years ago

Closed 3 years ago

#6142 enhancement closed fixed (fixed)

Port twisted.internet.ssl to Python 3

Reported by: itamar Owned by: itamar
Priority: normal Milestone: Python 3.3 Minimal
Component: core Keywords:
Cc: Branch: branches/ssl-py3-6142
(github, patch, buildbot, log)
Author: itamarst Launchpad Bug:


twisted.internet.ssl should run on Python 3.

Change History (7)

comment:1 Changed 4 years ago by itamarst

  • Author set to itamarst
  • Branch set to branches/ssl-py3-6142

(In [36308]) Branching to 'ssl-py3-6142'

comment:2 Changed 4 years ago by itamar

This will include twisted.test.test_ssl, but not twisted.internet.test.test_tls, which depends on SSL endpoints (#6157), which in turn depends on this ticket. test_tls will have to be done separately as a result.

comment:3 Changed 4 years ago by itamar

  • Keywords review added
  • Owner set to exarkun

Ready for review; is running.

  1. Re-enabled various places where SSL was disabled on Python 3.
  2. Usual minor fixes.
  3. Removed a little bit of duplication (e.g certPath) in the test code.

comment:4 Changed 4 years ago by exarkun

  • Keywords review removed
  • Owner changed from exarkun to itamar


  1. twisted/test/
    1. in generateCertificateFiles, FilePath.setContent is better than open/write/close.
    2. likewise for FilePath.getContent in StolenTCPTestCase.createServer
    3. ConnectionLostTestCase.test_bothSidesLoseConnection does a transport.write("a") - ie native instead of byte string. This should cause a test failure...
    4. Do any of these tests run? They all skip on the Python 3.3 builder and locally.
  2. Some code being changed has comments about ticket #6141 - not #6142?

comment:5 Changed 3 years ago by itamar

  • Keywords review added
  • Owner changed from itamar to exarkun

1.1, 1.2: Fixed. 1.3: Apparently SSL.Connection.send will accept unicode. I added a hack to twisted.protocols.tls that will catch this. I also fixed the test. 1.4: They all run... if you have pyOpenSSL installed. The buildslave doesn't, but you can install it locally. I'll email Barry about improving our buildslave setup.

2: Those comments were somewhat inaccurate, the imports should probably be from the public module (i.e. twisted.internet.ssl), not _sslverify. In any case I missed them when porting _sslverify (#6141), and doing it here is reasonable since this is the public API exposing _sslverify. is running.

comment:6 Changed 3 years ago by exarkun

  • Keywords review removed
  • Owner changed from exarkun to itamar

Okay, thanks. Please merge.

comment:7 Changed 3 years ago by itamarst

  • Resolution set to fixed
  • Status changed from new to closed

(In [36350]) Merge ssl-py3-6142.

Author: itamar Review: exarkun Fixes: #6142

Port twisted.internet.ssl to Python 3.

Note: See TracTickets for help on using tickets.