- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 33.2k
gh-129205: Add os.readinto API for reading data into a caller provided buffer #129211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Merged
      
        
      
    
  
     Merged
                    Changes from 8 commits
      Commits
    
    
            Show all changes
          
          
            23 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      148d2f7
              
                gh-129205: Add os.readinto API
              
              
                cmaloney 3b34285
              
                Add blurb
              
              
                cmaloney a56f337
              
                Add tests
              
              
                cmaloney b75bc9b
              
                Change from :meth: to :func:
              
              
                cmaloney 992d5f5
              
                Remove length cap, and early exit on negative len.
              
              
                cmaloney bbb0e6a
              
                Fix build issues with last commit.
              
              
                cmaloney 6512788
              
                blurb: Just a literal / neither :func: nor :meth: worked
              
              
                cmaloney b4b4c28
              
                Test zero byte long bytearrays, fix typo
              
              
                cmaloney 4da3fec
              
                Only check set bytes in readinto test
              
              
                cmaloney c5f3df0
              
                Add Whats New, os.rst, tweak NEWS
              
              
                cmaloney 8cc70cd
              
                Update clinic posixmodule.c to be better for help docs
              
              
                cmaloney 6f8ad36
              
                bytes-like objects to bytes-like object, only one buffer
              
              
                cmaloney 62f531c
              
                Apply suggestions from code review
              
              
                cmaloney c8f5800
              
                Iterate on docs, guarantee no negative return
              
              
                cmaloney 2457b63
              
                Test non blocking behavior, test more bad args
              
              
                cmaloney 25125f2
              
                Apply suggestions from code review
              
              
                cmaloney 52a83fa
              
                Tweak Whats New and NEWS, assert buf->length
              
              
                cmaloney a7a0775
              
                clinic
              
              
                cmaloney e1aec8e
              
                Tweka os doc
              
              
                cmaloney 051b0c2
              
                minor doc tweak
              
              
                cmaloney 9356bc9
              
                Apply suggestions from code review
              
              
                cmaloney 06e98e8
              
                Sync Doc and help
              
              
                cmaloney 060a670
              
                Remove bufs, zip from test, just make a local bytearray
              
              
                cmaloney File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
        
          
          
            1 change: 1 addition & 0 deletions
          
          1 
        
  Misc/NEWS.d/next/Library/2025-01-22-16-54-25.gh-issue-129205.FMqrUt.rst
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Add ``os.readinto`` to read into a :ref:`buffer protocol <bufferobjects>` from a file descriptor. | ||
|         
                  cmaloney marked this conversation as resolved.
              Outdated
          
            Show resolved
            Hide resolved | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
      
      Oops, something went wrong.
      
    
  
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strictly speaking, data is already the plural form of datum.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For data -> datum the code is copied from
test_readjust before with minor tweaks; I think the two being very close in code is useful for maintenance more than naming. I think I can get rid of bufs and zip though which will remove the ambiguities / make the code read better