Ticket #5931 enhancement closed fixed

Opened 9 months ago

Last modified 8 months ago

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
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

1

Changed 9 months ago by exarkun

  • status changed from new to assigned
  • owner set to exarkun

This depends on #5913 and

2

Changed 9 months ago by exarkun

... #5932.

3

Changed 8 months ago by itamarst

  • branch set to branches/failure-python3-5931
  • branch_author set to itamarst

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

4

Changed 8 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'

5

Changed 8 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.

6

Changed 8 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.

7

Changed 8 months ago by itamarst

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

8

Changed 8 months ago by itamar

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

9

Changed 8 months ago by itamarst

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

10

Changed 8 months ago by itamar

  • owner changed from itamar to exarkun
  • keywords review added

OK, addressed review comments.

11

12

Changed 8 months ago by exarkun

  • keywords review removed
  • owner changed from exarkun to itamar

Looks good, please merge.

13

Changed 8 months ago by itamarst

  • status changed from new to closed
  • resolution set to fixed

(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.