Skip to content

Instantly share code, notes, and snippets.

@mmedvede
Created May 16, 2013 19:50
Show Gist options
  • Save mmedvede/5594535 to your computer and use it in GitHub Desktop.
Save mmedvede/5594535 to your computer and use it in GitHub Desktop.
#! /usr/bin/env bash
# mmedvede
file_to_patch="/usr/lib/python2.7/threading.py"
echo "Fixes python 2.7 issue with 'DummyThread object has no attribute...'
according to http://bugs.python.org/issue14308
"
if [ ! -e "$file_to_patch" ]; then
echo "File to be patched not found: $file_to_patch" 1>&2
else
sudo patch $file_to_patch << _PATCH
--- threading.py.orig 2012-09-12 20:00:54.893004574 -0400
+++ threading.py 2012-09-12 20:02:09.059691055 -0400
@@ -605,6 +605,10 @@
pass
def __stop(self):
+ # DummyThreads delete self.__block, but they have no waiters to
+ # notify anyway (join() is forbidden on them).
+ if not hasattr(self, '_Thread__block'):
+ return
self.__block.acquire()
self.__stopped = True
self.__block.notify_all()
_PATCH
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment