Merge lp:~dobey/ubuntu/precise/twisted/fix-935756 into lp:ubuntu/precise/twisted

Proposed by dobey on 2012-03-08
Status: Merged
Merge reported by: dobey
Merged at revision: not available
Proposed branch: lp:~dobey/ubuntu/precise/twisted/fix-935756
Merge into: lp:ubuntu/precise/twisted
Diff against target: 141 lines (+122/-0)
3 files modified
debian/changelog (+7/-0)
debian/patches/01_posix_wakeups.patch (+114/-0)
debian/patches/series (+1/-0)
To merge this branch: bzr merge lp:~dobey/ubuntu/precise/twisted/fix-935756
Reviewer Review Type Date Requested Status
Ubuntu branches 2012-03-08 Pending
Review via email: mp+96617@code.launchpad.net

Description of the Change

Fix for the seemingly odd twisted+glib/gtk 2/3 reactor issues that have cropped up since the inclusion of the gireactor/gtk3reactor patch.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2012-02-15 21:39:07 +0000
3+++ debian/changelog 2012-03-08 16:47:14 +0000
4@@ -1,3 +1,10 @@
5+twisted (11.1.0-1ubuntu2) precise; urgency=low
6+
7+ * debian/patches/01_posix_wakeups.patch:
8+ - Backport wakeup change from trunk gtk2refactoring (LP: #935756)
9+
10+ -- Rodney Dawes <rodney.dawes@ubuntu.com> Thu, 08 Mar 2012 11:25:48 -0500
11+
12 twisted (11.1.0-1ubuntu1) precise; urgency=low
13
14 * debian/patches/00_gi_gtk3reactor.patch:
15
16=== added file 'debian/patches/01_posix_wakeups.patch'
17--- debian/patches/01_posix_wakeups.patch 1970-01-01 00:00:00 +0000
18+++ debian/patches/01_posix_wakeups.patch 2012-03-08 16:47:14 +0000
19@@ -0,0 +1,114 @@
20+=== modified file 'twisted/internet/posixbase.py'
21+--- old/twisted/internet/posixbase.py 2011-10-16 19:13:26 +0000
22++++ new/twisted/internet/posixbase.py 2011-12-08 03:37:41 +0000
23+@@ -265,6 +265,11 @@ class PosixReactorBase(_SignalReactorMix
24+ self.removeWriter(selectable)
25+ selectable.connectionLost(failure.Failure(why))
26+
27++
28++ # Callable that creates a waker, overrideable so that subclasses can
29++ # substitute their own implementation:
30++ _wakerFactory = _Waker
31++
32+ def installWaker(self):
33+ """
34+ Install a `waker' to allow threads and signals to wake up the IO thread.
35+@@ -273,7 +278,7 @@ class PosixReactorBase(_SignalReactorMix
36+ the reactor. On Windows we use a pair of sockets.
37+ """
38+ if not self.waker:
39+- self.waker = _Waker(self)
40++ self.waker = self._wakerFactory(self)
41+ self._internalReaders.add(self.waker)
42+ self.addReader(self.waker)
43+
44+
45+=== modified file 'twisted/internet/test/test_threads.py'
46+--- old/twisted/internet/test/test_threads.py 2011-06-13 22:20:22 +0000
47++++ new/twisted/internet/test/test_threads.py 2011-12-08 03:37:41 +0000
48+@@ -8,7 +8,7 @@ Tests for implementations of L{IReactorT
49+ __metaclass__ = type
50+
51+ from weakref import ref
52+-import gc
53++import gc, threading
54+
55+ from twisted.python.threadable import isInIOThread
56+ from twisted.internet.test.reactormixins import ReactorBuilder
57+@@ -104,6 +104,24 @@ class ThreadTestsBuilder(ReactorBuilder)
58+ self.assertTrue(after - before < 30)
59+
60+
61++ def test_callFromThread(self):
62++ """
63++ A function scheduled with L{IReactorThreads.callFromThread} invoked
64++ from another thread is run in the reactor thread.
65++ """
66++ reactor = self.buildReactor()
67++ result = []
68++
69++ def threadCall():
70++ result.append(threading.currentThread())
71++ reactor.stop()
72++ reactor.callLater(0, reactor.callInThread,
73++ reactor.callFromThread, threadCall)
74++ self.runReactor(reactor, 5)
75++
76++ self.assertEquals(result, [threading.currentThread()])
77++
78++
79+ def test_stopThreadPool(self):
80+ """
81+ When the reactor stops, L{ReactorBase._stopThreadPool} drops the
82+
83+=== modified file 'twisted/internet/test/test_time.py'
84+--- old/twisted/internet/test/test_time.py 2011-02-14 04:45:15 +0000
85++++ new/twisted/internet/test/test_time.py 2011-12-08 03:37:41 +0000
86+@@ -7,6 +7,7 @@ Tests for implementations of L{IReactorT
87+
88+ __metaclass__ = type
89+
90++from twisted.python.runtime import platform
91+ from twisted.internet.test.reactormixins import ReactorBuilder
92+
93+
94+@@ -23,4 +24,38 @@ class TimeTestsBuilder(ReactorBuilder):
95+ reactor.run()
96+
97+
98++
99++class GlibTimeTestsBuilder(ReactorBuilder):
100++ """
101++ Builder for defining tests relating to L{IReactorTime} for reactors based
102++ off glib.
103++ """
104++ if platform.isWindows():
105++ _reactors = ["twisted.internet.gtk2reactor.PortableGtkReactor"]
106++ else:
107++ _reactors = ["twisted.internet.glib2reactor.Glib2Reactor",
108++ "twisted.internet.gtk2reactor.Gtk2Reactor"]
109++
110++ def test_timeout_add(self):
111++ """
112++ A C{reactor.callLater} call scheduled from a C{gobject.timeout_add}
113++ call is run on time.
114++ """
115++ import gobject
116++ reactor = self.buildReactor()
117++
118++ result = []
119++ def gschedule():
120++ reactor.callLater(0, callback)
121++ return 0
122++ def callback():
123++ result.append(True)
124++ reactor.stop()
125++
126++ reactor.callWhenRunning(gobject.timeout_add, 10, gschedule)
127++ self.runReactor(reactor, 5)
128++ self.assertEqual(result, [True])
129++
130++
131+ globals().update(TimeTestsBuilder.makeTestCaseClasses())
132++globals().update(GlibTimeTestsBuilder.makeTestCaseClasses())
133+
134
135=== modified file 'debian/patches/series'
136--- debian/patches/series 2012-02-15 21:39:07 +0000
137+++ debian/patches/series 2012-03-08 16:47:14 +0000
138@@ -1,2 +1,3 @@
139 00_gi_gtk3reactor.patch
140+01_posix_wakeups.patch
141 tap2deb.diff

Subscribers

People subscribed via source and target branches

to all changes: