Opened 2 years ago

Closed 23 months ago

#5860 task closed fixed (fixed)

Remove twisted.python.threadable's dependency on twisted.python.hook

Reported by: itamar Owned by: itamar
Priority: normal Milestone: Python 3.3 Minimal
Component: core Keywords:
Cc: Branch: branches/unhook-threadable-5860
(diff, github, buildbot, log)
Author: exarkun Launchpad Bug:

Description

threadable.synchronize is the only code in Twisted that depends on hook. Rewriting it to not use hook would mean less code to port to Python 3.

Change History (6)

comment:1 Changed 2 years ago by exarkun

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

comment:2 Changed 23 months ago by exarkun

  • Author set to exarkun
  • Branch set to branches/unhook-threadable-5860

(In [35477]) Branching to 'unhook-threadable-5860'

comment:3 Changed 23 months ago by exarkun

(In [35478]) Re-implement threadable.synchronize with a function wrapper instead of a hook

refs #5860

comment:4 Changed 23 months ago by exarkun

  • Keywords review added
  • Owner exarkun deleted
  • Status changed from assigned to new

Removed the dependency and ported threadable to Python 3. The astute reader will notice that synchronize is a class decorator.

Build results

comment:5 Changed 23 months ago by itamar

  • Keywords review removed
  • Owner set to itamar
  1. You can't raise unittest.FailTest in Python 3. Since this only happens if the test fails, it just means the failure (which doesn't happen since the code is correct) is obscured. #5885 will fix this, so I don't think this worth fixing.
  2. Not depending on reactor is good.
  3. I opened a ticket to improve testing of the synchronize decorator (#5938).

I note that Twisted cannot run without threading being available (since twisted.python.context uses it for example), so perhaps another ticket should be filed for simplifying the module. Not that we'll ever get around to it.

So, looks good. I will merge.

comment:6 Changed 23 months ago by itamarst

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

(In [35498]) Merge unhook-threadable-5860

Author: exarkun
Review: itamar
Fixes: #5860

Port twisted.python.threadable to Python 3.

Note: See TracTickets for help on using tickets.