Skip to content

Conversation

@GrigoriiKashchenko
Copy link

@GrigoriiKashchenko GrigoriiKashchenko commented Dec 14, 2025

Summary

Update documentation to clearly state that the file argument passed to open() is stored as the name attribute of the returned file object.

Changes Made

  1. Doc/library/functions.rst: Added explicit documentation for the open() function
  2. Doc/library/io.rst: Updated documentation for FileIO.name and added missing IOBase.name attribute

Key Clarifications

  • The name attribute stores exactly what was passed as the file argument
  • It can be string, bytes, integer file descriptor, or other representation
  • This behavior is preserved for backward compatibility
  • Added .. versionchanged:: 3.13 directive to document the clarification

Testing

  • Verified documentation builds correctly
  • Behavior matches existing Python implementation
  • Cross-references between functions.rst and io.rst are consistent

Closes gh-62734


📚 Documentation preview 📚: https://cpython-previews--142694.org.readthedocs.build/

[doc] Clarify that open() file param is saved as name attribute
Clarify FileIO.name and IOBase.name documentation to match functions.rst
@python-cla-bot
Copy link

The following commit authors need to sign the Contributor License Agreement:

CLA not signed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review docs Documentation in the Doc dir skip news

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

[doc] State clearly that open() 'file' param is "name" attr of the result

1 participant