Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b4a89e4

Browse files
Pull in main
2 parents 142ac7f + 56c7176 commit b4a89e4

87 files changed

Lines changed: 1715 additions & 777 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.

.github/CODEOWNERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ Objects/frameobject.c @markshannon
2525
Objects/call.c @markshannon
2626
Python/ceval.c @markshannon
2727
Python/compile.c @markshannon @iritkatriel
28+
Python/assemble.c @markshannon @iritkatriel
29+
Python/flowgraph.c @markshannon @iritkatriel
2830
Python/ast_opt.c @isidentical
2931
Lib/test/test_patma.py @brandtbucher
3032
Lib/test/test_peepholer.py @brandtbucher

.github/workflows/doc.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,13 @@ jobs:
5656

5757
# Add pull request annotations for Sphinx nitpicks (missing references)
5858
- name: 'Get list of changed files'
59+
if: github.event_name == 'pull_request'
5960
id: changed_files
6061
uses: Ana06/[email protected]
6162
with:
6263
filter: "Doc/**"
6364
- name: 'Build changed files in nit-picky mode'
65+
if: github.event_name == 'pull_request'
6466
continue-on-error: true
6567
run: |
6668
# Mark files the pull request modified
@@ -77,6 +79,26 @@ jobs:
7779
# Build docs with the '-n' (nit-picky) option, convert warnings to errors (-W)
7880
make -C Doc/ PYTHON=../python SPHINXOPTS="-q -n -W --keep-going" html 2>&1
7981
82+
# This build doesn't use problem matchers or check annotations
83+
# It also does not run 'make check', as sphinx-lint is not installed into the
84+
# environment.
85+
build_doc_oldest_supported_sphinx:
86+
name: 'Docs (Oldest Sphinx)'
87+
runs-on: ubuntu-latest
88+
timeout-minutes: 60
89+
steps:
90+
- uses: actions/checkout@v3
91+
- name: 'Set up Python'
92+
uses: actions/setup-python@v4
93+
with:
94+
python-version: '3.11' # known to work with Sphinx 3.2
95+
cache: 'pip'
96+
cache-dependency-path: 'Doc/requirements-oldest-sphinx.txt'
97+
- name: 'Install build dependencies'
98+
run: make -C Doc/ venv REQUIREMENTS="requirements-oldest-sphinx.txt"
99+
- name: 'Build HTML documentation'
100+
run: make -C Doc/ SPHINXOPTS="-q" SPHINXERRORHANDLING="-W --keep-going" html
101+
80102
# Run "doctest" on HEAD as new syntax doesn't exist in the latest stable release
81103
doctest:
82104
name: 'Doctest'

Doc/Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ JOBS = auto
1313
PAPER =
1414
SOURCES =
1515
DISTVERSION = $(shell $(PYTHON) tools/extensions/patchlevel.py)
16+
REQUIREMENTS = requirements.txt
1617
SPHINXERRORHANDLING = -W
1718

1819
# Internal variables.
@@ -154,8 +155,8 @@ venv:
154155
echo "To recreate it, remove it first with \`make clean-venv'."; \
155156
else \
156157
$(PYTHON) -m venv $(VENVDIR); \
157-
$(VENVDIR)/bin/python3 -m pip install -U pip setuptools; \
158-
$(VENVDIR)/bin/python3 -m pip install -r requirements.txt; \
158+
$(VENVDIR)/bin/python3 -m pip install --upgrade pip; \
159+
$(VENVDIR)/bin/python3 -m pip install -r $(REQUIREMENTS); \
159160
echo "The venv has been created in the $(VENVDIR) directory"; \
160161
fi
161162

Doc/c-api/typeobj.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1145,7 +1145,7 @@ and :c:type:`PyType_Type` effectively act as defaults.)
11451145

11461146
.. data:: Py_TPFLAGS_MANAGED_DICT
11471147

1148-
This bit indicates that instances of the class have a ``__dict___``
1148+
This bit indicates that instances of the class have a ``__dict__``
11491149
attribute, and that the space for the dictionary is managed by the VM.
11501150

11511151
If this flag is set, :const:`Py_TPFLAGS_HAVE_GC` should also be set.

Doc/c-api/unicode.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,15 @@ APIs:
509509
arguments.
510510
511511
512+
.. c:function:: PyObject* PyUnicode_FromObject(PyObject *obj)
513+
514+
Copy an instance of a Unicode subtype to a new true Unicode object if
515+
necessary. If *obj* is already a true Unicode object (not a subtype),
516+
return the reference with incremented refcount.
517+
518+
Objects other than Unicode or its subtypes will cause a :exc:`TypeError`.
519+
520+
512521
.. c:function:: PyObject* PyUnicode_FromEncodedObject(PyObject *obj, \
513522
const char *encoding, const char *errors)
514523
@@ -616,15 +625,6 @@ APIs:
616625
.. versionadded:: 3.3
617626
618627
619-
.. c:function:: PyObject* PyUnicode_FromObject(PyObject *obj)
620-
621-
Copy an instance of a Unicode subtype to a new true Unicode object if
622-
necessary. If *obj* is already a true Unicode object (not a subtype),
623-
return the reference with incremented refcount.
624-
625-
Objects other than Unicode or its subtypes will cause a :exc:`TypeError`.
626-
627-
628628
Locale Encoding
629629
"""""""""""""""
630630

Doc/library/__main__.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ This is where using the ``if __name__ == '__main__'`` code block comes in
124124
handy. Code within this block won't run unless the module is executed in the
125125
top-level environment.
126126

127-
Putting as few statements as possible in the block below ``if __name___ ==
127+
Putting as few statements as possible in the block below ``if __name__ ==
128128
'__main__'`` can improve code clarity and correctness. Most often, a function
129129
named ``main`` encapsulates the program's primary behavior::
130130

Doc/library/datetime.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -896,6 +896,10 @@ Other constructors, all class methods:
896896
in UTC. As such, the recommended way to create an object representing the
897897
current time in UTC is by calling ``datetime.now(timezone.utc)``.
898898

899+
.. deprecated:: 3.12
900+
901+
Use :meth:`datetime.now` with :attr:`UTC` instead.
902+
899903

900904
.. classmethod:: datetime.fromtimestamp(timestamp, tz=None)
901905

@@ -964,6 +968,10 @@ Other constructors, all class methods:
964968
:c:func:`gmtime` function. Raise :exc:`OSError` instead of
965969
:exc:`ValueError` on :c:func:`gmtime` failure.
966970

971+
.. deprecated:: 3.12
972+
973+
Use :meth:`datetime.fromtimestamp` with :attr:`UTC` instead.
974+
967975

968976
.. classmethod:: datetime.fromordinal(ordinal)
969977

Doc/library/sqlite3.rst

Lines changed: 59 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ Module functions
310310
to avoid data corruption.
311311
See :attr:`threadsafety` for more information.
312312

313-
:param Connection factory:
313+
:param ~sqlite3.Connection factory:
314314
A custom subclass of :class:`Connection` to create the connection with,
315315
if not the default :class:`Connection` class.
316316

@@ -337,7 +337,7 @@ Module functions
337337
The default will change to ``False`` in a future Python release.
338338
:type autocommit: bool
339339

340-
:rtype: Connection
340+
:rtype: ~sqlite3.Connection
341341

342342
.. audit-event:: sqlite3.connect database sqlite3.connect
343343
.. audit-event:: sqlite3.connect/handle connection_handle sqlite3.connect
@@ -573,6 +573,38 @@ Module constants
573573
package, a third-party library which used to upstream changes to
574574
:mod:`!sqlite3`. Today, it carries no meaning or practical value.
575575

576+
.. _sqlite3-dbconfig-constants:
577+
578+
.. data:: SQLITE_DBCONFIG_DEFENSIVE
579+
SQLITE_DBCONFIG_DQS_DDL
580+
SQLITE_DBCONFIG_DQS_DML
581+
SQLITE_DBCONFIG_ENABLE_FKEY
582+
SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER
583+
SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION
584+
SQLITE_DBCONFIG_ENABLE_QPSG
585+
SQLITE_DBCONFIG_ENABLE_TRIGGER
586+
SQLITE_DBCONFIG_ENABLE_VIEW
587+
SQLITE_DBCONFIG_LEGACY_ALTER_TABLE
588+
SQLITE_DBCONFIG_LEGACY_FILE_FORMAT
589+
SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE
590+
SQLITE_DBCONFIG_RESET_DATABASE
591+
SQLITE_DBCONFIG_TRIGGER_EQP
592+
SQLITE_DBCONFIG_TRUSTED_SCHEMA
593+
SQLITE_DBCONFIG_WRITABLE_SCHEMA
594+
595+
These constants are used for the :meth:`Connection.setconfig`
596+
and :meth:`~Connection.getconfig` methods.
597+
598+
The availability of these constants varies depending on the version of SQLite
599+
Python was compiled with.
600+
601+
.. versionadded:: 3.12
602+
603+
.. seealso::
604+
605+
https://www.sqlite.org/c3ref/c_dbconfig_defensive.html
606+
SQLite docs: Database Connection Configuration Options
607+
576608

577609
.. _sqlite3-connection-objects:
578610

@@ -1097,7 +1129,7 @@ Connection objects
10971129
Works even if the database is being accessed by other clients
10981130
or concurrently by the same connection.
10991131

1100-
:param Connection target:
1132+
:param ~sqlite3.Connection target:
11011133
The database connection to save the backup to.
11021134

11031135
:param int pages:
@@ -1219,6 +1251,30 @@ Connection objects
12191251
.. _SQLite limit category: https://www.sqlite.org/c3ref/c_limit_attached.html
12201252

12211253

1254+
.. method:: getconfig(op, /)
1255+
1256+
Query a boolean connection configuration option.
1257+
1258+
:param int op:
1259+
A :ref:`SQLITE_DBCONFIG code <sqlite3-dbconfig-constants>`.
1260+
1261+
:rtype: bool
1262+
1263+
.. versionadded:: 3.12
1264+
1265+
.. method:: setconfig(op, enable=True, /)
1266+
1267+
Set a boolean connection configuration option.
1268+
1269+
:param int op:
1270+
A :ref:`SQLITE_DBCONFIG code <sqlite3-dbconfig-constants>`.
1271+
1272+
:param bool enable:
1273+
``True`` if the configuration option should be enabled (default);
1274+
``False`` if it should be disabled.
1275+
1276+
.. versionadded:: 3.12
1277+
12221278
.. method:: serialize(*, name="main")
12231279

12241280
Serialize a database into a :class:`bytes` object. For an

Doc/library/typing.rst

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ annotations. These include:
9898
*Introducing* :data:`LiteralString`
9999
* :pep:`681`: Data Class Transforms
100100
*Introducing* the :func:`@dataclass_transform<dataclass_transform>` decorator
101+
* :pep:`692`: Using ``TypedDict`` for more precise ``**kwargs`` typing
102+
*Introducing* a new way of typing ``**kwargs`` with :data:`Unpack` and
103+
:data:`TypedDict`
101104
* :pep:`698`: Adding an override decorator to typing
102105
*Introducing* the :func:`@override<override>` decorator
103106

@@ -1417,8 +1420,10 @@ These are not used in annotations. They are building blocks for creating generic
14171420
tup: tuple[Unpack[Ts]]
14181421

14191422
In fact, ``Unpack`` can be used interchangeably with ``*`` in the context
1420-
of types. You might see ``Unpack`` being used explicitly in older versions
1421-
of Python, where ``*`` couldn't be used in certain places::
1423+
of :class:`typing.TypeVarTuple <TypeVarTuple>` and
1424+
:class:`builtins.tuple <tuple>` types. You might see ``Unpack`` being used
1425+
explicitly in older versions of Python, where ``*`` couldn't be used in
1426+
certain places::
14221427

14231428
# In older versions of Python, TypeVarTuple and Unpack
14241429
# are located in the `typing_extensions` backports package.
@@ -1428,6 +1433,21 @@ These are not used in annotations. They are building blocks for creating generic
14281433
tup: tuple[*Ts] # Syntax error on Python <= 3.10!
14291434
tup: tuple[Unpack[Ts]] # Semantically equivalent, and backwards-compatible
14301435

1436+
``Unpack`` can also be used along with :class:`typing.TypedDict` for typing
1437+
``**kwargs`` in a function signature::
1438+
1439+
from typing import TypedDict, Unpack
1440+
1441+
class Movie(TypedDict):
1442+
name: str
1443+
year: int
1444+
1445+
# This function expects two keyword arguments - `name` of type `str`
1446+
# and `year` of type `int`.
1447+
def foo(**kwargs: Unpack[Movie]): ...
1448+
1449+
See :pep:`692` for more details on using ``Unpack`` for ``**kwargs`` typing.
1450+
14311451
.. versionadded:: 3.11
14321452

14331453
.. class:: ParamSpec(name, *, bound=None, covariant=False, contravariant=False)

Doc/library/unittest.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2281,7 +2281,8 @@ Loading and running tests
22812281

22822282
The *testRunner* argument can either be a test runner class or an already
22832283
created instance of it. By default ``main`` calls :func:`sys.exit` with
2284-
an exit code indicating success or failure of the tests run.
2284+
an exit code indicating success (0) or failure (1) of the tests run.
2285+
An exit code of 5 indicates that no tests were run.
22852286

22862287
The *testLoader* argument has to be a :class:`TestLoader` instance,
22872288
and defaults to :data:`defaultTestLoader`.

0 commit comments

Comments
 (0)