Opened 4 years ago

Closed 4 years ago

#5860 task closed fixed (fixed)

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

Reported by: Itamar Turner-Trauring Owned by: Itamar Turner-Trauring
Priority: normal Milestone: Python 3.3 Minimal
Component: core Keywords:
Cc: Branch: branches/unhook-threadable-5860
branch-diff, diff-cov, branch-cov, buildbot
Author: exarkun

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 4 years ago by Jean-Paul Calderone

Owner: changed from Itamar Turner-Trauring to Jean-Paul Calderone
Status: newassigned

comment:2 Changed 4 years ago by Jean-Paul Calderone

Author: exarkun
Branch: branches/unhook-threadable-5860

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

comment:3 Changed 4 years ago by Jean-Paul Calderone

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

refs #5860

comment:4 Changed 4 years ago by Jean-Paul Calderone

Keywords: review added
Owner: Jean-Paul Calderone deleted
Status: assignednew

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 4 years ago by Itamar Turner-Trauring

Keywords: review removed
Owner: set to Itamar Turner-Trauring
  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 4 years ago by itamarst

Resolution: fixed
Status: newclosed

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