Skip to content

Commit 482742a

Browse files
committed
Merge remote-tracking branch 'upstream/main' into reduce_dependencty_on_compiler
2 parents c233570 + 1735710 commit 482742a

File tree

107 files changed

+945
-580
lines changed

Some content is hidden

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

107 files changed

+945
-580
lines changed

.github/workflows/doc.yml

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ on:
2323
paths:
2424
- 'Doc/**'
2525
- 'Misc/**'
26+
- '.github/workflows/doc.yml'
2627

2728
permissions:
2829
contents: read
@@ -35,6 +36,38 @@ jobs:
3536
- uses: actions/checkout@v3
3637
- name: Register Sphinx problem matcher
3738
run: echo "::add-matcher::.github/problem-matchers/sphinx.json"
39+
- name: 'Set up Python'
40+
uses: actions/setup-python@v4
41+
with:
42+
python-version: '3'
43+
cache: 'pip'
44+
cache-dependency-path: 'Doc/requirements.txt'
45+
- name: 'Install build dependencies'
46+
run: make -C Doc/ venv
47+
- name: 'Check documentation'
48+
run: make -C Doc/ check
49+
- name: 'Build HTML documentation'
50+
run: make -C Doc/ SPHINXOPTS="-q" SPHINXERRORHANDLING="-W --keep-going" html
51+
- name: 'Upload'
52+
uses: actions/upload-artifact@v3
53+
with:
54+
name: doc-html
55+
path: Doc/build/html
56+
57+
# Run "doctest" on HEAD as new syntax doesn't exist in the latest stable release
58+
doctest:
59+
name: 'Doctest'
60+
runs-on: ubuntu-latest
61+
steps:
62+
- uses: actions/checkout@v3
63+
- name: Register Sphinx problem matcher
64+
run: echo "::add-matcher::.github/problem-matchers/sphinx.json"
65+
- uses: actions/cache@v3
66+
with:
67+
path: ~/.cache/pip
68+
key: ubuntu-doc-${{ hashFiles('Doc/requirements.txt') }}
69+
restore-keys: |
70+
ubuntu-doc-
3871
- name: 'Install Dependencies'
3972
run: sudo ./.github/workflows/posix-deps-apt.sh && sudo apt-get install wamerican
4073
- name: 'Configure CPython'
@@ -43,17 +76,6 @@ jobs:
4376
run: make -j4
4477
- name: 'Install build dependencies'
4578
run: make -C Doc/ PYTHON=../python venv
46-
# Run "check doctest html" as 3 steps to get a more readable output
47-
# in the web UI
48-
- name: 'Check documentation'
49-
run: make -C Doc/ PYTHON=../python SPHINXOPTS="-q -W --keep-going" check
5079
# Use "xvfb-run" since some doctest tests open GUI windows
5180
- name: 'Run documentation doctest'
52-
run: xvfb-run make -C Doc/ PYTHON=../python SPHINXOPTS="-q -W --keep-going" doctest
53-
- name: 'Build HTML documentation'
54-
run: make -C Doc/ PYTHON=../python SPHINXOPTS="-q -W --keep-going" html
55-
- name: 'Upload'
56-
uses: actions/upload-artifact@v3
57-
with:
58-
name: doc-html
59-
path: Doc/build/html
81+
run: xvfb-run make -C Doc/ PYTHON=../python SPHINXOPTS="-q" SPHINXERRORHANDLING="-W --keep-going" doctest

Doc/c-api/sys.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,12 @@ Operating System Utilities
2121
2222
Return true (nonzero) if the standard I/O file *fp* with name *filename* is
2323
deemed interactive. This is the case for files for which ``isatty(fileno(fp))``
24-
is true. If the global flag :c:data:`Py_InteractiveFlag` is true, this function
24+
is true. If the :c:member:`PyConfig.interactive` is non-zero, this function
2525
also returns true if the *filename* pointer is ``NULL`` or if the name is equal to
2626
one of the strings ``'<stdin>'`` or ``'???'``.
2727
28+
This function must not be called before Python is initialized.
29+
2830
2931
.. c:function:: void PyOS_BeforeFork()
3032

Doc/library/socket.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2076,10 +2076,10 @@ the interface::
20762076
# Include IP headers
20772077
s.setsockopt(socket.IPPROTO_IP, socket.IP_HDRINCL, 1)
20782078

2079-
# receive all packages
2079+
# receive all packets
20802080
s.ioctl(socket.SIO_RCVALL, socket.RCVALL_ON)
20812081

2082-
# receive a package
2082+
# receive a packet
20832083
print(s.recvfrom(65565))
20842084

20852085
# disabled promiscuous mode

Doc/library/sqlite3.rst

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -336,9 +336,9 @@ Module functions and constants
336336
float, str or bytes.
337337

338338

339-
.. function:: complete_statement(sql)
339+
.. function:: complete_statement(statement)
340340

341-
Returns :const:`True` if the string *sql* contains one or more complete SQL
341+
Returns :const:`True` if the string *statement* contains one or more complete SQL
342342
statements terminated by semicolons. It does not verify that the SQL is
343343
syntactically correct, only that there are no unclosed string literals and the
344344
statement is terminated by a semicolon.
@@ -457,11 +457,11 @@ Connection Objects
457457
:meth:`~Cursor.executescript` on it with the given *sql_script*.
458458
Return the new cursor object.
459459

460-
.. method:: create_function(name, num_params, func, *, deterministic=False)
460+
.. method:: create_function(name, narg, func, *, deterministic=False)
461461

462462
Creates a user-defined function that you can later use from within SQL
463-
statements under the function name *name*. *num_params* is the number of
464-
parameters the function accepts (if *num_params* is -1, the function may
463+
statements under the function name *name*. *narg* is the number of
464+
parameters the function accepts (if *narg* is -1, the function may
465465
take any number of arguments), and *func* is a Python callable that is
466466
called as the SQL function. If *deterministic* is true, the created function
467467
is marked as `deterministic <https://sqlite.org/deterministic.html>`_, which
@@ -480,12 +480,12 @@ Connection Objects
480480
.. literalinclude:: ../includes/sqlite3/md5func.py
481481

482482

483-
.. method:: create_aggregate(name, num_params, aggregate_class)
483+
.. method:: create_aggregate(name, n_arg, aggregate_class)
484484

485485
Creates a user-defined aggregate function.
486486

487487
The aggregate class must implement a ``step`` method, which accepts the number
488-
of parameters *num_params* (if *num_params* is -1, the function may take
488+
of parameters *n_arg* (if *n_arg* is -1, the function may take
489489
any number of arguments), and a ``finalize`` method which will return the
490490
final result of the aggregate.
491491

@@ -580,15 +580,15 @@ Connection Objects
580580
Added support for disabling the authorizer using :const:`None`.
581581

582582

583-
.. method:: set_progress_handler(handler, n)
583+
.. method:: set_progress_handler(progress_handler, n)
584584

585585
This routine registers a callback. The callback is invoked for every *n*
586586
instructions of the SQLite virtual machine. This is useful if you want to
587587
get called from SQLite during long-running operations, for example to update
588588
a GUI.
589589

590590
If you want to clear any previously installed progress handler, call the
591-
method with :const:`None` for *handler*.
591+
method with :const:`None` for *progress_handler*.
592592

593593
Returning a non-zero value from the handler function will terminate the
594594
currently executing query and cause it to raise a :exc:`DatabaseError`
@@ -628,7 +628,7 @@ Connection Objects
628628

629629
Loadable extensions are disabled by default. See [#f1]_.
630630

631-
.. audit-event:: sqlite3.enable_load_extension connection,enabled sqlite3.enable_load_extension
631+
.. audit-event:: sqlite3.enable_load_extension connection,enabled sqlite3.Connection.enable_load_extension
632632

633633
.. versionadded:: 3.2
634634

@@ -645,7 +645,7 @@ Connection Objects
645645

646646
Loadable extensions are disabled by default. See [#f1]_.
647647

648-
.. audit-event:: sqlite3.load_extension connection,path sqlite3.load_extension
648+
.. audit-event:: sqlite3.load_extension connection,path sqlite3.Connection.load_extension
649649

650650
.. versionadded:: 3.2
651651

Doc/library/test.rst

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,51 @@ The :mod:`test.support` module defines the following constants:
413413

414414
The :mod:`test.support` module defines the following functions:
415415

416+
.. function:: busy_retry(timeout, err_msg=None, /, *, error=True)
417+
418+
Run the loop body until ``break`` stops the loop.
419+
420+
After *timeout* seconds, raise an :exc:`AssertionError` if *error* is true,
421+
or just stop the loop if *error* is false.
422+
423+
Example::
424+
425+
for _ in support.busy_retry(support.SHORT_TIMEOUT):
426+
if check():
427+
break
428+
429+
Example of error=False usage::
430+
431+
for _ in support.busy_retry(support.SHORT_TIMEOUT, error=False):
432+
if check():
433+
break
434+
else:
435+
raise RuntimeError('my custom error')
436+
437+
.. function:: sleeping_retry(timeout, err_msg=None, /, *, init_delay=0.010, max_delay=1.0, error=True)
438+
439+
Wait strategy that applies exponential backoff.
440+
441+
Run the loop body until ``break`` stops the loop. Sleep at each loop
442+
iteration, but not at the first iteration. The sleep delay is doubled at
443+
each iteration (up to *max_delay* seconds).
444+
445+
See :func:`busy_retry` documentation for the parameters usage.
446+
447+
Example raising an exception after SHORT_TIMEOUT seconds::
448+
449+
for _ in support.sleeping_retry(support.SHORT_TIMEOUT):
450+
if check():
451+
break
452+
453+
Example of error=False usage::
454+
455+
for _ in support.sleeping_retry(support.SHORT_TIMEOUT, error=False):
456+
if check():
457+
break
458+
else:
459+
raise RuntimeError('my custom error')
460+
416461
.. function:: is_resource_enabled(resource)
417462

418463
Return ``True`` if *resource* is enabled and available. The list of

Doc/whatsnew/3.12.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,14 @@ Removed
184184
* ``sqlite3.enable_shared_cache()``
185185
* ``sqlite3.OptimizedUnicode``
186186

187+
If a shared cache must be used, open the database in URI mode using the
188+
``cache=shared`` query parameter.
189+
190+
The ``sqlite3.OptimizedUnicode`` text factory has been an alias for
191+
:class:`str` since Python 3.3. Code that previously set the text factory to
192+
``OptimizedUnicode`` can either use ``str`` explicitly, or rely on the
193+
default value which is also ``str``.
194+
187195
(Contributed by Erlend E. Aasland in :gh:`92548`)
188196

189197
* The ``--experimental-isolated-subinterpreters`` configure flag

Include/boolobject.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ extern "C" {
99

1010
PyAPI_DATA(PyTypeObject) PyBool_Type;
1111

12-
#define PyBool_Check(x) Py_IS_TYPE(x, &PyBool_Type)
12+
#define PyBool_Check(x) Py_IS_TYPE((x), &PyBool_Type)
1313

1414
/* Py_False and Py_True are the only two bools in existence.
1515
Don't forget to apply Py_INCREF() when returning either!!! */

Include/bytearrayobject.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ PyAPI_DATA(PyTypeObject) PyByteArray_Type;
2121
PyAPI_DATA(PyTypeObject) PyByteArrayIter_Type;
2222

2323
/* Type check macros */
24-
#define PyByteArray_Check(self) PyObject_TypeCheck(self, &PyByteArray_Type)
25-
#define PyByteArray_CheckExact(self) Py_IS_TYPE(self, &PyByteArray_Type)
24+
#define PyByteArray_Check(self) PyObject_TypeCheck((self), &PyByteArray_Type)
25+
#define PyByteArray_CheckExact(self) Py_IS_TYPE((self), &PyByteArray_Type)
2626

2727
/* Direct API functions */
2828
PyAPI_FUNC(PyObject *) PyByteArray_FromObject(PyObject *);

Include/bytesobject.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ PyAPI_DATA(PyTypeObject) PyBytesIter_Type;
2929

3030
#define PyBytes_Check(op) \
3131
PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_BYTES_SUBCLASS)
32-
#define PyBytes_CheckExact(op) Py_IS_TYPE(op, &PyBytes_Type)
32+
#define PyBytes_CheckExact(op) Py_IS_TYPE((op), &PyBytes_Type)
3333

3434
PyAPI_FUNC(PyObject *) PyBytes_FromStringAndSize(const char *, Py_ssize_t);
3535
PyAPI_FUNC(PyObject *) PyBytes_FromString(const char *);

Include/complexobject.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ extern "C" {
1010

1111
PyAPI_DATA(PyTypeObject) PyComplex_Type;
1212

13-
#define PyComplex_Check(op) PyObject_TypeCheck(op, &PyComplex_Type)
14-
#define PyComplex_CheckExact(op) Py_IS_TYPE(op, &PyComplex_Type)
13+
#define PyComplex_Check(op) PyObject_TypeCheck((op), &PyComplex_Type)
14+
#define PyComplex_CheckExact(op) Py_IS_TYPE((op), &PyComplex_Type)
1515

1616
PyAPI_FUNC(PyObject *) PyComplex_FromDoubles(double real, double imag);
1717

0 commit comments

Comments
 (0)