mirror of
				https://github.com/python/cpython.git
				synced 2025-10-26 03:04:41 +00:00 
			
		
		
		
	Issue #20604: Added missed invalid mode in error message of socket.makefile().
Based on patch by Franck Michea.
This commit is contained in:
		
						commit
						a9568bb44a
					
				
					 1 changed files with 2 additions and 3 deletions
				
			
		|  | @ -209,9 +209,8 @@ def makefile(self, mode="r", buffering=None, *, | ||||||
|         except the only mode characters supported are 'r', 'w' and 'b'. |         except the only mode characters supported are 'r', 'w' and 'b'. | ||||||
|         The semantics are similar too.  (XXX refactor to share code?) |         The semantics are similar too.  (XXX refactor to share code?) | ||||||
|         """ |         """ | ||||||
|         for c in mode: |         if not set(mode) <= {"r", "w", "b"}: | ||||||
|             if c not in {"r", "w", "b"}: |             raise ValueError("invalid mode %r (only r, w, b allowed)" % (mode,)) | ||||||
|                 raise ValueError("invalid mode %r (only r, w, b allowed)") |  | ||||||
|         writing = "w" in mode |         writing = "w" in mode | ||||||
|         reading = "r" in mode or not writing |         reading = "r" in mode or not writing | ||||||
|         assert reading or writing |         assert reading or writing | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Serhiy Storchaka
						Serhiy Storchaka