From 5802cab87cfa5002cb7cfa55a0b461fe2d090d07 Mon Sep 17 00:00:00 2001 From: Robert Nishihara Date: Wed, 7 Sep 2016 18:49:19 -0700 Subject: [PATCH] Fix bug in which ObjectFixture gets called at exit after raylib gets set to None. (#416) --- lib/python/ray/worker.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/python/ray/worker.py b/lib/python/ray/worker.py index 15a9dbc8d..6ceaaaeee 100644 --- a/lib/python/ray/worker.py +++ b/lib/python/ray/worker.py @@ -272,7 +272,11 @@ class ObjectFixture(object): def __del__(self): """Unmap the segment when the object goes out of scope.""" - raylib.unmap_object(self.handle, self.segmentid) + # We probably shouldn't have this if statement, but if raylib gets set to + # None before this __del__ call happens, then an exception will be thrown + # at exit. + if raylib is not None: + raylib.unmap_object(self.handle, self.segmentid) class Worker(object): """A class used to define the control flow of a worker process.