summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2021-04-12 08:44:53 (GMT)
committerGitHub <noreply@github.com>2021-04-12 08:44:53 (GMT)
commit77d668b1221d0f8c3e9d6b6199f67aaf3c45f040 (patch)
tree9c1d155aebeed470a77c624ce7b5c5e6f80a5e90 /Python
parent9825bdfbd5c966abf1f1b7264992d722a94c9613 (diff)
downloadcpython-77d668b1221d0f8c3e9d6b6199f67aaf3c45f040.zip
cpython-77d668b1221d0f8c3e9d6b6199f67aaf3c45f040.tar.gz
cpython-77d668b1221d0f8c3e9d6b6199f67aaf3c45f040.tar.bz2
bpo-43680: _pyio.open() becomes a static method (GH-25354)
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.
Diffstat (limited to 'Python')
-rw-r--r--Python/pylifecycle.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c
index 0ad1796..2dbebe4 100644
--- a/Python/pylifecycle.c
+++ b/Python/pylifecycle.c
@@ -2241,7 +2241,7 @@ error:
return NULL;
}
-/* Set builtins.open to io.OpenWrapper */
+/* Set builtins.open to io.open */
static PyStatus
init_set_builtins_open(void)
{
@@ -2257,7 +2257,7 @@ init_set_builtins_open(void)
goto error;
}
- if (!(wrapper = PyObject_GetAttrString(iomod, "OpenWrapper"))) {
+ if (!(wrapper = PyObject_GetAttrString(iomod, "open"))) {
goto error;
}
@@ -2279,7 +2279,7 @@ done:
}
-/* Initialize sys.stdin, stdout, stderr and builtins.open */
+/* Create sys.stdin, sys.stdout and sys.stderr */
static PyStatus
init_sys_streams(PyThreadState *tstate)
{