8000 Merge remote-tracking branch 'upstream/main' into gh-104090-fix-leake… · python/cpython@88bd75f · GitHub
[go: up one dir, main page]

Skip to content
8000

Commit 88bd75f

Browse files
committed
Merge remote-tracking branch 'upstream/main' into gh-104090-fix-leaked-semaphors-on-test_concurrent_futures
2 parents b2450ab + 8c17729 commit 88bd75f

File tree

100 files changed

+3128
-1792
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+3128
-1792
lines changed

.coveragerc

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[run]
2+
branch = True
3+
4+
[report]
5+
# Regexes for lines to exclude from consideration
6+
exclude_lines =
7+
# Don't complain if non-runnable code isn't run:
8+
if 0:
9+
if __name__ == .__main__.:
10+
11+
.*# pragma: no cover
12+
.*# pragma: no branch
13+
14+
# Additions for IDLE:
15+
.*# htest #
16+
if not (_htest or _utest):
17+
if not .*_utest:
18+
if .*_htest:
19+

.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ Programs/test_frozenmain.h generated
8787
Python/Python-ast.c generated
8888
Python/executor_cases.c.h generated
8989
Python/generated_cases.c.h generated
90-
Python/opcode_metadata.h generated
90+
Include/internal/pycore_opcode_metadata.h generated
9191
Python/opcode_targets.h generated
9292
Python/stdlib_module_names.h generated
9393
Tools/peg_generator/pegen/grammar_parser.py generated

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ Doc/c-api/stable.rst @encukou
172172
**/*pathlib* @barneygale
173173

174174
# zipfile.Path
175-
**/*zipfile/*_path.py @jaraco
175+
**/*zipfile/_path/* @jaraco
176176

177177
# Argument Clinic
178178
/Tools/clinic/** @erlend-aasland @AlexWaygood

Doc/faq/library.rst

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -669,41 +669,6 @@ and client-side web systems.
669669
A summary of available frameworks is maintained by Paul Boddie at
670670
https://wiki.python.org/moin/WebProgramming\ .
671671
672-
Cameron Laird maintains a useful set of pages about Python web technologies at
673-
https://web.archive.org/web/20210224183619/http://phaseit.net/claird/comp.lang.python/web_python.
674-
675-
676-
How can I mimic CGI form submission (METHOD=POST)?
677-
--------------------------------------------------
678-
679-
I would like to retrieve web pages that are the result of POSTing a form. Is
680-
there existing code that would let me do this easily?
681-
682-
Yes. Here's a simple example that uses :mod:`urllib.request`::
683-
684-
#!/usr/local/bin/python
685-
686-
import urllib.request
687-
688-
# build the query string
689-
qs = "First=Josephine&MI=Q&Last=Public"
690-
691-
# connect and send the server a path
692-
req = urllib.request.urlopen('http://www.some-server.out-there'
693-
'/cgi-bin/some-cgi-script', data=qs)
694-
with req:
695-
msg, hdrs = req.read(), req.info()
696-
697-
Note that in general for percent-encoded POST operations, query strings must be
698-
quoted using :func:`urllib.parse.urlencode`. For example, to send
699-
``name=Guy Steele, Jr.``::
700-
701-
>>> import urllib.parse
702-
>>> urllib.parse.urlencode({'name': 'Guy Steele, Jr.'})
703-
'name=Guy+Steele%2C+Jr.'
704-
705-
.. seealso:: :ref:`urllib-howto` for extensive examples.
706-
707672
708673
What module should I use to help with generating HTML?
709674
------------------------------------------------------

Doc/howto/clinic.rst

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ Argument Clinic How-To
2727
version of Argument Clinic that ships with the next version
2828
of CPython *could* be totally incompatible and break all your code.
2929

30-
The Goals Of Argument Clinic
30+
31+
The goals of Argument Clinic
3132
============================
3233

3334
Argument Clinic's primary goal
@@ -78,7 +79,7 @@ and it should be able to do many interesting and smart
7879
things with all the information you give it.
7980

8081

81-
Basic Concepts And Usage
82+
Basic concepts and usage
8283
========================
8384

8485
Argument Clinic ships with CPython; you'll find it in ``Tools/clinic/clinic.py``.
@@ -141,7 +142,7 @@ For the sake of clarity, here's the terminology we'll use with Argument Clinic:
141142
a block.)
142143

143144

144-
Converting Your First Function
145+
Converting your first function
145146
==============================
146147

147148
The best way to get a sense of how Argument Clinic works is to
@@ -558,7 +559,8 @@ Let's dive in!
558559

559560
Congratulations, you've ported your first function to work with Argument Clinic!
560561

561-
Advanced Topics
562+
563+
Advanced topics
562564
===============
563565

564566
Now that you've had some experience working with Argument Clinic, it's time
@@ -636,7 +638,8 @@ after the last argument).
636638
Currently the generated code will use :c:func:`PyArg_ParseTuple`, but this
637639
will change soon.
638640

639-
Optional Groups
641+
642+
Optional groups
640643
---------------
641644

642645
Some legacy functions have a tricky approach to parsing their arguments:
@@ -899,6 +902,7 @@ available. For each converter it'll show you all the parameters
899902
it accepts, along with the default value for each parameter.
900903
Just run ``Tools/clinic/clinic.py --converters`` to see the full list.
901904

905+
902906
Py_buffer
903907
---------
904908

@@ -908,7 +912,6 @@ you *must* not call :c:func:`PyBuffer_Release` on the provided buffer.
908912
Argument Clinic generates code that does it for you (in the parsing function).
909913

910914

911-
912915
Advanced converters
913916
-------------------
914917

@@ -975,6 +978,7 @@ value called ``NULL`` for just this reason: from Python's perspective it
975978
behaves like a default value of ``None``, but the C variable is initialized
976979
with ``NULL``.
977980

981+
978982
Expressions specified as default values
979983
---------------------------------------
980984

@@ -1032,7 +1036,6 @@ you're not permitted to use:
10321036
* Tuple/list/set/dict literals.
10331037

10341038

1035-
10361039
Using a return converter
10371040
------------------------
10381041

@@ -1146,6 +1149,7 @@ then modifying it. Cloning is an all-or nothing proposition.
11461149
Also, the function you are cloning from must have been previously defined
11471150
in the current file.
11481151

1152+
11491153
Calling Python code
11501154
-------------------
11511155

@@ -1380,6 +1384,7 @@ handle initialization and cleanup.
13801384
You can see more examples of custom converters in the CPython
13811385
source tree; grep the C files for the string ``CConverter``.
13821386

1387+
13831388
Writing a custom return converter
13841389
---------------------------------
13851390

@@ -1394,8 +1399,9 @@ write your own return converter, please read ``Tools/clinic/clinic.py``,
13941399
specifically the implementation of ``CReturnConverter`` and
13951400
all its subclasses.
13961401

1402+
13971403
METH_O and METH_NOARGS
1398-
----------------------------------------------
1404+
----------------------
13991405

14001406
To convert a function using ``METH_O``, make sure the function's
14011407
single argument is using the ``object`` converter, and mark the
@@ -1415,8 +1421,9 @@ any arguments.
14151421
You can still use a self converter, a return converter, and specify
14161422
a ``type`` argument to the object converter for ``METH_O``.
14171423

1424+
14181425
tp_new and tp_init functions
1419-
----------------------------------------------
1426+
----------------------------
14201427

14211428
You can convert ``tp_new`` and ``tp_init`` functions. Just name
14221429
them ``__new__`` or ``__init__`` as appropriate. Notes:
@@ -1437,6 +1444,7 @@ them ``__new__`` or ``__init__`` as appropriate. Notes:
14371444
(If your function doesn't support keywords, the parsing function
14381445
generated will throw an exception if it receives any.)
14391446

1447+
14401448
Changing and redirecting Clinic's output
14411449
----------------------------------------
14421450

@@ -1721,7 +1729,7 @@ the file was not modified by hand before it gets overwritten.
17211729

17221730

17231731
The #ifdef trick
1724-
----------------------------------------------
1732+
----------------
17251733

17261734
If you're converting a function that isn't available on all platforms,
17271735
there's a trick you can use to make life a little easier. The existing
@@ -1801,7 +1809,6 @@ Argument Clinic added to your file (it'll be at the very bottom), then
18011809
move it above the ``PyMethodDef`` structure where that macro is used.
18021810

18031811

1804-
18051812
Using Argument Clinic in Python files
18061813
-------------------------------------
18071814

Doc/library/http.client.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ HTTPConnection Objects
390390
Returns a dictionary with the headers of the response received from
391391
the proxy server to the CONNECT request.
392392

393-
If the CONNECT request was not sent, the method returns an empty dictionary.
393+
If the CONNECT request was not sent, the method returns ``None``.
394394

395395
.. versionadded:: 3.12
396396

Doc/library/importlib.resources.rst

Lines changed: 0 additions & 156 deletions
Original file line numberDiff line numberDiff line change
@@ -94,159 +94,3 @@ for example, a package and its resources can be imported from a zip file using
9494
the file system is required.
9595

9696
.. versionadded:: 3.9
97-
98-
99-
Deprecated functions
100-
^^^^^^^^^^^^^^^^^^^^
101-
102-
An older, deprecated set of functions is still available, but is
103-
scheduled for removal in a future version of Python.
104-
The main drawback of these functions is that they do not support
105-
directories: they assume all resources are located directly within a *package*.
106-
107-
.. data:: Package
108-
109-
Whenever a function accepts a ``Package`` argument, you can pass in
110-
either a :class:`module object <types.ModuleType>` or a module name
111-
as a string. You can only pass module objects whose
112-
``__spec__.submodule_search_locations`` is not ``None``.
113-
114-
The ``Package`` type is defined as ``Union[str, ModuleType]``.
115-
116-
.. deprecated:: 3.12
117-
118-
119-
.. data:: Resource
120-
121-
For *resource* arguments of the functions below, you can pass in
122-
the name of a resource as a string or
123-
a :class:`path-like object <os.PathLike>`.
124-
125-
The ``Resource`` type is defined as ``Union[str, os.PathLike]``.
126-
127-
128-
.. function:: open_binary(package, resource)
129-
130-
Open for binary reading the *resource* within *package*.
131-
132-
*package* is either a name or a module object which conforms to the
133-
``Package`` requirements. *resource* is the name of the resource to open
134-
within *package*; it may not contain path separators and it may not have
135-
sub-resources (i.e. it cannot be a directory). This function returns a
136-
``typing.BinaryIO`` instance, a binary I/O stream open for reading.
137-
138-
.. deprecated:: 3.11
139-
140-
Calls to this function can be replaced by::
141-
142-
files(package).joinpath(resource).open('rb')
143-
144-
145-
.. function:: open_text(package, resource, encoding='utf-8', errors='strict')
146-
147-
Open for text reading the *resource* within *package*. By default, the
148-
resource is opened for reading as UTF-8.
149-
150-
*package* is either a name or a module object which conforms to the
151-
``Package`` requirements. *resource* is the name of the resource to open
152-
within *package*; it may not contain path separators and it may not have
153-
sub-resources (i.e. it cannot be a directory). *encoding* and *errors*
154-
have the same meaning as with built-in :func:`open`.
155-
156-
This function returns a ``typing.TextIO`` instance, a text I/O stream open
157-
for reading.
158-
159-
.. deprecated:: 3.11
160-
161-
Calls to this function can be replaced by::
162-
163-
files(package).joinpath(resource).open('r', encoding=encoding)
164-
165-
166-
.. function:: read_binary(package, resource)
167-
168-
Read and return the contents of the *resource* within *package* as
169-
``bytes``.
170-
171-
*package* is either a name or a module object which conforms to the
172-
``Package`` requirements. *resource* is the name of the resource to open
173-
within *package*; it may not contain path separators and it may not have
174-
sub-resources (i.e. it cannot be a directory). This function returns the
175-
contents of the resource as :class:`bytes`.
176-
177-
.. deprecated:: 3.11
178-
179-
Calls to this function can be replaced by::
180-
181-
files(package).joinpath(resource).read_bytes()
182-
183-
184-
.. function:: read_text(package, resource, encoding='utf-8', errors='strict')
185-
186-
Read and return the contents of *resource* within *package* as a ``str``.
187-
By default, the contents are read as strict UTF-8.
188-
189-
*package* is either a name or a module object which conforms to the
190-
``Package`` requirements. *resource* is the name of the resource to open
191-
within *package*; it may not contain path separators and it may not have
192-
sub-resources (i.e. it cannot be a directory). *encoding* and *errors*
193-
have the same meaning as with built-in :func:`open`. This function
194-
returns the contents of the resource as :class:`str`.
195-
196-
.. deprecated:: 3.11
197-
198-
Calls to this function can be replaced by::
199-
200-
files(package).joinpath(resource).read_text(encoding=encoding)
201-
202-
203-
.. function:: path(package, resource)
204-
205-
Return the path to the *resource* as an actual file system path. This
206-
function returns a context manager for use in a :keyword:`with` statement.
207-
The context manager provides a :class:`pathlib.Path` object.
208-
209-
Exiting the context manager cleans up any temporary file created when the
210-
resource needs to be extracted from e.g. a zip file.
211-
212-
*package* is either a name or a module object which conforms to the
213-
``Package`` requirements. *resource* is the name of the resource to open
214-
within *package*; it may not contain path separators and it may not have
215-
sub-resources (i.e. it cannot be a directory).
216-
217-
.. deprecated:: 3.11
218-
219-
Calls to this function can be replaced using :func:`as_file`::
220-
221-
as_file(files(package).joinpath(resource))
222-
223-
224-
.. function:: is_resource(package, name)
225-
226-
Return ``True`` if there is a resource named *name* in the package,
227-
otherwise ``False``.
228-
This function does not consider directories to be resources.
229-
*package* is either a name or a module object which conforms to the
230-
``Package`` requirements.
231-
232-
.. deprecated:: 3.11
233-
234-
Calls to this function can be replaced by::
235-
236-
files(package).joinpath(resource).is_file()
237-
238-
239-
.. function:: contents(package)
240-
241-
Return an iterable over the named items within the package. The iterable
242-
returns :class:`str` resources (e.g. files) and non-resources
243-
(e.g. directories). The iterable does not recurse into subdirectories.
244-
245-
*package* is either a name or a module object which conforms to the
246-
``Package`` requirements.
247-
248-
.. deprecated:: 3.11
249-
250-
Calls to this function can be replaced by::
251-
252-
(resource.name for resource in files(package).iterdir() if resource.is_file())

0 commit comments

Comments
 (0)
0