Skip to content

Commit

Permalink
Merge branch 'main' into remove-imp
Browse files Browse the repository at this point in the history
  • Loading branch information
warsaw committed Apr 14, 2023
2 parents b3c3517 + 95ee7c4 commit 61991ef
Show file tree
Hide file tree
Showing 110 changed files with 7,118 additions and 3,980 deletions.
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ Lib/test/test_importlib/resources/data01/* noeol
Lib/test/test_importlib/resources/namespacedata01/* noeol
Lib/test/xmltestdata/* noeol

# Shell scripts should have LF even on Windows because of Cygwin
Lib/venv/scripts/common/activate text eol=lf

# CRLF files
[attr]dos text eol=crlf

Expand Down
6 changes: 1 addition & 5 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,7 @@ Python/traceback.c @iritkatriel
/Tools/build/parse_html5_entities.py @ezio-melotti

# Import (including importlib).
# Ignoring importlib.h so as to not get flagged on
# all pull requests that change the emitted
# bytecode.
**/*import*.c @brettcannon @encukou @ericsnowcurrently @ncoghlan @warsaw
**/*import*.py @brettcannon @encukou @ericsnowcurrently @ncoghlan @warsaw
**/*import* @brettcannon @encukou @ericsnowcurrently @ncoghlan @warsaw
**/*importlib/resources/* @jaraco @warsaw @FFY00
**/importlib/metadata/* @jaraco @warsaw

Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ jobs:
check_source:
name: 'Check for source changes'
runs-on: ubuntu-latest
timeout-minutes: 10
outputs:
run_tests: ${{ steps.check.outputs.run_tests }}
steps:
Expand Down Expand Up @@ -63,6 +64,7 @@ jobs:
check_generated_files:
name: 'Check if generated files are up to date'
runs-on: ubuntu-latest
timeout-minutes: 60
needs: check_source
if: needs.check_source.outputs.run_tests == 'true'
steps:
Expand Down Expand Up @@ -118,6 +120,7 @@ jobs:
build_win32:
name: 'Windows (x86)'
runs-on: windows-latest
timeout-minutes: 60
needs: check_source
if: needs.check_source.outputs.run_tests == 'true'
env:
Expand All @@ -126,7 +129,6 @@ jobs:
- uses: actions/checkout@v3
- name: Build CPython
run: .\PCbuild\build.bat -e -d -p Win32
timeout-minutes: 30
- name: Display build info
run: .\python.bat -m test.pythoninfo
- name: Tests
Expand All @@ -135,6 +137,7 @@ jobs:
build_win_amd64:
name: 'Windows (x64)'
runs-on: windows-latest
timeout-minutes: 60
needs: check_source
if: needs.check_source.outputs.run_tests == 'true'
env:
Expand All @@ -145,7 +148,6 @@ jobs:
run: echo "::add-matcher::.github/problem-matchers/msvc.json"
- name: Build CPython
run: .\PCbuild\build.bat -e -d -p x64
timeout-minutes: 30
- name: Display build info
run: .\python.bat -m test.pythoninfo
- name: Tests
Expand All @@ -154,6 +156,7 @@ jobs:
build_macos:
name: 'macOS'
runs-on: macos-latest
timeout-minutes: 60
needs: check_source
if: needs.check_source.outputs.run_tests == 'true'
env:
Expand Down Expand Up @@ -184,6 +187,7 @@ jobs:
build_ubuntu:
name: 'Ubuntu'
runs-on: ubuntu-20.04
timeout-minutes: 60
needs: check_source
if: needs.check_source.outputs.run_tests == 'true'
env:
Expand Down Expand Up @@ -241,6 +245,7 @@ jobs:
build_ubuntu_ssltests:
name: 'Ubuntu SSL tests with OpenSSL'
runs-on: ubuntu-20.04
timeout-minutes: 60
needs: check_source
if: needs.check_source.outputs.run_tests == 'true'
strategy:
Expand Down Expand Up @@ -290,6 +295,7 @@ jobs:
build_asan:
name: 'Address sanitizer'
runs-on: ubuntu-20.04
timeout-minutes: 60
needs: check_source
if: needs.check_source.outputs.run_tests == 'true'
env:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build_msi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
build:
name: Windows Installer
runs-on: windows-latest
timeout-minutes: 60
strategy:
matrix:
type: [x86, x64, arm64]
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ jobs:
build_doc:
name: 'Docs'
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v3
- name: Register Sphinx problem matcher
Expand Down Expand Up @@ -80,6 +81,7 @@ jobs:
doctest:
name: 'Doctest'
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v3
- name: Register Sphinx problem matcher
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/new-bugs-announce-notifier.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ permissions:
jobs:
notify-new-bugs-announce:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/setup-node@v3
with:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/project-updater.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ jobs:
add-to-project:
name: Add issues to projects
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
matrix:
include:
Expand All @@ -22,7 +23,7 @@ jobs:
- { project: 3, label: expert-subinterpreters }
- { project: 29, label: expert-asyncio }
- { project: 32, label: sprint }

steps:
- uses: actions/add-to-project@v0.1.0
with:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/require-pr-label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ jobs:
label:
name: DO-NOT-MERGE
runs-on: ubuntu-latest
timeout-minutes: 10

steps:
- uses: mheap/github-action-required-labels@v4
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ jobs:
if: github.repository_owner == 'python'

runs-on: ubuntu-latest
timeout-minutes: 10

steps:
- name: "Check PRs"
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/verify-ensurepip-wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ concurrency:
jobs:
verify:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
Expand Down
8 changes: 5 additions & 3 deletions Doc/howto/enum.rst
Original file line number Diff line number Diff line change
Expand Up @@ -865,17 +865,19 @@ Some rules:
4. When another data type is mixed in, the :attr:`value` attribute is *not the
same* as the enum member itself, although it is equivalent and will compare
equal.
5. %-style formatting: ``%s`` and ``%r`` call the :class:`Enum` class's
5. A ``data type`` is a mixin that defines :meth:`__new__`, or a
:class:`~dataclasses.dataclass`
6. %-style formatting: ``%s`` and ``%r`` call the :class:`Enum` class's
:meth:`__str__` and :meth:`__repr__` respectively; other codes (such as
``%i`` or ``%h`` for IntEnum) treat the enum member as its mixed-in type.
6. :ref:`Formatted string literals <f-strings>`, :meth:`str.format`,
7. :ref:`Formatted string literals <f-strings>`, :meth:`str.format`,
and :func:`format` will use the enum's :meth:`__str__` method.

.. note::

Because :class:`IntEnum`, :class:`IntFlag`, and :class:`StrEnum` are
designed to be drop-in replacements for existing constants, their
:meth:`__str__` method has been reset to their data types
:meth:`__str__` method has been reset to their data types'
:meth:`__str__` method.

When to use :meth:`__new__` vs. :meth:`__init__`
Expand Down
6 changes: 3 additions & 3 deletions Doc/howto/isolating-extensions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ To save a some tedious error-handling boilerplate code, you can combine
these two steps with :c:func:`PyType_GetModuleState`, resulting in::

my_struct *state = (my_struct*)PyType_GetModuleState(type);
if (state === NULL) {
if (state == NULL) {
return NULL;
}

Expand Down Expand Up @@ -435,7 +435,7 @@ For example::
PyObject *kwnames)
{
my_struct *state = (my_struct*)PyType_GetModuleState(defining_class);
if (state === NULL) {
if (state == NULL) {
return NULL;
}
... // rest of logic
Expand Down Expand Up @@ -479,7 +479,7 @@ to get the state::

PyObject *module = PyType_GetModuleByDef(Py_TYPE(self), &module_def);
my_struct *state = (my_struct*)PyModule_GetState(module);
if (state === NULL) {
if (state == NULL) {
return NULL;
}

Expand Down
20 changes: 10 additions & 10 deletions Doc/howto/perf_profiling.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ information about the performance of your application.
that aid with the analysis of the data that it produces.

The main problem with using the ``perf`` profiler with Python applications is that
``perf`` only allows to get information about native symbols, this is, the names of
the functions and procedures written in C. This means that the names and file names
of the Python functions in your code will not appear in the output of the ``perf``.
``perf`` only gets information about native symbols, that is, the names of
functions and procedures written in C. This means that the names and file names
of Python functions in your code will not appear in the output of ``perf``.

Since Python 3.12, the interpreter can run in a special mode that allows Python
functions to appear in the output of the ``perf`` profiler. When this mode is
Expand All @@ -28,8 +28,8 @@ relationship between this piece of code and the associated Python function using

.. note::

Support for the ``perf`` profiler is only currently available for Linux on
selected architectures. Check the output of the configure build step or
Support for the ``perf`` profiler is currently only available for Linux on
select architectures. Check the output of the ``configure`` build step or
check the output of ``python -m sysconfig | grep HAVE_PERF_TRAMPOLINE``
to see if your system is supported.

Expand All @@ -52,11 +52,11 @@ For example, consider the following script:
if __name__ == "__main__":
baz(1000000)
We can run ``perf`` to sample CPU stack traces at 9999 Hertz::
We can run ``perf`` to sample CPU stack traces at 9999 hertz::

$ perf record -F 9999 -g -o perf.data python my_script.py

Then we can use ``perf`` report to analyze the data:
Then we can use ``perf report`` to analyze the data:

.. code-block:: shell-session
Expand Down Expand Up @@ -97,7 +97,7 @@ Then we can use ``perf`` report to analyze the data:
| | | | | |--2.97%--_PyObject_Malloc
...
As you can see here, the Python functions are not shown in the output, only ``_Py_Eval_EvalFrameDefault`` appears
As you can see, the Python functions are not shown in the output, only ``_Py_Eval_EvalFrameDefault``
(the function that evaluates the Python bytecode) shows up. Unfortunately that's not very useful because all Python
functions use the same C function to evaluate bytecode so we cannot know which Python function corresponds to which
bytecode-evaluating function.
Expand Down Expand Up @@ -151,7 +151,7 @@ Instead, if we run the same experiment with ``perf`` support enabled we get:
How to enable ``perf`` profiling support
----------------------------------------

``perf`` profiling support can either be enabled from the start using
``perf`` profiling support can be enabled either from the start using
the environment variable :envvar:`PYTHONPERFSUPPORT` or the
:option:`-X perf <-X>` option,
or dynamically using :func:`sys.activate_stack_trampoline` and
Expand Down Expand Up @@ -192,7 +192,7 @@ Example, using the :mod:`sys` APIs in file :file:`example.py`:
How to obtain the best results
------------------------------

For the best results, Python should be compiled with
For best results, Python should be compiled with
``CFLAGS="-fno-omit-frame-pointer -mno-omit-leaf-frame-pointer"`` as this allows
profilers to unwind using only the frame pointer and not on DWARF debug
information. This is because as the code that is interposed to allow ``perf``
Expand Down
22 changes: 20 additions & 2 deletions Doc/library/csv.rst
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ The :mod:`csv` module defines the following constants:

Instructs :class:`writer` objects to quote all non-numeric fields.

Instructs the reader to convert all non-quoted fields to type *float*.
Instructs :class:`reader` objects to convert all non-quoted fields to type *float*.


.. data:: QUOTE_NONE
Expand All @@ -337,7 +337,25 @@ The :mod:`csv` module defines the following constants:
character. If *escapechar* is not set, the writer will raise :exc:`Error` if
any characters that require escaping are encountered.

Instructs :class:`reader` to perform no special processing of quote characters.
Instructs :class:`reader` objects to perform no special processing of quote characters.

.. data:: QUOTE_NOTNULL

Instructs :class:`writer` objects to quote all fields which are not
``None``. This is similar to :data:`QUOTE_ALL`, except that if a
field value is ``None`` an empty (unquoted) string is written.

Instructs :class:`reader` objects to interpret an empty (unquoted) field as None and
to otherwise behave as :data:`QUOTE_ALL`.

.. data:: QUOTE_STRINGS

Instructs :class:`writer` objects to always place quotes around fields
which are strings. This is similar to :data:`QUOTE_NONNUMERIC`, except that if a
field value is ``None`` an empty (unquoted) string is written.

Instructs :class:`reader` objects to interpret an empty (unquoted) string as ``None`` and
to otherwise behave as :data:`QUOTE_NONNUMERIC`.

The :mod:`csv` module defines the following exception:

Expand Down
5 changes: 3 additions & 2 deletions Doc/library/enum.rst
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,8 @@ Data Types

.. attribute:: STRICT

Out-of-range values cause a :exc:`ValueError` to be raised::
Out-of-range values cause a :exc:`ValueError` to be raised. This is the
default for :class:`Flag`::

>>> from enum import Flag, STRICT, auto
>>> class StrictFlag(Flag, boundary=STRICT):
Expand All @@ -714,7 +715,7 @@ Data Types
.. attribute:: CONFORM

Out-of-range values have invalid values removed, leaving a valid *Flag*
value. This is the default for :class:`Flag`::
value::

>>> from enum import Flag, CONFORM, auto
>>> class ConformFlag(Flag, boundary=CONFORM):
Expand Down
9 changes: 8 additions & 1 deletion Doc/library/logging.config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ otherwise, the context is used to determine what to instantiate.
* ``datefmt``
* ``style``
* ``validate`` (since version >=3.8)
* ``defaults`` (since version >=3.12)

An optional ``class`` key indicates the name of the formatter's
class (as a dotted module and class name). The instantiation
Expand Down Expand Up @@ -953,16 +954,22 @@ Sections which specify formatter configuration are typified by the following.
.. code-block:: ini
[formatter_form01]
format=F1 %(asctime)s %(levelname)s %(message)s
format=F1 %(asctime)s %(levelname)s %(message)s %(customfield)s
datefmt=
style=%
validate=True
defaults={'customfield': 'defaultvalue'}
class=logging.Formatter
The arguments for the formatter configuration are the same as the keys
in the dictionary schema :ref:`formatters section
<logging-config-dictschema-formatters>`.

The ``defaults`` entry, when :ref:`evaluated <func-eval>` in the context of
the ``logging`` package's namespace, is a dictionary of default values for
custom formatting fields. If not provided, it defaults to ``None``.


.. note::

Due to the use of :func:`eval` as described above, there are
Expand Down
Loading

0 comments on commit 61991ef

Please sign in to comment.