Commit a67a160b authored by Chris McDonough's avatar Chris McDonough

Moved global declaration out of the except portion of a try-except

in order to comply with nested scopes rules.
parent bbcadfb4
...@@ -24,6 +24,7 @@ class simple_trigger(trigger): ...@@ -24,6 +24,7 @@ class simple_trigger(trigger):
the_trigger=simple_trigger() the_trigger=simple_trigger()
def Wakeup(thunk=None): def Wakeup(thunk=None):
global the_trigger
try: try:
the_trigger.pull_trigger(thunk) the_trigger.pull_trigger(thunk)
except OSError, why: except OSError, why:
...@@ -32,7 +33,6 @@ def Wakeup(thunk=None): ...@@ -32,7 +33,6 @@ def Wakeup(thunk=None):
# trigger and install a new one. # trigger and install a new one.
if why[0] == 32: if why[0] == 32:
del socket_map[the_trigger._fileno] del socket_map[the_trigger._fileno]
global the_trigger
the_trigger = simple_trigger() # adds itself back into socket_map the_trigger = simple_trigger() # adds itself back into socket_map
the_trigger.pull_trigger(thunk) the_trigger.pull_trigger(thunk)
...@@ -24,6 +24,7 @@ class simple_trigger(trigger): ...@@ -24,6 +24,7 @@ class simple_trigger(trigger):
the_trigger=simple_trigger() the_trigger=simple_trigger()
def Wakeup(thunk=None): def Wakeup(thunk=None):
global the_trigger
try: try:
the_trigger.pull_trigger(thunk) the_trigger.pull_trigger(thunk)
except OSError, why: except OSError, why:
...@@ -32,7 +33,6 @@ def Wakeup(thunk=None): ...@@ -32,7 +33,6 @@ def Wakeup(thunk=None):
# trigger and install a new one. # trigger and install a new one.
if why[0] == 32: if why[0] == 32:
del socket_map[the_trigger._fileno] del socket_map[the_trigger._fileno]
global the_trigger
the_trigger = simple_trigger() # adds itself back into socket_map the_trigger = simple_trigger() # adds itself back into socket_map
the_trigger.pull_trigger(thunk) the_trigger.pull_trigger(thunk)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment