Opened 2 years ago

Closed 23 months ago

#5931 enhancement closed fixed (fixed)

Port twisted.python.failure to Python 3

Reported by: exarkun Owned by: itamar
Priority: normal Milestone: Python 3.3 Minimal
Component: core Keywords:
Cc: Branch: branches/failure-python3-5931-2
(diff, github, buildbot, log)
Author: itamarst Launchpad Bug:

Description

Many parts of Twisted depend on twisted.python.failure. Perhaps the debug functionality can be skipped for the initial pass, but most or all of the rest of the functionality will probably be required fairly soon.

This is a dependency for porting even a minimal subset of trial (#5874).

Some parts of the #5802 branch may be useful in this effort.

Change History (13)

comment:1 Changed 2 years ago by exarkun

  • Owner set to exarkun
  • Status changed from new to assigned

This depends on #5913 and

comment:2 Changed 2 years ago by exarkun

... #5932.

comment:3 Changed 23 months ago by itamarst

  • Author set to itamarst
  • Branch set to branches/failure-python3-5931

(In [35528]) Branching to 'failure-python3-5931'

comment:4 Changed 23 months ago by itamarst

  • Branch changed from branches/failure-python3-5931 to branches/failure-python3-5931-2

(In [35543]) Branching to 'failure-python3-5931-2'

comment:5 Changed 23 months ago by itamar

  • Keywords review added
  • Status changed from assigned to new

Ready for review; running tests at http://buildbot.twistedmatrix.com/boxes-supported?branch=/branches/failure-python3-5931-2

Some notes:

  1. I punted on a couple of the really hideous failing tests for _findFailure, and opened separate ticket referenced in the code. Didn't seem important enough to block progress.
  2. Generator tests are effectively unchanged, just moved back into main test module; I only changed g.next() to next(g) and suppressed one test on Python 3.

comment:6 Changed 23 months ago by exarkun

  • Keywords review removed
  • Owner changed from exarkun to itamar

Thanks. Surprisingly unterrible, really.

  1. We probably should already have started a guide for application developers, enumerating the changes they might need to make (like different exception handling around Failure.trap calls). Can you start one for this ticket and put this item in it? Then I guess we should go back and add stuff to it for all the tickets we resolved already.
  2. twisted/test/test_failure.py, On both Python 2 and Python 3, the underlying exceptio is passed on: - missing an n
  3. twisted/test/test_failure.py needs a lot of help overall :/ Can you file tickets for:
    1. Improving the docstring for test_notTrapped
    2. Splitting up test_printingSmokeTest into separate tests for each method it is calling, as well as adding some more serious assertions
    3. The same for test_printingCapturedVarsSmokeTest
    4. Making failure.startDebugMode work in a less bad way. We should do something that doesn't involve monkey-patching Failure. (See next point)
  4. The change to TestDebugMode.setUp is wrong for Python 2. Failure.__dict__['__init__'] is the actual function object, Failure.__init__ is an unbound method. With the change, failure.Failure.__init__ = origInit now puts an unbound method into Failure.__dict__.
  5. Seems like the inlineCallbacks tests are in the wrong place. They'd make more sense in a Deferred-related test module (in particular, not importing twisted.internet to test twisted.python would make a lot of sense). Not sure this is really actionable here, but maybe there's another ticket to be filed for it.

comment:7 Changed 23 months ago by itamarst

(In [35547]) Address review comments 2 and 4. Refs #5931

comment:8 Changed 23 months ago by itamar

Opened #5952, #5953, #5954 and #5955 to address review comments 3 and 5.

comment:9 Changed 23 months ago by itamarst

(In [35548]) Howto covering python 3 porting, starting with failure. Refs #5931

comment:10 Changed 23 months ago by itamar

  • Keywords review added
  • Owner changed from itamar to exarkun

OK, addressed review comments.

comment:12 Changed 23 months ago by exarkun

  • Keywords review removed
  • Owner changed from exarkun to itamar

Looks good, please merge.

comment:13 Changed 23 months ago by itamarst

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

(In [35549]) Merge failure-python3-5931-2

Author: itamar, vperic
Review: exarkun
Fixes: #5931

Port twisted.python.failure to Python 3, and add new porting howto.

Note: See TracTickets for help on using tickets.