Skip to content

Commit

Permalink
Merge branch 'sqlite/testcapi' of https://github.com/erlend-aasland/c…
Browse files Browse the repository at this point in the history
…python into ghpython-116307/safe-site-dir
  • Loading branch information
jaraco committed Mar 6, 2024
2 parents bbb927a + db45852 commit 369fcff
Show file tree
Hide file tree
Showing 154 changed files with 1,705 additions and 736 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ENV WASI_SDK_VERSION=20
ENV WASI_SDK_PATH=/opt/wasi-sdk

ENV WASMTIME_HOME=/opt/wasmtime
ENV WASMTIME_VERSION=14.0.4
ENV WASMTIME_VERSION=18.0.2
ENV WASMTIME_CPU_ARCH=x86_64

RUN dnf -y --nodocs --setopt=install_weak_deps=False install /usr/bin/{blurb,clang,curl,git,ln,tar,xz} 'dnf-command(builddep)' && \
Expand Down
18 changes: 15 additions & 3 deletions .github/workflows/jit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ jobs:
target:
- i686-pc-windows-msvc/msvc
- x86_64-pc-windows-msvc/msvc
- aarch64-pc-windows-msvc/msvc
- x86_64-apple-darwin/clang
- aarch64-apple-darwin/clang
- x86_64-unknown-linux-gnu/gcc
Expand All @@ -49,6 +50,10 @@ jobs:
architecture: x64
runner: windows-latest
compiler: msvc
- target: aarch64-pc-windows-msvc/msvc
architecture: ARM64
runner: windows-latest
compiler: msvc
- target: x86_64-apple-darwin/clang
architecture: x86_64
runner: macos-13
Expand Down Expand Up @@ -85,14 +90,21 @@ jobs:
with:
python-version: '3.11'

- name: Windows
if: runner.os == 'Windows'
- name: Native Windows
if: runner.os == 'Windows' && matrix.architecture != 'ARM64'
run: |
choco install llvm --allow-downgrade --no-progress --version ${{ matrix.llvm }}
./PCbuild/build.bat --experimental-jit ${{ matrix.debug && '-d' || '--pgo' }} -p ${{ matrix.architecture }}
./PCbuild/rt.bat ${{ matrix.debug && '-d' }} -p ${{ matrix.architecture }} -q --exclude ${{ matrix.exclude }} --multiprocess 0 --timeout 3600 --verbose2 --verbose3
- name: macOS
# No PGO or tests (yet):
- name: Emulated Windows
if: runner.os == 'Windows' && matrix.architecture == 'ARM64'
run: |
choco install llvm --allow-downgrade --no-progress --version ${{ matrix.llvm }}
./PCbuild/build.bat --experimental-jit ${{ matrix.debug && '-d' || '' }} -p ${{ matrix.architecture }}
- name: Native macOS
if: runner.os == 'macOS'
run: |
brew install llvm@${{ matrix.llvm }}
Expand Down
6 changes: 3 additions & 3 deletions Doc/c-api/structures.rst
Original file line number Diff line number Diff line change
Expand Up @@ -702,20 +702,20 @@ Defining Getters and Setters
.. c:member:: void* closure
Optional function pointer, providing additional data for getter and setter.
Optional user data pointer, providing additional data for getter and setter.
.. c:type:: PyObject *(*getter)(PyObject *, void *)
The ``get`` function takes one :c:expr:`PyObject*` parameter (the
instance) and a function pointer (the associated ``closure``):
instance) and a user data pointer (the associated ``closure``):
It should return a new reference on success or ``NULL`` with a set exception
on failure.
.. c:type:: int (*setter)(PyObject *, PyObject *, void *)
``set`` functions take two :c:expr:`PyObject*` parameters (the instance and
the value to be set) and a function pointer (the associated ``closure``):
the value to be set) and a user data pointer (the associated ``closure``):
In case the attribute should be deleted the second parameter is ``NULL``.
Should return ``0`` on success or ``-1`` with a set exception on failure.
2 changes: 1 addition & 1 deletion Doc/library/asyncio-eventloop.rst
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ Opening network connections
Added support for Windows.

.. versionchanged:: 3.11
The *reuse_address* parameter, disabled since Python 3.9.0, 3.8.1,
The *reuse_address* parameter, disabled since Python 3.8.1,
3.7.6 and 3.6.10, has been entirely removed.

.. coroutinemethod:: loop.create_unix_connection(protocol_factory, \
Expand Down
2 changes: 1 addition & 1 deletion Doc/library/audit_events.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Audit events table

This table contains all events raised by :func:`sys.audit` or
:c:func:`PySys_Audit` calls throughout the CPython runtime and the
standard library. These calls were added in 3.8.0 or later (see :pep:`578`).
standard library. These calls were added in 3.8 or later (see :pep:`578`).

See :func:`sys.addaudithook` and :c:func:`PySys_AddAuditHook` for
information on handling these events.
Expand Down
2 changes: 1 addition & 1 deletion Doc/library/decimal.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1517,7 +1517,7 @@ are also included in the pure Python version for compatibility.
the C version uses a thread-local rather than a coroutine-local context and the value
is ``False``. This is slightly faster in some nested context scenarios.

.. versionadded:: 3.9 backported to 3.7 and 3.8.
.. versionadded:: 3.8.3


Rounding modes
Expand Down
9 changes: 7 additions & 2 deletions Doc/library/filecmp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,20 @@ The :mod:`filecmp` module defines the following functions:
The :class:`dircmp` class
-------------------------

.. class:: dircmp(a, b, ignore=None, hide=None)
.. class:: dircmp(a, b, ignore=None, hide=None, shallow=True)

Construct a new directory comparison object, to compare the directories *a*
and *b*. *ignore* is a list of names to ignore, and defaults to
:const:`filecmp.DEFAULT_IGNORES`. *hide* is a list of names to hide, and
defaults to ``[os.curdir, os.pardir]``.

The :class:`dircmp` class compares files by doing *shallow* comparisons
as described for :func:`filecmp.cmp`.
as described for :func:`filecmp.cmp` by default using the *shallow*
parameter.

.. versionchanged:: 3.13

Added the *shallow* parameter.

The :class:`dircmp` class provides the following methods:

Expand Down
2 changes: 1 addition & 1 deletion Doc/library/idle.rst
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ in an editor window.
The editing features described in previous subsections work when entering
code interactively. IDLE's Shell window also responds to the following:

* :kbd:`C-c` attemps to interrupt statement execution (but may fail).
* :kbd:`C-c` attempts to interrupt statement execution (but may fail).

* :kbd:`C-d` closes Shell if typed at a ``>>>`` prompt.

Expand Down
12 changes: 1 addition & 11 deletions Doc/library/ipaddress.rst
Original file line number Diff line number Diff line change
Expand Up @@ -121,22 +121,12 @@ write code that handles both IP versions correctly. Address objects are
Leading zeros are tolerated, even in ambiguous cases that look like
octal notation.

.. versionchanged:: 3.10
.. versionchanged:: 3.9.5

Leading zeros are no longer tolerated and are treated as an error.
IPv4 address strings are now parsed as strict as glibc
:func:`~socket.inet_pton`.

.. versionchanged:: 3.9.5

The above change was also included in Python 3.9 starting with
version 3.9.5.

.. versionchanged:: 3.8.12

The above change was also included in Python 3.8 starting with
version 3.8.12.

.. attribute:: version

The appropriate version number: ``4`` for IPv4, ``6`` for IPv6.
Expand Down
39 changes: 16 additions & 23 deletions Doc/library/itertools.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ Iterator Arguments Results
:func:`chain` p, q, ... p0, p1, ... plast, q0, q1, ... ``chain('ABC', 'DEF') --> A B C D E F``
:func:`chain.from_iterable` iterable p0, p1, ... plast, q0, q1, ... ``chain.from_iterable(['ABC', 'DEF']) --> A B C D E F``
:func:`compress` data, selectors (d[0] if s[0]), (d[1] if s[1]), ... ``compress('ABCDEF', [1,0,1,0,1,1]) --> A C E F``
:func:`dropwhile` pred, seq seq[n], seq[n+1], starting when pred fails ``dropwhile(lambda x: x<5, [1,4,6,4,1]) --> 6 4 1``
:func:`filterfalse` pred, seq elements of seq where pred(elem) is false ``filterfalse(lambda x: x%2, range(10)) --> 0 2 4 6 8``
:func:`dropwhile` predicate, seq seq[n], seq[n+1], starting when predicate fails ``dropwhile(lambda x: x<5, [1,4,6,4,1]) --> 6 4 1``
:func:`filterfalse` predicate, seq elements of seq where predicate(elem) fails ``filterfalse(lambda x: x%2, range(10)) --> 0 2 4 6 8``
:func:`groupby` iterable[, key] sub-iterators grouped by value of key(v)
:func:`islice` seq, [start,] stop [, step] elements from seq[start:stop:step] ``islice('ABCDEFG', 2, None) --> C D E F G``
:func:`pairwise` iterable (p[0], p[1]), (p[1], p[2]) ``pairwise('ABCDEFG') --> AB BC CD DE EF FG``
:func:`starmap` func, seq func(\*seq[0]), func(\*seq[1]), ... ``starmap(pow, [(2,5), (3,2), (10,3)]) --> 32 9 1000``
:func:`takewhile` pred, seq seq[0], seq[1], until pred fails ``takewhile(lambda x: x<5, [1,4,6,4,1]) --> 1 4``
:func:`takewhile` predicate, seq seq[0], seq[1], until predicate fails ``takewhile(lambda x: x<5, [1,4,6,4,1]) --> 1 4``
:func:`tee` it, n it1, it2, ... itn splits one iterator into n
:func:`zip_longest` p, q, ... (p[0], q[0]), (p[1], q[1]), ... ``zip_longest('ABCD', 'xy', fillvalue='-') --> Ax By C- D-``
============================ ============================ ================================================= =============================================================
Expand Down Expand Up @@ -90,7 +90,7 @@ Examples Results

.. _itertools-functions:

Itertool functions
Itertool Functions
------------------

The following module functions all construct and return iterators. Some provide
Expand Down Expand Up @@ -859,27 +859,20 @@ which incur interpreter overhead.
"Returns the nth item or a default value."
return next(islice(iterable, n, None), default)

def quantify(iterable, pred=bool):
def quantify(iterable, predicate=bool):
"Given a predicate that returns True or False, count the True results."
return sum(map(pred, iterable))
return sum(map(predicate, iterable))

def first_true(iterable, default=False, predicate=None):
"Returns the first true value or the *default* if there is no true value."
# first_true([a,b,c], x) --> a or b or c or x
# first_true([a,b], x, f) --> a if f(a) else b if f(b) else x
return next(filter(predicate, iterable), default)

def all_equal(iterable, key=None):
"Returns True if all the elements are equal to each other."
return len(take(2, groupby(iterable, key))) <= 1

def first_true(iterable, default=False, pred=None):
"""Returns the first true value in the iterable.

If no true value is found, returns *default*

If *pred* is not None, returns the first item
for which pred(item) is true.

"""
# first_true([a,b,c], x) --> a or b or c or x
# first_true([a,b], x, f) --> a if f(a) else b if f(b) else x
return next(filter(pred, iterable), default)

def unique_everseen(iterable, key=None):
"List unique elements, preserving order. Remember all elements ever seen."
# unique_everseen('AAAABBBCCDAABBB') --> A B C D
Expand Down Expand Up @@ -964,14 +957,14 @@ which incur interpreter overhead.
num_active -= 1
nexts = cycle(islice(nexts, num_active))
def partition(pred, iterable):
def partition(predicate, iterable):
"""Partition entries into false entries and true entries.

If *pred* is slow, consider wrapping it with functools.lru_cache().
If *predicate* is slow, consider wrapping it with functools.lru_cache().
"""
# partition(is_odd, range(10)) --> 0 2 4 6 8 and 1 3 5 7 9
t1, t2 = tee(iterable)
return filterfalse(pred, t1), filter(pred, t2)
return filterfalse(predicate, t1), filter(predicate, t2)

def subslices(seq):
"Return all contiguous non-empty subslices of a sequence."
Expand Down Expand Up @@ -1214,7 +1207,7 @@ The following recipes have a more mathematical flavor:
>>> quantify([True, False, False, True, True])
3

>>> quantify(range(12), pred=lambda x: x%2==1)
>>> quantify(range(12), predicate=lambda x: x%2==1)
6

>>> a = [[1, 2, 3], [4, 5, 6]]
Expand Down
4 changes: 2 additions & 2 deletions Doc/library/pprint.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Functions
The configuration parameters *stream*, *indent*, *width*, *depth*,
*compact*, *sort_dicts* and *underscore_numbers* are passed to the
:class:`PrettyPrinter` constructor and their meanings are as
described in its documentation above.
described in its documentation below.

>>> import pprint
>>> stuff = ['spam', 'eggs', 'lumberjack', 'knights', 'ni']
Expand All @@ -78,7 +78,7 @@ Functions
Return the formatted representation of *object* as a string. *indent*,
*width*, *depth*, *compact*, *sort_dicts* and *underscore_numbers* are
passed to the :class:`PrettyPrinter` constructor as formatting parameters
and their meanings are as described in its documentation above.
and their meanings are as described in its documentation below.


.. function:: isreadable(object)
Expand Down
6 changes: 3 additions & 3 deletions Doc/library/ssl.rst
Original file line number Diff line number Diff line change
Expand Up @@ -737,11 +737,11 @@ Constants
When Python has been compiled against an older version of OpenSSL, the
flag defaults to *0*.

.. versionadded:: 3.7
.. versionadded:: 3.6.3

.. deprecated:: 3.7
The option is deprecated since OpenSSL 1.1.0. It was added to 2.7.15,
3.6.3 and 3.7.0 for backwards compatibility with OpenSSL 1.0.2.
The option is deprecated since OpenSSL 1.1.0. It was added to 2.7.15 and
3.6.3 for backwards compatibility with OpenSSL 1.0.2.

.. data:: OP_NO_RENEGOTIATION

Expand Down
8 changes: 1 addition & 7 deletions Doc/library/typing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -954,7 +954,6 @@ using ``[]``.
be used for this concept instead. Type checkers should treat the two
equivalently.

.. versionadded:: 3.5.4
.. versionadded:: 3.6.2

.. data:: Self
Expand Down Expand Up @@ -3292,7 +3291,6 @@ Aliases to types in :mod:`collections`

Deprecated alias to :class:`collections.ChainMap`.

.. versionadded:: 3.5.4
.. versionadded:: 3.6.1

.. deprecated:: 3.9
Expand All @@ -3303,7 +3301,6 @@ Aliases to types in :mod:`collections`

Deprecated alias to :class:`collections.Counter`.

.. versionadded:: 3.5.4
.. versionadded:: 3.6.1

.. deprecated:: 3.9
Expand All @@ -3314,7 +3311,6 @@ Aliases to types in :mod:`collections`

Deprecated alias to :class:`collections.deque`.

.. versionadded:: 3.5.4
.. versionadded:: 3.6.1

.. deprecated:: 3.9
Expand Down Expand Up @@ -3389,7 +3385,7 @@ Aliases to container ABCs in :mod:`collections.abc`

Deprecated alias to :class:`collections.abc.Collection`.

.. versionadded:: 3.6.0
.. versionadded:: 3.6

.. deprecated:: 3.9
:class:`collections.abc.Collection` now supports subscripting (``[]``).
Expand Down Expand Up @@ -3681,7 +3677,6 @@ Aliases to :mod:`contextlib` ABCs
Deprecated alias to :class:`contextlib.AbstractContextManager`.

.. versionadded:: 3.5.4
.. versionadded:: 3.6.0

.. deprecated:: 3.9
:class:`contextlib.AbstractContextManager`
Expand All @@ -3692,7 +3687,6 @@ Aliases to :mod:`contextlib` ABCs

Deprecated alias to :class:`contextlib.AbstractAsyncContextManager`.

.. versionadded:: 3.5.4
.. versionadded:: 3.6.2

.. deprecated:: 3.9
Expand Down
3 changes: 3 additions & 0 deletions Doc/whatsnew/3.13.rst
Original file line number Diff line number Diff line change
Expand Up @@ -791,6 +791,9 @@ Deprecated
coroutine.
(Contributed by Irit Katriel in :gh:`81137`.)

* The undocumented and unused ``tarfile`` attribute of :class:`tarfile.TarFile`
is deprecated and scheduled for removal in Python 3.16.


Pending Removal in Python 3.14
------------------------------
Expand Down
2 changes: 1 addition & 1 deletion Include/cpython/code.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ typedef struct {
PyObject *_co_freevars;
} _PyCoCached;

/* Ancilliary data structure used for instrumentation.
/* Ancillary data structure used for instrumentation.
Line instrumentation creates an array of
these. One entry per code unit.*/
typedef struct {
Expand Down
2 changes: 1 addition & 1 deletion Include/internal/pycore_compile.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ int _PyCompile_EnsureArrayLargeEnough(
int _PyCompile_ConstCacheMergeOne(PyObject *const_cache, PyObject **obj);


// Export for '_opcode' extention module
// Export for '_opcode' extension module
PyAPI_FUNC(int) _PyCompile_OpcodeIsValid(int opcode);
PyAPI_FUNC(int) _PyCompile_OpcodeHasArg(int opcode);
PyAPI_FUNC(int) _PyCompile_OpcodeHasConst(int opcode);
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 @@ -73,7 +73,7 @@ static inline int _PyObject_GC_MAY_BE_TRACKED(PyObject *obj) {

/* True if an object is shared between multiple threads and
* needs special purpose when freeing to do the possibility
* of in-flight lock-free reads occuring */
* of in-flight lock-free reads occurring */
static inline int _PyObject_GC_IS_SHARED(PyObject *op) {
return (op->ob_gc_bits & _PyGC_BITS_SHARED) != 0;
}
Expand Down
2 changes: 1 addition & 1 deletion Include/internal/pycore_instruments.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ extern "C" {
#define PY_MONITORING_EVENT_RERAISE 14


/* Ancilliary events */
/* Ancillary events */

#define PY_MONITORING_EVENT_C_RETURN 15
#define PY_MONITORING_EVENT_C_RAISE 16
Expand Down
2 changes: 1 addition & 1 deletion Include/internal/pycore_interp.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ typedef struct _rare_events {
*/
struct _is {

/* This struct countains the eval_breaker,
/* This struct contains the eval_breaker,
* which is by far the hottest field in this struct
* and should be placed at the beginning. */
struct _ceval_state ceval;
Expand Down
Loading

0 comments on commit 369fcff

Please sign in to comment.