Rev 4838: (andrew) Backport lp:bzr r5155: Reset siginterrupt flag everytime we in file:///home/pqm/archives/thelove/bzr/2.1/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Fri Apr 30 08:41:11 BST 2010
At file:///home/pqm/archives/thelove/bzr/2.1/
------------------------------------------------------------
revno: 4838 [merge]
revision-id: pqm at pqm.ubuntu.com-20100430074110-r9ffhuboqeevhid9
parent: pqm at pqm.ubuntu.com-20100429060941-xlvrrmgolwd5gu9a
parent: andrew.bennetts at canonical.com-20100430062715-p1i2tybjsg1nehdo
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: 2.1
timestamp: Fri 2010-04-30 08:41:10 +0100
message:
(andrew) Backport lp:bzr r5155: Reset siginterrupt flag everytime we
handle a signal to partially workaround
http://bugs.python.org/issue8354.
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/osutils.py osutils.py-20050309040759-eeaff12fbf77ac86
=== modified file 'NEWS'
--- a/NEWS 2010-04-29 05:14:04 +0000
+++ b/NEWS 2010-04-30 06:27:15 +0000
@@ -16,6 +16,12 @@
* ``bzr switch`` does not die if a ConfigurableFileMerger is used.
(Aaron Bentley, #559436)
+* Reset ``siginterrupt`` flag to False every time we handle a signal
+ installed with ``set_signal_handler(..., restart_syscall=True)`` (from
+ ``bzrlib.osutils``. Reduces the likelihood of "Interrupted System Call"
+ errors after two window resizes.
+ (Andrew Bennetts)
+
bzr 2.1.1
#########
=== modified file 'bzrlib/osutils.py'
--- a/bzrlib/osutils.py 2010-03-11 00:13:08 +0000
+++ b/bzrlib/osutils.py 2010-04-30 06:27:15 +0000
@@ -1356,15 +1356,25 @@
False)`). May be ignored if the feature is not available on this
platform or Python version.
"""
- old_handler = signal.signal(signum, handler)
+ try:
+ siginterrupt = signal.siginterrupt
+ except AttributeError:
+ # siginterrupt doesn't exist on this platform, or for this version
+ # of Python.
+ siginterrupt = lambda signum, flag: None
if restart_syscall:
- try:
- siginterrupt = signal.siginterrupt
- except AttributeError: # siginterrupt doesn't exist on this platform, or for this version of
- # Python.
- pass
- else:
+ def sig_handler(*args):
+ # Python resets the siginterrupt flag when a signal is
+ # received. <http://bugs.python.org/issue8354>
+ # As a workaround for some cases, set it back the way we want it.
siginterrupt(signum, False)
+ # Now run the handler function passed to set_signal_handler.
+ handler(*args)
+ else:
+ sig_handler = handler
+ old_handler = signal.signal(signum, sig_handler)
+ if restart_syscall:
+ siginterrupt(signum, False)
return old_handler
More information about the bazaar-commits
mailing list