aboutsummaryrefslogtreecommitdiff
path: root/debian/patches/do-not-raise-stopiteration.patch
blob: 7813b3650ad8506458673ac74317f0b47badc56a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
Description: Adjust stopping generators for PEP479
 Adjust aptdaemon for PEP479, where raise StopIteration
 stopped working and should become return.
Author: Julian Andres Klode <juliank@ubuntu.com>
Last-Update: 2019-03-27

--- aptdaemon-1.1.1+bzr982.orig/aptdaemon/core.py
+++ aptdaemon-1.1.1+bzr982/aptdaemon/core.py
@@ -935,7 +935,7 @@ class Transaction(DBusObject):
                 self.progress = 9
             yield self._simulate_real()
         else:
-            raise StopIteration
+            return
 
     @inline_callbacks
     def _check_auth(self):
@@ -946,7 +946,7 @@ class Transaction(DBusObject):
         self.status = enums.STATUS_AUTHENTICATING
         action = self.ROLE_ACTION_MAP[self.role]
         if action is None:
-            raise StopIteration
+            return
         # Special case if InstallPackages only touches stuff from the
         # high trust whitelist
         if (self.role in (enums.ROLE_INSTALL_PACKAGES,
@@ -1028,16 +1028,16 @@ class Transaction(DBusObject):
         else:
             self.status = enums.STATUS_CANCELLING
             self.exit = enums.EXIT_CANCELLED
-            raise StopIteration
+            return
         if self.tid in self.queue.limbo:
             self.exit = enums.EXIT_CANCELLED
-            raise StopIteration
+            return
         elif self.cancellable:
             log_trans.debug("Setting cancel event")
             self.cancelled = True
             self.status = enums.STATUS_CANCELLING
             self.paused = False
-            raise StopIteration
+            return
         raise errors.AptDaemonError("Could not cancel transaction")
 
     # pylint: disable-msg=C0103,C0322
--- aptdaemon-1.1.1+bzr982.orig/aptdaemon/networking.py
+++ aptdaemon-1.1.1+bzr982/aptdaemon/networking.py
@@ -177,7 +177,7 @@ class NetworkManagerMonitor(NetworkMonit
     def _on_nm_active_conn_props_changed(self, props):
         """Callback if properties of the active connection changed."""
         if "Default" not in props:
-            raise StopIteration
+            return
         yield self.get_network_state()
 
     @inline_callbacks
--- aptdaemon-1.1.1+bzr982.orig/doc/source/aptdaemon.client.rst
+++ aptdaemon-1.1.1+bzr982/doc/source/aptdaemon.client.rst
@@ -91,7 +91,7 @@ code in a synchronous way:
     ...         transaction = yield apt_client.update()
     ...     except errors.NotAuthorizedError:
     ...         print "You are not allowed to update the cache!"
-    ...         raise StopIteration
+    ...         return
     ...     yield transaction.set_locale("de_DE")
     ...     yield transaction.run()
     ...     print "Transaction has started"