mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	Use a try-except so that the pickle file is written even when we die
because of an unexpected exception.
This commit is contained in:
		
							parent
							
								
									e86271af72
								
							
						
					
					
						commit
						bee64533d6
					
				
					 1 changed files with 18 additions and 14 deletions
				
			
		|  | @ -183,24 +183,28 @@ def main(): | |||
|     for arg in args: | ||||
|         c.addroot(arg) | ||||
| 
 | ||||
|     if not norun: | ||||
|     try: | ||||
| 
 | ||||
|         if not norun: | ||||
|             try: | ||||
|                 c.run() | ||||
|             except KeyboardInterrupt: | ||||
|                 if verbose > 0: | ||||
|                     print "[run interrupted]" | ||||
| 
 | ||||
|         try: | ||||
|             c.run() | ||||
|             c.report() | ||||
|         except KeyboardInterrupt: | ||||
|             if verbose > 0: | ||||
|                 print "[run interrupted]" | ||||
|                 print "[report interrupted]" | ||||
| 
 | ||||
|     try: | ||||
|         c.report() | ||||
|     except KeyboardInterrupt: | ||||
|         if verbose > 0: | ||||
|             print "[report interrupted]" | ||||
| 
 | ||||
|     if c.save_pickle(dumpfile): | ||||
|         if dumpfile == DUMPFILE: | ||||
|             print "Use ``%s -R'' to restart." % sys.argv[0] | ||||
|         else: | ||||
|             print "Use ``%s -R -d %s'' to restart." % (sys.argv[0], dumpfile) | ||||
|     finally: | ||||
|         if c.save_pickle(dumpfile): | ||||
|             if dumpfile == DUMPFILE: | ||||
|                 print "Use ``%s -R'' to restart." % sys.argv[0] | ||||
|             else: | ||||
|                 print "Use ``%s -R -d %s'' to restart." % (sys.argv[0], | ||||
|                                                            dumpfile) | ||||
| 
 | ||||
| 
 | ||||
| def load_pickle(dumpfile=DUMPFILE, verbose=VERBOSE): | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Guido van Rossum
						Guido van Rossum