Skip to content

Commit 0aad4ed

Browse files
Merge branch 'main' into csv-dialect-strict
2 parents af8f1e0 + 67f4d53 commit 0aad4ed

431 files changed

Lines changed: 13073 additions & 4439 deletions

File tree

Some content is hidden

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

.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,12 @@ Include/internal/pycore_ast_state.h generated
8080
Include/internal/pycore_opcode.h generated
8181
Include/internal/pycore_opcode_metadata.h generated
8282
Include/internal/pycore_*_generated.h generated
83+
Include/internal/pycore_token.h generated
8384
Include/internal/pycore_uop_ids.h generated
8485
Include/internal/pycore_uop_metadata.h generated
8586
Include/opcode.h generated
8687
Include/opcode_ids.h generated
8788
Include/slots_generated.h generated
88-
Include/token.h generated
8989
Lib/_opcode_metadata.py generated
9090
Lib/idlelib/help.html generated
9191
Lib/keyword.py generated

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ Tools/cases_generator/ @markshannon
223223
Python/assemble.c @markshannon @iritkatriel
224224
Python/codegen.c @markshannon @iritkatriel
225225
Python/compile.c @markshannon @iritkatriel
226-
Python/flowgraph.c @markshannon @iritkatriel
226+
Python/flowgraph.c @markshannon @iritkatriel @eclips4
227227
Python/instruction_sequence.c @iritkatriel
228228
Python/symtable.c @JelleZijlstra @carljm
229229

Doc/about.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ and now maintained as an independent project.
1010
.. _reStructuredText: https://docutils.sourceforge.io/rst.html
1111
.. _Sphinx: https://www.sphinx-doc.org/
1212

13-
.. In the online version of these documents, you can submit comments and suggest
13+
.. In the online version of this documentation, you can submit comments and suggest
1414
changes directly on the documentation pages.
1515
1616
Development of the documentation and its toolchain is an entirely volunteer

Doc/c-api/import.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ Importing Modules
146146
alternatives.
147147
148148
.. versionchanged:: 3.15
149-
``__cached__`` is no longer set.
149+
The ``__cached__`` attribute is no longer set.
150150
151151
152152
.. c:function:: PyObject* PyImport_ExecCodeModuleEx(const char *name, PyObject *co, const char *pathname)
@@ -170,7 +170,7 @@ Importing Modules
170170
:class:`~importlib.machinery.ModuleSpec` for alternatives.
171171
172172
.. versionchanged:: 3.15
173-
``__cached__`` no longer set.
173+
The ``__cached__`` attribute no longer set.
174174
175175
176176
.. c:function:: PyObject* PyImport_ExecCodeModuleWithPathnames(const char *name, PyObject *co, const char *pathname, const char *cpathname)

Doc/extending/extending.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1106,7 +1106,7 @@ Finally it should be mentioned that Capsules offer additional functionality,
11061106
which is especially useful for memory allocation and deallocation of the pointer
11071107
stored in a Capsule. The details are described in the Python/C API Reference
11081108
Manual in the section :ref:`capsules` and in the implementation of Capsules (files
1109-
:file:`Include/pycapsule.h` and :file:`Objects/pycapsule.c` in the Python source
1109+
:file:`Include/pycapsule.h` and :file:`Objects/capsule.c` in the Python source
11101110
code distribution).
11111111

11121112
.. rubric:: Footnotes

Doc/library/annotationlib.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,8 @@ Functions
235235
annotate functions that support the :attr:`~Format.STRING` format but
236236
do not have access to the code creating the annotations.
237237

238-
For example, this is used to implement the :attr:`~Format.STRING` for
239-
:class:`typing.TypedDict` classes created through the functional syntax:
238+
For example, this is used to implement the :attr:`~Format.STRING` format
239+
for :class:`typing.TypedDict` classes created through the functional syntax:
240240

241241
.. doctest::
242242

Doc/library/ast.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -806,8 +806,11 @@ Comprehensions
806806
List and set comprehensions, generator expressions, and dictionary
807807
comprehensions. ``elt`` (or ``key`` and ``value``) is a single node
808808
representing the part that will be evaluated for each item.
809+
809810
For dictionary comprehensions using unpacking, for example
810-
``{**item for item in items}``, ``value`` is ``None``,
811+
``{**item for item in items}``, the expression to be expanded goes in
812+
``key`` and ``value`` is ``None``.
813+
811814
``generators`` is a list of :class:`comprehension` nodes.
812815

813816
.. doctest::

Doc/library/asyncio-task.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -843,17 +843,13 @@ Timeouts
843843
Wait for the *fut* :ref:`awaitable <asyncio-awaitables>`
844844
to complete with a timeout.
845845

846-
If *fut* is a coroutine it is automatically scheduled as a Task.
847-
848846
*timeout* can either be ``None`` or a float or int number of seconds
849847
to wait for. If *timeout* is ``None``, block until the future
850848
completes.
851849

852-
If a timeout occurs, it cancels the task and raises
853-
:exc:`TimeoutError`.
850+
If a timeout occurs, it cancels *fut* and raises :exc:`TimeoutError`.
854851

855-
To avoid the task :meth:`cancellation <Task.cancel>`,
856-
wrap it in :func:`shield`.
852+
To prevent *fut* from being cancelled, wrap it in :func:`shield`.
857853

858854
The function will wait until the future is actually cancelled,
859855
so the total wait time may exceed the *timeout*. If an exception
@@ -894,6 +890,10 @@ Timeouts
894890
.. versionchanged:: 3.11
895891
Raises :exc:`TimeoutError` instead of :exc:`asyncio.TimeoutError`.
896892

893+
.. versionchanged:: 3.12
894+
Implemented using :func:`asyncio.timeout`, a coroutine passed as *fut*
895+
is no longer wrapped in a :class:`Task` when *timeout* is positive.
896+
897897

898898
Waiting primitives
899899
==================

Doc/library/compression.zstd.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ Compressing and decompressing data in memory
346346
will be set to ``True``.
347347

348348
Attempting to decompress data after the end of a frame will raise a
349-
:exc:`ZstdError`. Any data found after the end of the frame is ignored
349+
:exc:`EOFError`. Any data found after the end of the frame is ignored
350350
and saved in the :attr:`~.unused_data` attribute.
351351

352352
.. attribute:: eof

Doc/library/csv.rst

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -324,14 +324,19 @@ The :mod:`!csv` module defines the following classes:
324324

325325
If several combinations fit the sample equally well ---
326326
for example if both ``','`` and ``';'`` split every row consistently ---
327-
the delimiters ``','``, ``'\t'``, ``';'``, ``' '`` and ``':'``
328-
are preferred, in this order,
327+
the delimiters listed in the :attr:`~Sniffer.preferred` attribute
328+
are preferred, in that order,
329329
no matter how many times each of them occurs.
330330

331+
The *lineterminator* parameter is deduced separately,
332+
by a majority vote among the line endings of the sample.
333+
A tie is broken in the order ``'\r\n'``, ``'\n'``, ``'\r'``,
334+
so a sample without a complete line gives ``'\r\n'``.
335+
331336
.. versionchanged:: next
332337
The dialect is now deduced by trial parsing
333338
and the results may differ from those of earlier Python versions.
334-
The *escapechar* parameter can now be detected,
339+
The *escapechar* and *lineterminator* parameters can now be detected,
335340
and the requested *delimiters* are not restricted to ASCII.
336341

337342

@@ -354,6 +359,15 @@ The :mod:`!csv` module defines the following classes:
354359
This method is a rough heuristic and may produce both false positives and
355360
negatives.
356361

362+
The :class:`Sniffer` class has the following attribute:
363+
364+
.. attribute:: preferred
365+
366+
The list of the delimiters preferred for breaking ties,
367+
in the order of preference.
368+
It can be modified.
369+
Its initial value is ``[',', '\t', ';', ' ', ':']``.
370+
357371
An example for :class:`Sniffer` use::
358372

359373
with open('example.csv', newline='') as csvfile:
@@ -377,6 +391,8 @@ The :mod:`!csv` module defines the following constants:
377391
Instructs :class:`writer` objects to only quote those fields which contain
378392
special characters such as *delimiter*, *quotechar*, ``'\r'``, ``'\n'``
379393
or any of the characters in *lineterminator*.
394+
If *doublequote* is :const:`False` and *escapechar* is set,
395+
the *quotechar* is escaped instead of causing the field to be quoted.
380396

381397

382398
.. data:: QUOTE_NONNUMERIC
@@ -481,6 +497,10 @@ Dialects support the following attributes:
481497
On reading, the *escapechar* removes any special meaning from
482498
the following character. It defaults to :const:`None`, which disables escaping.
483499

500+
.. versionchanged:: 3.10
501+
Previously the *escapechar* itself was not escaped,
502+
which lost it on reading.
503+
484504
.. versionchanged:: 3.11
485505
An empty *escapechar* is not allowed.
486506

@@ -528,6 +548,13 @@ Dialects support the following attributes:
528548
When ``True``, raise exception :exc:`Error` on bad CSV input.
529549
The default is ``False``.
530550

551+
Dialects support :func:`copy.replace`,
552+
which returns a copy of the dialect
553+
with the specified formatting parameters replaced.
554+
555+
.. versionchanged:: next
556+
Added support for :func:`copy.replace`.
557+
531558
.. _reader-objects:
532559

533560
Reader Objects

0 commit comments

Comments
 (0)