mirror of
				https://github.com/python/cpython.git
				synced 2025-11-04 03:44:55 +00:00 
			
		
		
		
	gh-101144: Allow open and read_text encoding to be positional. (#101145)
The zipfile.Path open() and read_text() encoding parameter can be supplied as a positional argument without causing a TypeError again. 3.10.0b1 included a regression that made it keyword only. Documentation update included as users writing code to be compatible with a wide range of versions will need to consider this for some time.
This commit is contained in:
		
							parent
							
								
									9e025d305f
								
							
						
					
					
						commit
						5927013e47
					
				
					 4 changed files with 95 additions and 10 deletions
				
			
		| 
						 | 
				
			
			@ -551,6 +551,12 @@ Path objects are traversable using the ``/`` operator or ``joinpath``.
 | 
			
		|||
      Added support for text and binary modes for open. Default
 | 
			
		||||
      mode is now text.
 | 
			
		||||
 | 
			
		||||
   .. versionchanged:: 3.11.2
 | 
			
		||||
      The ``encoding`` parameter can be supplied as a positional argument
 | 
			
		||||
      without causing a :exc:`TypeError`. As it could in 3.9. Code needing to
 | 
			
		||||
      be compatible with unpatched 3.10 and 3.11 versions must pass all
 | 
			
		||||
      :class:`io.TextIOWrapper` arguments, ``encoding`` included, as keywords.
 | 
			
		||||
 | 
			
		||||
.. method:: Path.iterdir()
 | 
			
		||||
 | 
			
		||||
   Enumerate the children of the current directory.
 | 
			
		||||
| 
						 | 
				
			
			@ -596,6 +602,12 @@ Path objects are traversable using the ``/`` operator or ``joinpath``.
 | 
			
		|||
   :class:`io.TextIOWrapper` (except ``buffer``, which is
 | 
			
		||||
   implied by the context).
 | 
			
		||||
 | 
			
		||||
   .. versionchanged:: 3.11.2
 | 
			
		||||
      The ``encoding`` parameter can be supplied as a positional argument
 | 
			
		||||
      without causing a :exc:`TypeError`. As it could in 3.9. Code needing to
 | 
			
		||||
      be compatible with unpatched 3.10 and 3.11 versions must pass all
 | 
			
		||||
      :class:`io.TextIOWrapper` arguments, ``encoding`` included, as keywords.
 | 
			
		||||
 | 
			
		||||
.. method:: Path.read_bytes()
 | 
			
		||||
 | 
			
		||||
   Read the current file as bytes.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue