[pypy-commit] pypy py3.5: Don't crash if SemLock.name is None

rlamy pypy.commits at gmail.com
Thu Nov 10 14:37:00 EST 2016


Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: py3.5
Changeset: r88305:6ae7eb63289e
Date: 2016-11-10 19:36 +0000
http://bitbucket.org/pypy/pypy/changeset/6ae7eb63289e/

Log:	Don't crash if SemLock.name is None

diff --git a/pypy/module/_multiprocessing/interp_semaphore.py b/pypy/module/_multiprocessing/interp_semaphore.py
--- a/pypy/module/_multiprocessing/interp_semaphore.py
+++ b/pypy/module/_multiprocessing/interp_semaphore.py
@@ -443,6 +443,8 @@
         self.name = name
 
     def name_get(self, space):
+        if self.name is None:
+            return space.w_None
         return space.newutf8(self.name)
 
     def kind_get(self, space):
diff --git a/pypy/module/_multiprocessing/test/test_semaphore.py b/pypy/module/_multiprocessing/test/test_semaphore.py
--- a/pypy/module/_multiprocessing/test/test_semaphore.py
+++ b/pypy/module/_multiprocessing/test/test_semaphore.py
@@ -41,6 +41,7 @@
         assert sem.kind == kind
         assert sem.maxvalue == maxvalue
         assert isinstance(sem.handle, int)
+        assert sem.name is None
 
         assert sem._count() == 0
         if sys.platform == 'darwin':


More information about the pypy-commit mailing list