Skip to content

Commit

Permalink
Merge branch 'main' into sqlite-optimise-resets
Browse files Browse the repository at this point in the history
  • Loading branch information
Erlend E. Aasland committed Sep 6, 2021
2 parents 73e1ddb + 5cb4c67 commit 9684593
Show file tree
Hide file tree
Showing 286 changed files with 14,142 additions and 11,028 deletions.
16 changes: 8 additions & 8 deletions .azure-pipelines/ci.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
variables:
coverage: false

trigger: ['main', '3.9', '3.8', '3.7']
trigger: ['main', '3.10', '3.9', '3.8', '3.7']

jobs:
- job: Prebuild
displayName: Pre-build checks

pool:
vmImage: ubuntu-18.04
vmImage: ubuntu-20.04

steps:
- template: ./prebuild-checks.yml
Expand All @@ -20,7 +20,7 @@ jobs:
condition: and(succeeded(), eq(dependencies.Prebuild.outputs['docs.run'], 'true'))

pool:
vmImage: ubuntu-18.04
vmImage: ubuntu-20.04

steps:
- template: ./docs-steps.yml
Expand All @@ -40,7 +40,7 @@ jobs:
testRunPlatform: macos

pool:
vmImage: macos-10.14
vmImage: macos-10.15

steps:
- template: ./macos-steps.yml
Expand All @@ -52,12 +52,12 @@ jobs:
condition: and(succeeded(), eq(dependencies.Prebuild.outputs['tests.run'], 'true'))

pool:
vmImage: ubuntu-18.04
vmImage: ubuntu-20.04

variables:
testRunTitle: '$(build.sourceBranchName)-linux'
testRunPlatform: linux
openssl_version: 1.1.1k
openssl_version: 1.1.1l

steps:
- template: ./posix-steps.yml
Expand All @@ -78,12 +78,12 @@ jobs:
)
pool:
vmImage: ubuntu-18.04
vmImage: ubuntu-20.04

variables:
testRunTitle: '$(Build.SourceBranchName)-linux-coverage'
testRunPlatform: linux-coverage
openssl_version: 1.1.1k
openssl_version: 1.1.1l

steps:
- template: ./posix-steps.yml
Expand Down
16 changes: 8 additions & 8 deletions .azure-pipelines/pr.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
variables:
coverage: false

pr: ['main', '3.9', '3.8', '3.7']
pr: ['main', '3.10', '3.9', '3.8', '3.7']

jobs:
- job: Prebuild
displayName: Pre-build checks

pool:
vmImage: ubuntu-18.04
vmImage: ubuntu-20.04

steps:
- template: ./prebuild-checks.yml
Expand All @@ -20,7 +20,7 @@ jobs:
condition: and(succeeded(), eq(dependencies.Prebuild.outputs['docs.run'], 'true'))

pool:
vmImage: ubuntu-18.04
vmImage: ubuntu-20.04

steps:
- template: ./docs-steps.yml
Expand All @@ -38,7 +38,7 @@ jobs:
testRunPlatform: macos

pool:
vmImage: macos-10.14
vmImage: macos-10.15

steps:
- template: ./macos-steps.yml
Expand All @@ -52,12 +52,12 @@ jobs:
condition: and(succeeded(), eq(dependencies.Prebuild.outputs['tests.run'], 'true'))

pool:
vmImage: ubuntu-18.04
vmImage: ubuntu-20.04

variables:
testRunTitle: '$(system.pullRequest.TargetBranch)-linux'
testRunPlatform: linux
openssl_version: 1.1.1k
openssl_version: 1.1.1l

steps:
- template: ./posix-steps.yml
Expand All @@ -78,12 +78,12 @@ jobs:
)
pool:
vmImage: ubuntu-18.04
vmImage: ubuntu-20.04

variables:
testRunTitle: '$(Build.SourceBranchName)-linux-coverage'
testRunPlatform: linux-coverage
openssl_version: 1.1.1k
openssl_version: 1.1.1l

steps:
- template: ./posix-steps.yml
Expand Down
3 changes: 1 addition & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ Modules/clinic/*.h linguist-generated=true
Objects/clinic/*.h linguist-generated=true
PC/clinic/*.h linguist-generated=true
Python/clinic/*.h linguist-generated=true
Python/importlib.h linguist-generated=true
Python/importlib_external.h linguist-generated=true
Python/frozen_modules/*.h linguist-generated=true
Include/internal/pycore_ast.h linguist-generated=true
Python/Python-ast.c linguist-generated=true
Include/opcode.h linguist-generated=true
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ jobs:
make regen-stdlib-module-names
- name: Check for changes
run: |
git add -u
changes=$(git status --porcelain)
# Check for changes in regenerated files
if ! test -z "$changes"
Expand All @@ -83,6 +84,8 @@ jobs:
run: make smelly
- name: Check limited ABI symbols
run: make check-limited-abi
- name: Check Autoconf version 2.69
run: grep "Generated by GNU Autoconf 2.69" configure

build_win32:
name: 'Windows (x86)'
Expand Down Expand Up @@ -138,7 +141,7 @@ jobs:
needs: check_source
if: needs.check_source.outputs.run_tests == 'true'
env:
OPENSSL_VER: 1.1.1k
OPENSSL_VER: 1.1.1l
PYTHONSTRICTEXTENSIONBUILD: 1
steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -182,7 +185,7 @@ jobs:
strategy:
fail-fast: false
matrix:
openssl_ver: [1.1.1k, 3.0.0-beta1]
openssl_ver: [1.1.1l, 3.0.0-beta1]
env:
OPENSSL_VER: ${{ matrix.openssl_ver }}
MULTISSL_DIR: ${{ github.workspace }}/multissl
Expand Down Expand Up @@ -229,7 +232,7 @@ jobs:
needs: check_source
if: needs.check_source.outputs.run_tests == 'true'
env:
OPENSSL_VER: 1.1.1k
OPENSSL_VER: 1.1.1l
PYTHONSTRICTEXTENSIONBUILD: 1
ASAN_OPTIONS: detect_leaks=0:allocator_may_return_null=1:handle_segv=0
steps:
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Modules/Setup.config
Modules/Setup.local
Modules/config.c
Modules/ld_so_aix
Programs/_freeze_importlib
Programs/_freeze_module
Programs/_testembed
PC/python_nt*.h
PC/pythonnt_rc*.h
Expand Down
2 changes: 1 addition & 1 deletion Doc/c-api/init.rst
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ to 1 and ``-bb`` sets :c:data:`Py_BytesWarningFlag` to 2.
Suppress error messages when calculating the module search path in
:c:func:`Py_GetPath`.

Private flag used by ``_freeze_importlib`` and ``frozenmain`` programs.
Private flag used by ``_freeze_module`` and ``frozenmain`` programs.

.. c:var:: int Py_HashRandomizationFlag
Expand Down
99 changes: 56 additions & 43 deletions Doc/c-api/intro.rst
Original file line number Diff line number Diff line change
Expand Up @@ -105,45 +105,63 @@ defined closer to where they are useful (e.g. :c:macro:`Py_RETURN_NONE`).
Others of a more general utility are defined here. This is not necessarily a
complete listing.

.. c:macro:: Py_UNREACHABLE()
.. c:macro:: Py_ABS(x)
Use this when you have a code path that cannot be reached by design.
For example, in the ``default:`` clause in a ``switch`` statement for which
all possible values are covered in ``case`` statements. Use this in places
where you might be tempted to put an ``assert(0)`` or ``abort()`` call.
Return the absolute value of ``x``.

In release mode, the macro helps the compiler to optimize the code, and
avoids a warning about unreachable code. For example, the macro is
implemented with ``__builtin_unreachable()`` on GCC in release mode.
.. versionadded:: 3.3

A use for ``Py_UNREACHABLE()`` is following a call a function that
never returns but that is not declared :c:macro:`_Py_NO_RETURN`.
.. c:macro:: Py_CHARMASK(c)
If a code path is very unlikely code but can be reached under exceptional
case, this macro must not be used. For example, under low memory condition
or if a system call returns a value out of the expected range. In this
case, it's better to report the error to the caller. If the error cannot
be reported to caller, :c:func:`Py_FatalError` can be used.
Argument must be a character or an integer in the range [-128, 127] or [0,
255]. This macro returns ``c`` cast to an ``unsigned char``.

.. versionadded:: 3.7
.. c:macro:: Py_DEPRECATED(version)
.. c:macro:: Py_ABS(x)
Use this for deprecated declarations. The macro must be placed before the
symbol name.

Return the absolute value of ``x``.
Example::

Py_DEPRECATED(3.8) PyAPI_FUNC(int) Py_OldFunction(void);

.. versionchanged:: 3.8
MSVC support was added.

.. c:macro:: Py_GETENV(s)
Like ``getenv(s)``, but returns ``NULL`` if :option:`-E` was passed on the
command line (i.e. if ``Py_IgnoreEnvironmentFlag`` is set).

.. c:macro:: Py_MAX(x, y)
Return the maximum value between ``x`` and ``y``.

.. versionadded:: 3.3

.. c:macro:: Py_MEMBER_SIZE(type, member)
Return the size of a structure (``type``) ``member`` in bytes.

.. versionadded:: 3.6

.. c:macro:: Py_MIN(x, y)
Return the minimum value between ``x`` and ``y``.

.. versionadded:: 3.3

.. c:macro:: Py_MAX(x, y)
.. c:macro:: Py_NO_INLINE
Return the maximum value between ``x`` and ``y``.
Disable inlining on a function. For example, it reduces the C stack
consumption: useful on LTO+PGO builds which heavily inline code (see
:issue:`33720`).

.. versionadded:: 3.3
Usage::

Py_NO_INLINE static int random(void) { return 4; }

.. versionadded:: 3.11

.. c:macro:: Py_STRINGIFY(x)
Expand All @@ -152,21 +170,27 @@ complete listing.

.. versionadded:: 3.4

.. c:macro:: Py_MEMBER_SIZE(type, member)
Return the size of a structure (``type``) ``member`` in bytes.
.. c:macro:: Py_UNREACHABLE()
.. versionadded:: 3.6
Use this when you have a code path that cannot be reached by design.
For example, in the ``default:`` clause in a ``switch`` statement for which
all possible values are covered in ``case`` statements. Use this in places
where you might be tempted to put an ``assert(0)`` or ``abort()`` call.

.. c:macro:: Py_CHARMASK(c)
In release mode, the macro helps the compiler to optimize the code, and
avoids a warning about unreachable code. For example, the macro is
implemented with ``__builtin_unreachable()`` on GCC in release mode.

Argument must be a character or an integer in the range [-128, 127] or [0,
255]. This macro returns ``c`` cast to an ``unsigned char``.
A use for ``Py_UNREACHABLE()`` is following a call a function that
never returns but that is not declared :c:macro:`_Py_NO_RETURN`.

.. c:macro:: Py_GETENV(s)
If a code path is very unlikely code but can be reached under exceptional
case, this macro must not be used. For example, under low memory condition
or if a system call returns a value out of the expected range. In this
case, it's better to report the error to the caller. If the error cannot
be reported to caller, :c:func:`Py_FatalError` can be used.

Like ``getenv(s)``, but returns ``NULL`` if :option:`-E` was passed on the
command line (i.e. if ``Py_IgnoreEnvironmentFlag`` is set).
.. versionadded:: 3.7

.. c:macro:: Py_UNUSED(arg)
Expand All @@ -175,18 +199,6 @@ complete listing.

.. versionadded:: 3.4

.. c:macro:: Py_DEPRECATED(version)
Use this for deprecated declarations. The macro must be placed before the
symbol name.

Example::

Py_DEPRECATED(3.8) PyAPI_FUNC(int) Py_OldFunction(void);

.. versionchanged:: 3.8
MSVC support was added.

.. c:macro:: PyDoc_STRVAR(name, str)
Creates a variable with name ``name`` that can be used in docstrings.
Expand Down Expand Up @@ -221,6 +233,7 @@ complete listing.
{NULL, NULL}
};


.. _api-objects:

Objects, Types and Reference Counts
Expand Down
5 changes: 4 additions & 1 deletion Doc/includes/sqlite3/complete_statement.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@
if buffer.lstrip().upper().startswith("SELECT"):
print(cur.fetchall())
except sqlite3.Error as e:
print("An error occurred:", e.args[0])
err_msg = str(e)
err_code = e.sqlite_errorcode
err_name = e.sqlite_errorname
print(f"{err_name} ({err_code}): {err_msg}")
buffer = ""

con.close()
15 changes: 9 additions & 6 deletions Doc/library/2to3.rst
Original file line number Diff line number Diff line change
Expand Up @@ -464,12 +464,15 @@ and off individually. They are described here in more detail.

--------------

.. deprecated:: 3.10
Python 3.9 will switch to a PEG parser (see :pep:`617`), and Python 3.10 may
include new language syntax that is not parsable by lib2to3's LL(1) parser.
The ``lib2to3`` module may be removed from the standard library in a future
Python version. Consider third-party alternatives such as `LibCST`_ or
`parso`_.
.. deprecated-removed:: 3.11 3.13
Python 3.9 switched to a PEG parser (see :pep:`617`) while lib2to3 is
using a less flexible LL(1) parser. Python 3.10 includes new language
syntax that is not parsable by lib2to3's LL(1) parser (see :pep:`634`).
The ``lib2to3`` module was marked pending for deprecation in Python 3.9
(raising :exc:`PendingDeprecationWarning` on import) and fully deprecated
in Python 3.11 (raising :exc:`DeprecationWarning`).
It will be removed from the standard library in Python 3.13.
Consider third-party alternatives such as `LibCST`_ or `parso`_.

.. note::

Expand Down
Loading

0 comments on commit 9684593

Please sign in to comment.