33# in the CMakeLists pulls in the cython source files directly, so we
44# don't actually depend on these libraries at link time.
55
6- from ..cython. cy_flexible_type cimport flexible_type, flex_type_enum, UNDEFINED
7- from ..cython. cy_flexible_type cimport flexible_type_from_pyobject
8- from ..cython. cy_flexible_type cimport pyobject_from_flexible_type
9- from ..cython. cy_callback cimport register_exception
6+ from cy_flexible_type cimport flexible_type, flex_type_enum, UNDEFINED
7+ from cy_flexible_type cimport flexible_type_from_pyobject
8+ from cy_flexible_type cimport pyobject_from_flexible_type
9+ from cy_callback cimport register_exception
1010
1111from libcpp.string cimport string
1212from libcpp.vector cimport vector
@@ -29,6 +29,10 @@ cdef extern from "<sframe/sframe.hpp>" namespace "graphlab":
2929 string column_name(size_t idx)
3030 size_t num_columns()
3131
32+ cdef extern from " <cstdlib>" :
33+ void _exit(int )
34+
35+
3236cdef extern from " <sframe/sframe_iterators.hpp>" namespace " graphlab" :
3337
3438 cdef cppclass parallel_sframe_iterator_initializer:
@@ -106,7 +110,12 @@ cdef call_main():
106110 for i in range (len (args)):
107111 c_args[i] = args[i]
108112
109- sys.exit(_spark_unity_main(len (args), c_args.data()))
113+ # If this script is run with a different libpython minor version,
114+ # e.g. 2.7.6 vs 2.7.10, or 2.7.11 vs 2.7.10, there appears to be
115+ # race condition in tearing things down. Everything appears to
116+ # work besides that. Using sys._exit instead of exit gets around
117+ # this.
118+ _exit(_spark_unity_main(len (args), c_args.data()))
110119
111120
112121if __name__ == " __main__" :
0 commit comments