|  | @@ -108,8 +108,13 @@ if "linux" in sys.platform or "darwin" in sys.platform:
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  def cython_extensions(package_names, module_names, extra_sources, include_dirs,
 | 
	
		
			
				|  |  |                        libraries, define_macros, build_with_cython=False):
 | 
	
		
			
				|  |  | +  # Set compiler directives linetrace argument only if we care about tracing;
 | 
	
		
			
				|  |  | +  # this is due to Cython having different behavior between linetrace being
 | 
	
		
			
				|  |  | +  # False and linetrace being unset. See issue #5689.
 | 
	
		
			
				|  |  | +  cython_compiler_directives = {}
 | 
	
		
			
				|  |  |    if ENABLE_CYTHON_TRACING:
 | 
	
		
			
				|  |  |      define_macros = define_macros + [('CYTHON_TRACE_NOGIL', 1)]
 | 
	
		
			
				|  |  | +    cython_compiler_directives['linetrace'] = True
 | 
	
		
			
				|  |  |    file_extension = 'pyx' if build_with_cython else 'c'
 | 
	
		
			
				|  |  |    module_files = [os.path.join(PYTHON_STEM,
 | 
	
		
			
				|  |  |                                 name.replace('.', '/') + '.' + file_extension)
 | 
	
	
		
			
				|  | @@ -129,7 +134,7 @@ def cython_extensions(package_names, module_names, extra_sources, include_dirs,
 | 
	
		
			
				|  |  |      return Cython.Build.cythonize(
 | 
	
		
			
				|  |  |          extensions,
 | 
	
		
			
				|  |  |          include_path=include_dirs,
 | 
	
		
			
				|  |  | -        compiler_directives={'linetrace': bool(ENABLE_CYTHON_TRACING)})
 | 
	
		
			
				|  |  | +        compiler_directives=cython_compiler_directives)
 | 
	
		
			
				|  |  |    else:
 | 
	
		
			
				|  |  |      return extensions
 | 
	
		
			
				|  |  |  
 |