Skip to content

Commit 68ef028

Browse files
Merge branch 'python:main' into improve-sorted-documentation
2 parents a36b45f + f2b5c20 commit 68ef028

File tree

4 files changed

+22
-17
lines changed

4 files changed

+22
-17
lines changed

Doc/c-api/module.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -426,10 +426,10 @@ To retrieve the state from a given module, use the following functions:
426426
module state.
427427
428428
429-
.. c:function:: int PyModule_GetStateSize(PyObject *, Py_ssize_t *result)
429+
.. c:function:: int PyModule_GetStateSize(PyObject *module, Py_ssize_t *result)
430430
431-
Set *\*result* to the size of the module's state, as specified using
432-
:c:macro:`Py_mod_state_size` (or :c:member:`PyModuleDef.m_size`),
431+
Set *\*result* to the size of *module*'s state, as specified
432+
using :c:macro:`Py_mod_state_size` (or :c:member:`PyModuleDef.m_size`),
433433
and return 0.
434434
435435
On error, set *\*result* to -1, and return -1 with an exception set.
@@ -597,7 +597,7 @@ A module's token -- and the *your_token* value to use in the above code -- is:
597597
598598
.. c:function:: int PyModule_GetToken(PyObject *module, void** result)
599599
600-
Set *\*result* to the module's token and return 0.
600+
Set *\*result* to the module token for *module* and return 0.
601601
602602
On error, set *\*result* to NULL, and return -1 with an exception set.
603603
@@ -645,7 +645,7 @@ rather than from an extension's :ref:`export hook <extension-export-hook>`.
645645
646646
.. c:function:: int PyModule_Exec(PyObject *module)
647647
648-
Execute the :c:data:`Py_mod_exec` slot(s) of the given *module*.
648+
Execute the :c:data:`Py_mod_exec` slot(s) of *module*.
649649
650650
On success, return 0.
651651
On error, return -1 with an exception set.

Doc/library/contextvars.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,13 +119,15 @@ Context Variables
119119
# After the reset call the var has no value again, so
120120
# var.get() would raise a LookupError.
121121

122+
The same *token* cannot be used twice.
123+
122124

123125
.. class:: Token
124126

125127
*Token* objects are returned by the :meth:`ContextVar.set` method.
126128
They can be passed to the :meth:`ContextVar.reset` method to revert
127129
the value of the variable to what it was before the corresponding
128-
*set*.
130+
*set*. A single token cannot reset a context variable more than once.
129131

130132
Tokens support the :ref:`context manager protocol <context-managers>`
131133
to automatically reset context variables. See :meth:`ContextVar.set`.

Include/moduleobject.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,11 @@ PyAPI_FUNC(int) PyUnstable_Module_SetGIL(PyObject *module, void *gil);
118118
#endif
119119

120120
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= _Py_PACK_VERSION(3, 15)
121-
PyAPI_FUNC(PyObject *) PyModule_FromSlotsAndSpec(const PyModuleDef_Slot *,
121+
PyAPI_FUNC(PyObject *) PyModule_FromSlotsAndSpec(const PyModuleDef_Slot *slots,
122122
PyObject *spec);
123-
PyAPI_FUNC(int) PyModule_Exec(PyObject *mod);
124-
PyAPI_FUNC(int) PyModule_GetStateSize(PyObject *mod, Py_ssize_t *result);
125-
PyAPI_FUNC(int) PyModule_GetToken(PyObject *, void **result);
123+
PyAPI_FUNC(int) PyModule_Exec(PyObject *module);
124+
PyAPI_FUNC(int) PyModule_GetStateSize(PyObject *module, Py_ssize_t *result);
125+
PyAPI_FUNC(int) PyModule_GetToken(PyObject *module, void **result);
126126
#endif
127127

128128
#ifndef _Py_OPAQUE_PYOBJECT

Lib/test/test_tools/test_makefile.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,18 @@ def test_makefile_test_folders(self):
4848
if dirname == '__pycache__' or dirname.startswith('.'):
4949
dirs.clear() # do not process subfolders
5050
continue
51-
# Skip empty dirs:
51+
52+
# Skip empty dirs (ignoring hidden files and __pycache__):
53+
files = [
54+
filename for filename in files
55+
if not filename.startswith('.')
56+
]
57+
dirs = [
58+
dirname for dirname in dirs
59+
if not dirname.startswith('.') and dirname != "__pycache__"
60+
]
5261
if not dirs and not files:
5362
continue
54-
# Skip dirs with hidden-only files:
55-
if files and all(
56-
filename.startswith('.') or filename == '__pycache__'
57-
for filename in files
58-
):
59-
continue
6063

6164
relpath = os.path.relpath(dirpath, support.STDLIB_DIR)
6265
with self.subTest(relpath=relpath):

0 commit comments

Comments
 (0)