Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-114277: Add return types to sqlite methods in docs #59

Merged
merged 27 commits into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
7a0ac89
gh-114178: Fix generate_sbom.py for out-of-tree builds (#114179)
erlend-aasland Jan 17, 2024
029ecee
gh-114070: fix token reference warnings in expressions.rst (#114169)
skirpichev Jan 17, 2024
33b47a2
gh-114149: [Enum] fix tuple subclass handling when using custom __new…
ethanfurman Jan 17, 2024
0b541f6
gh-105102: Fix nested unions in structures when the system byteorder …
Sh3idan Jan 17, 2024
7573c44
Fix typo in tkinter.ttk.rst (GH-106157)
christopheNan Jan 17, 2024
78fcde0
gh-38807: Fix race condition in Lib/trace.py (GH-110143)
buermarc Jan 17, 2024
f56d132
gh-112984 Update Windows build and installer for free-threaded builds…
zooba Jan 17, 2024
9455403
gh-112984: Fix test_ctypes.test_loading.test_load_dll_with_flags when…
zooba Jan 18, 2024
4c7e09d
gh-114149: [Enum] revert #114160 and add more tuple-subclass tests (G…
ethanfurman Jan 18, 2024
e2c097e
gh-104522: Fix OSError raised when run a subprocess (#114195)
serhiy-storchaka Jan 18, 2024
c1db960
gh-113205: test_multiprocessing.test_terminate: Test the API on threa…
encukou Jan 18, 2024
8cda720
gh-114211: Update EmailMessage doc about ordered keys (#114224)
terryjreedy Jan 18, 2024
6f4b242
gh-96905: In IDLE code, stop redefining built-ins 'dict' and 'object'…
terryjreedy Jan 18, 2024
ba683c2
gh-114231: Fix indentation in enum.rst (#114232)
miyashiiii Jan 18, 2024
311d1e2
gh-104522: Fix test_subprocess failure when build Python in the root …
serhiy-storchaka Jan 18, 2024
a571a2f
gh-114050: Fix crash when more than two arguments are passed to int()…
kcatss Jan 18, 2024
8e31cdc
gh-103092: Convert some `_ctypes` metatypes to heap types (GH-113620)
aisk Jan 18, 2024
b8f29b1
gh-110345: show Tcl/Tk patchlevel in `tkinter._test()` (GH-110350)
chrstphrchvz Jan 18, 2024
2ff072f
Delete unused macro (GH-114238)
markshannon Jan 18, 2024
9c93350
gh-108303: Move all doctest related files and tests to `Lib/test/test…
sobolevn Jan 18, 2024
339fc3c
gh-114198: Rename dataclass __replace__ argument to 'self' (gh-114251)
pschanely Jan 18, 2024
2d3f6b5
gh-114087: Speed up dataclasses._asdict_inner (#114088)
keithasaurus Jan 18, 2024
7fa511b
gh-111968: Use per-thread freelists for generator in free-threading (…
corona10 Jan 18, 2024
68a7b78
gh-112092: clarify unstable ABI recompilation requirements (#112093)
DerSchinken Jan 18, 2024
72abb8c
gh-114123: Migrate docstring from _csv to csv (#114124)
smontanaro Jan 18, 2024
d544285
gh-112087: Remove duplicated critical_section (gh-114268)
corona10 Jan 18, 2024
a34e4db
gh-111968: Fix --without-freelists build (gh-114270)
corona10 Jan 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/build_msi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ jobs:
strategy:
matrix:
type: [x86, x64, arm64]
env:
IncludeFreethreaded: true
steps:
- uses: actions/checkout@v4
- name: Build CPython installer
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/reusable-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Display build info
run: .\python.bat -m test.pythoninfo
- name: Tests
run: .\PCbuild\rt.bat -p Win32 -d -q --fast-ci
run: .\PCbuild\rt.bat -p Win32 -d -q --fast-ci ${{ inputs.free-threading && '--disable-gil' || '' }}

build_win_amd64:
name: 'build and test (x64)'
Expand All @@ -37,7 +37,7 @@ jobs:
- name: Display build info
run: .\python.bat -m test.pythoninfo
- name: Tests
run: .\PCbuild\rt.bat -p x64 -d -q --fast-ci
run: .\PCbuild\rt.bat -p x64 -d -q --fast-ci ${{ inputs.free-threading && '--disable-gil' || '' }}

build_win_arm64:
name: 'build (arm64)'
Expand Down
2 changes: 1 addition & 1 deletion Doc/c-api/stable.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ CPython's Application Binary Interface (ABI) is forward- and
backwards-compatible across a minor release (if these are compiled the same
way; see :ref:`stable-abi-platform` below).
So, code compiled for Python 3.10.0 will work on 3.10.8 and vice versa,
but will need to be compiled separately for 3.9.x and 3.10.x.
but will need to be compiled separately for 3.9.x and 3.11.x.

There are two tiers of C API with different stability expectations:

Expand Down
2 changes: 1 addition & 1 deletion Doc/library/doctest.rst
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ That's all you need to know to start making productive use of :mod:`doctest`!
Jump in. The following sections provide full details. Note that there are many
examples of doctests in the standard Python test suite and libraries.
Especially useful examples can be found in the standard test file
:file:`Lib/test/test_doctest.py`.
:file:`Lib/test/test_doctest/test_doctest.py`.


.. _doctest-simple-testmod:
Expand Down
6 changes: 3 additions & 3 deletions Doc/library/email.message.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ over the object tree.
The :class:`EmailMessage` dictionary-like interface is indexed by the header
names, which must be ASCII values. The values of the dictionary are strings
with some extra methods. Headers are stored and returned in case-preserving
form, but field names are matched case-insensitively. Unlike a real dict,
there is an ordering to the keys, and there can be duplicate keys. Additional
methods are provided for working with headers that have duplicate keys.
form, but field names are matched case-insensitively. The keys are ordered,
but unlike a real dict, there can be duplicates. Addtional methods are
provided for working with headers that have duplicate keys.

The *payload* is either a string or bytes object, in the case of simple message
objects, or a list of :class:`EmailMessage` objects, for MIME container
Expand Down
2 changes: 1 addition & 1 deletion Doc/library/enum.rst
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,7 @@ Utilities and Decorators

* ``FIRST = auto()`` will work (auto() is replaced with ``1``);
* ``SECOND = auto(), -2`` will work (auto is replaced with ``2``, so ``2, -2`` is
used to create the ``SECOND`` enum member;
used to create the ``SECOND`` enum member;
* ``THREE = [auto(), -3]`` will *not* work (``<auto instance>, -3`` is used to
create the ``THREE`` enum member)

Expand Down
2 changes: 1 addition & 1 deletion Doc/library/tkinter.ttk.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1118,7 +1118,7 @@ ttk.Treeview
as the item identifier; *iid* must not already exist in the tree.
Otherwise, a new unique identifier is generated.

See `Item Options`_ for the list of available points.
See `Item Options`_ for the list of available options.


.. method:: item(item, option=None, **kw)
Expand Down
5 changes: 3 additions & 2 deletions Doc/reference/expressions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ be used to describe syntax, not lexical analysis. When (one alternative of) a
syntax rule has the form

.. productionlist:: python-grammar
name: `othername`
name: othername

and no semantics are given, the semantics of this form of ``name`` are the same
as for ``othername``.
Expand Down Expand Up @@ -422,7 +422,8 @@ Yield expressions

.. productionlist:: python-grammar
yield_atom: "(" `yield_expression` ")"
yield_expression: "yield" [`expression_list` | "from" `expression`]
yield_from: "yield" "from" `expression`
yield_expression: "yield" `expression_list` | `yield_from`

The yield expression is used when defining a :term:`generator` function
or an :term:`asynchronous generator` function and
Expand Down
Binary file added Doc/using/win_install_freethreaded.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
64 changes: 62 additions & 2 deletions Doc/using/windows.rst
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,46 @@ settings and replace any that have been removed or modified.
"Uninstall" will remove Python entirely, with the exception of the
:ref:`launcher`, which has its own entry in Programs and Features.

.. _install-freethreaded-windows:

Installing Free-threaded Binaries
---------------------------------

.. versionadded:: 3.13 (Experimental)

.. note::

Everything described in this section is considered experimental,
and should be expected to change in future releases.

To install pre-built binaries with free-threading enabled (see :pep:`703`), you
should select "Customize installation". The second page of options includes the
"Download free-threaded binaries" checkbox.

.. image:: win_install_freethreaded.png

Selecting this option will download and install additional binaries to the same
location as the main Python install. The main executable is called
``python3.13t.exe``, and other binaries either receive a ``t`` suffix or a full
ABI suffix. Python source files and bundled third-party dependencies are shared
with the main install.

The free-threaded version is registered as a regular Python install with the
tag ``3.13t`` (with a ``-32`` or ``-arm64`` suffix as normal for those
platforms). This allows tools to discover it, and for the :ref:`launcher` to
support ``py.exe -3.13t``. Note that the launcher will interpret ``py.exe -3``
(or a ``python3`` shebang) as "the latest 3.x install", which will prefer the
free-threaded binaries over the regular ones, while ``py.exe -3.13`` will not.
If you use the short style of option, you may prefer to not install the
free-threaded binaries at this time.

To specify the install option at the command line, use
``Include_freethreaded=1``. See :ref:`install-layout-option` for instructions on
pre-emptively downloading the additional binaries for offline install. The
options to include debug symbols and binaries also apply to the free-threaded
builds.

Free-threaded binaries are also available :ref:`on nuget.org <windows-nuget>`.

.. _windows-store:

Expand Down Expand Up @@ -450,9 +490,29 @@ automatically use the headers and import libraries in your build.

The package information pages on nuget.org are
`www.nuget.org/packages/python <https://www.nuget.org/packages/python>`_
for the 64-bit version and `www.nuget.org/packages/pythonx86
<https://www.nuget.org/packages/pythonx86>`_ for the 32-bit version.
for the 64-bit version, `www.nuget.org/packages/pythonx86
<https://www.nuget.org/packages/pythonx86>`_ for the 32-bit version, and
`www.nuget.org/packages/pythonarm64
<https://www.nuget.org/packages/pythonarm64>`_ for the ARM64 version

Free-threaded packages
----------------------

.. versionadded:: 3.13 (Experimental)

.. note::

Everything described in this section is considered experimental,
and should be expected to change in future releases.

Packages containing free-threaded binaries are named
`python-freethreaded <https://www.nuget.org/packages/python-freethreaded>`_
for the 64-bit version, `pythonx86-freethreaded
<https://www.nuget.org/packages/pythonx86-freethreaded>`_ for the 32-bit
version, and `pythonarm64-freethreaded
<https://www.nuget.org/packages/pythonarm64-freethreaded>`_ for the ARM64
version. These packages contain both the ``python3.13t.exe`` and
``python.exe`` entry points, both of which run free threaded.

.. _windows-embeddable:

Expand Down
17 changes: 17 additions & 0 deletions Include/internal/pycore_freelist.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ extern "C" {
# define PyList_MAXFREELIST 80
# define PyFloat_MAXFREELIST 100
# define PyContext_MAXFREELIST 255
# define _PyAsyncGen_MAXFREELIST 80
#else
# define PyTuple_NFREELISTS 0
# define PyTuple_MAXFREELIST 0
# define PyList_MAXFREELIST 0
# define PyFloat_MAXFREELIST 0
# define PyContext_MAXFREELIST 0
# define _PyAsyncGen_MAXFREELIST 0
#endif

struct _Py_list_state {
Expand Down Expand Up @@ -77,12 +79,27 @@ struct _Py_context_state {
#endif
};

struct _Py_async_gen_state {
#ifdef WITH_FREELISTS
/* Freelists boost performance 6-10%; they also reduce memory
fragmentation, as _PyAsyncGenWrappedValue and PyAsyncGenASend
are short-living objects that are instantiated for every
__anext__() call. */
struct _PyAsyncGenWrappedValue* value_freelist[_PyAsyncGen_MAXFREELIST];
int value_numfree;

struct PyAsyncGenASend* asend_freelist[_PyAsyncGen_MAXFREELIST];
int asend_numfree;
#endif
};

typedef struct _Py_freelist_state {
struct _Py_float_state float_state;
struct _Py_tuple_state tuple_state;
struct _Py_list_state list_state;
struct _Py_slice_state slice_state;
struct _Py_context_state context_state;
struct _Py_async_gen_state async_gen_state;
} _PyFreeListState;

#ifdef __cplusplus
Expand Down
2 changes: 1 addition & 1 deletion Include/internal/pycore_gc.h
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ extern void _PyFloat_ClearFreeList(_PyFreeListState *state, int is_finalization)
extern void _PyList_ClearFreeList(_PyFreeListState *state, int is_finalization);
extern void _PySlice_ClearCache(_PyFreeListState *state);
extern void _PyDict_ClearFreeList(PyInterpreterState *interp);
extern void _PyAsyncGen_ClearFreeLists(PyInterpreterState *interp);
extern void _PyAsyncGen_ClearFreeLists(_PyFreeListState *state, int is_finalization);
extern void _PyContext_ClearFreeList(_PyFreeListState *state, int is_finalization);
extern void _Py_ScheduleGC(PyInterpreterState *interp);
extern void _Py_RunGC(PyThreadState *tstate);
Expand Down
31 changes: 3 additions & 28 deletions Include/internal/pycore_genobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ extern "C" {
# error "this header requires Py_BUILD_CORE define"
#endif

#include "pycore_freelist.h"

extern PyObject *_PyGen_yf(PyGenObject *);
extern void _PyGen_Finalize(PyObject *self);

Expand All @@ -26,34 +28,7 @@ extern PyTypeObject _PyAsyncGenAThrow_Type;

/* runtime lifecycle */

extern void _PyAsyncGen_Fini(PyInterpreterState *);


/* other API */

#ifndef WITH_FREELISTS
// without freelists
# define _PyAsyncGen_MAXFREELIST 0
#endif

#ifndef _PyAsyncGen_MAXFREELIST
# define _PyAsyncGen_MAXFREELIST 80
#endif

struct _Py_async_gen_state {
#if _PyAsyncGen_MAXFREELIST > 0
/* Freelists boost performance 6-10%; they also reduce memory
fragmentation, as _PyAsyncGenWrappedValue and PyAsyncGenASend
are short-living objects that are instantiated for every
__anext__() call. */
struct _PyAsyncGenWrappedValue* value_freelist[_PyAsyncGen_MAXFREELIST];
int value_numfree;

struct PyAsyncGenASend* asend_freelist[_PyAsyncGen_MAXFREELIST];
int asend_numfree;
#endif
};

extern void _PyAsyncGen_Fini(_PyFreeListState *);

#ifdef __cplusplus
}
Expand Down
1 change: 0 additions & 1 deletion Include/internal/pycore_interp.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@ struct _is {

struct _Py_tuple_state tuple;
struct _Py_dict_state dict_state;
struct _Py_async_gen_state async_gen;
struct _Py_exc_state exc_state;

struct ast_state ast;
Expand Down
76 changes: 69 additions & 7 deletions Lib/csv.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,90 @@

"""
csv.py - read/write/investigate CSV files
r"""
CSV parsing and writing.

This module provides classes that assist in the reading and writing
of Comma Separated Value (CSV) files, and implements the interface
described by PEP 305. Although many CSV files are simple to parse,
the format is not formally defined by a stable specification and
is subtle enough that parsing lines of a CSV file with something
like line.split(",") is bound to fail. The module supports three
basic APIs: reading, writing, and registration of dialects.


DIALECT REGISTRATION:

Readers and writers support a dialect argument, which is a convenient
handle on a group of settings. When the dialect argument is a string,
it identifies one of the dialects previously registered with the module.
If it is a class or instance, the attributes of the argument are used as
the settings for the reader or writer:

class excel:
delimiter = ','
quotechar = '"'
escapechar = None
doublequote = True
skipinitialspace = False
lineterminator = '\r\n'
quoting = QUOTE_MINIMAL

SETTINGS:

* quotechar - specifies a one-character string to use as the
quoting character. It defaults to '"'.
* delimiter - specifies a one-character string to use as the
field separator. It defaults to ','.
* skipinitialspace - specifies how to interpret spaces which
immediately follow a delimiter. It defaults to False, which
means that spaces immediately following a delimiter is part
of the following field.
* lineterminator - specifies the character sequence which should
terminate rows.
* quoting - controls when quotes should be generated by the writer.
It can take on any of the following module constants:

csv.QUOTE_MINIMAL means only when required, for example, when a
field contains either the quotechar or the delimiter
csv.QUOTE_ALL means that quotes are always placed around fields.
csv.QUOTE_NONNUMERIC means that quotes are always placed around
fields which do not parse as integers or floating point
numbers.
csv.QUOTE_STRINGS means that quotes are always placed around
fields which are strings. Note that the Python value None
is not a string.
csv.QUOTE_NOTNULL means that quotes are only placed around fields
that are not the Python value None.
csv.QUOTE_NONE means that quotes are never placed around fields.
* escapechar - specifies a one-character string used to escape
the delimiter when quoting is set to QUOTE_NONE.
* doublequote - controls the handling of quotes inside fields. When
True, two consecutive quotes are interpreted as one during read,
and when writing, each quote character embedded in the data is
written as two quotes
"""

import re
import types
from _csv import Error, __version__, writer, reader, register_dialect, \
from _csv import Error, writer, reader, register_dialect, \
unregister_dialect, get_dialect, list_dialects, \
field_size_limit, \
QUOTE_MINIMAL, QUOTE_ALL, QUOTE_NONNUMERIC, QUOTE_NONE, \
QUOTE_STRINGS, QUOTE_NOTNULL, \
__doc__
QUOTE_STRINGS, QUOTE_NOTNULL
from _csv import Dialect as _Dialect

from io import StringIO

__all__ = ["QUOTE_MINIMAL", "QUOTE_ALL", "QUOTE_NONNUMERIC", "QUOTE_NONE",
"QUOTE_STRINGS", "QUOTE_NOTNULL",
"Error", "Dialect", "__doc__", "excel", "excel_tab",
"Error", "Dialect", "excel", "excel_tab",
"field_size_limit", "reader", "writer",
"register_dialect", "get_dialect", "list_dialects", "Sniffer",
"unregister_dialect", "__version__", "DictReader", "DictWriter",
"unregister_dialect", "DictReader", "DictWriter",
"unix_dialect"]

__version__ = "1.0"


class Dialect:
"""Describe a CSV dialect.

Expand Down
4 changes: 2 additions & 2 deletions Lib/ctypes/_endian.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ def _other_endian(typ):
# if typ is array
if isinstance(typ, _array_type):
return _other_endian(typ._type_) * typ._length_
# if typ is structure
if issubclass(typ, Structure):
# if typ is structure or union
if issubclass(typ, (Structure, Union)):
return typ
raise TypeError("This type does not support other endian: %s" % typ)

Expand Down
Loading
Loading