mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	bpo-40334: PEP 617 implementation: New PEG parser for CPython (GH-19503)
Co-authored-by: Guido van Rossum <guido@python.org> Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
This commit is contained in:
		
							parent
							
								
									a81849b031
								
							
						
					
					
						commit
						c5fc156852
					
				
					 91 changed files with 27057 additions and 146 deletions
				
			
		
							
								
								
									
										28
									
								
								Tools/peg_generator/scripts/ast_timings.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								Tools/peg_generator/scripts/ast_timings.py
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,28 @@ | |||
| import ast | ||||
| import sys | ||||
| import time | ||||
| import token | ||||
| import tokenize | ||||
| 
 | ||||
| from pegen.testutil import print_memstats | ||||
| 
 | ||||
| 
 | ||||
| def main() -> None: | ||||
|     t0 = time.time() | ||||
|     for filename in sys.argv[1:]: | ||||
|         print(filename, end="\r") | ||||
|         try: | ||||
|             with open(filename) as file: | ||||
|                 source = file.read() | ||||
|             tree = ast.parse(source, filename) | ||||
|         except Exception as err: | ||||
|             print(f"{filename}: {err.__class__.__name__}: {err}", file=sys.stderr) | ||||
|     tok = None | ||||
|     t1 = time.time() | ||||
|     dt = t1 - t0 | ||||
|     print(f"Parsed in {dt:.3f} secs", file=sys.stderr) | ||||
|     print_memstats() | ||||
| 
 | ||||
| 
 | ||||
| if __name__ == "__main__": | ||||
|     main() | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Pablo Galindo
						Pablo Galindo