bpo-43680: _pyio.open() becomes a static method#25354
Conversation
The Python _pyio.open() function becomes a static method to behave as io.open() built-in function: don't become a bound method when stored as a class variable. It becomes possible since static methods are now callable in Python 3.10. Moreover, _pyio.OpenWrapper becomes a simple alias to _pyio.open. init_set_builtins_open() now sets builtins.open to io.open, rather than setting it to io.OpenWrapper, since OpenWrapper is now an alias to open in the io and _pyio modules.
|
@methane: Would you mind to review this change? Thanks to https://bugs.python.org/issue43682, it becomes possible to put |
Sorry, something went wrong.
methane
left a comment
There was a problem hiding this comment.
LGTM except one nitpick.
Sorry, something went wrong.
Co-authored-by: Inada Naoki <songofacandy@gmail.com>
|
Can we remove It is not defined in C _io module. So I think it is safe to remove. |
Sorry, something went wrong.
Sure, it was not documented and doesn't exist in the io module. I already removed it: 3bc694d |
Sorry, something went wrong.
The Python _pyio.open() function becomes a static method to behave as
io.open() built-in function: don't become a bound method when stored
as a class variable. It becomes possible since static methods are now
callable in Python 3.10. Moreover, _pyio.OpenWrapper becomes a simple
alias to _pyio.open.
init_set_builtins_open() now sets builtins.open to io.open, rather
than setting it to io.OpenWrapper, since OpenWrapper is now an alias
to open in the io and _pyio modules.
https://bugs.python.org/issue43680