mirror of
				https://github.com/python/cpython.git
				synced 2025-11-02 22:51:25 +00:00 
			
		
		
		
	Co-authored-by: Łukasz Langa <lukasz@langa.pl> Co-authored-by: Marta Gómez Macías <mgmacias@google.com> Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com> Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
		
			
				
	
	
		
			21 lines
		
	
	
	
		
			433 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			21 lines
		
	
	
	
		
			433 B
		
	
	
	
		
			Python
		
	
	
	
	
	
from __future__ import annotations
 | 
						|
 | 
						|
import os
 | 
						|
 | 
						|
# types
 | 
						|
if False:
 | 
						|
    from typing import IO
 | 
						|
 | 
						|
 | 
						|
trace_file: IO[str] | None = None
 | 
						|
if trace_filename := os.environ.get("PYREPL_TRACE"):
 | 
						|
    trace_file = open(trace_filename, "a")
 | 
						|
 | 
						|
 | 
						|
def trace(line: str, *k: object, **kw: object) -> None:
 | 
						|
    if trace_file is None:
 | 
						|
        return
 | 
						|
    if k or kw:
 | 
						|
        line = line.format(*k, **kw)
 | 
						|
    trace_file.write(line + "\n")
 | 
						|
    trace_file.flush()
 |