mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	Issue #15833: don't raise an exception if importlib can't write byte-compiled
files. This fixes a regression introduced by 3.3. Patch by Charles-François Natali.
This commit is contained in:
		
							parent
							
								
									03cb99c2d1
								
							
						
					
					
						commit
						d783c8ed00
					
				
					 3 changed files with 1870 additions and 1860 deletions
				
			
		|  | @ -1066,17 +1066,17 @@ def set_data(self, path, data, *, _mode=0o666): | ||||||
|             except FileExistsError: |             except FileExistsError: | ||||||
|                 # Probably another Python process already created the dir. |                 # Probably another Python process already created the dir. | ||||||
|                 continue |                 continue | ||||||
|             except PermissionError: |             except OSError as exc: | ||||||
|                 # If can't get proper access, then just forget about writing |                 # Could be a permission error, read-only filesystem: just forget | ||||||
|                 # the data. |                 # about writing the data. | ||||||
|  |                 _verbose_message('could not create {!r}: {!r}', parent, exc) | ||||||
|                 return |                 return | ||||||
|         try: |         try: | ||||||
|             _write_atomic(path, data, _mode) |             _write_atomic(path, data, _mode) | ||||||
|             _verbose_message('created {!r}', path) |             _verbose_message('created {!r}', path) | ||||||
|         except (PermissionError, FileExistsError): |         except OSError as exc: | ||||||
|             # Don't worry if you can't write bytecode or someone is writing |             # Same as above: just don't write the bytecode. | ||||||
|             # it at the same time. |             _verbose_message('could not create {!r}: {!r}', path, exc) | ||||||
|             pass |  | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| class SourcelessFileLoader(FileLoader, _LoaderBasics): | class SourcelessFileLoader(FileLoader, _LoaderBasics): | ||||||
|  |  | ||||||
|  | @ -127,6 +127,10 @@ Tests | ||||||
| Build | Build | ||||||
| ----- | ----- | ||||||
| 
 | 
 | ||||||
|  | - Issue #15833: Fix a regression in 3.3 that resulted in exceptions being | ||||||
|  |   raised if importlib failed to write byte-compiled files.  This affected | ||||||
|  |   attempts to build Python out-of-tree from a read-only source directory. | ||||||
|  | 
 | ||||||
| - Issue #15923: Fix a mistake in ``asdl_c.py`` that resulted in a TypeError | - Issue #15923: Fix a mistake in ``asdl_c.py`` that resulted in a TypeError | ||||||
|   after 2801bf875a24 (see #15801). |   after 2801bf875a24 (see #15801). | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
							
								
								
									
										3712
									
								
								Python/importlib.h
									
										
									
									
									
								
							
							
						
						
									
										3712
									
								
								Python/importlib.h
									
										
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Trent Nelson
						Trent Nelson