Skip to content

Commit

Permalink
Merge branch 'main' into pythongh-102978
Browse files Browse the repository at this point in the history
  • Loading branch information
cjw296 authored Apr 13, 2023
2 parents af8397a + 19d2639 commit 1ec730f
Show file tree
Hide file tree
Showing 209 changed files with 10,759 additions and 6,590 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
8 changes: 2 additions & 6 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# https://git-scm.com/docs/gitignore#_pattern_format

# GitHub
.github/** @ezio-melotti
.github/** @ezio-melotti @hugovk

# Build system
configure* @erlend-aasland @corona10
Expand Down 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
17 changes: 17 additions & 0 deletions .github/workflows/require-pr-label.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Check labels

on:
pull_request:
types: [opened, reopened, labeled, unlabeled, synchronize]

jobs:
label:
name: DO-NOT-MERGE
runs-on: ubuntu-latest

steps:
- uses: mheap/github-action-required-labels@v4
with:
mode: exactly
count: 0
labels: "DO-NOT-MERGE"
2 changes: 1 addition & 1 deletion .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:

steps:
- name: "Check PRs"
uses: actions/stale@v7
uses: actions/stale@v8
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-pr-message: 'This PR is stale because it has been open for 30 days with no activity.'
Expand Down
4 changes: 3 additions & 1 deletion Doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,10 @@
# Minimum version of sphinx required
needs_sphinx = '3.2'

# Ignore any .rst files in the includes/ directory;
# they're embedded in pages but not rendered individually.
# Ignore any .rst files in the venv/ directory.
exclude_patterns = ['venv/*', 'README.rst']
exclude_patterns = ['includes/*.rst', 'venv/*', 'README.rst']
venvdir = os.getenv('VENVDIR')
if venvdir is not None:
exclude_patterns.append(venvdir + '/*')
Expand Down
4 changes: 2 additions & 2 deletions Doc/extending/newtypes_tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ standard Python floats::
The second bit is the definition of the type object. ::

static PyTypeObject CustomType = {
PyVarObject_HEAD_INIT(NULL, 0)
.ob_base = PyVarObject_HEAD_INIT(NULL, 0)
.tp_name = "custom.Custom",
.tp_doc = PyDoc_STR("Custom objects"),
.tp_basicsize = sizeof(CustomObject),
Expand All @@ -109,7 +109,7 @@ common practice to not specify them explicitly unless you need them.

We're going to pick it apart, one field at a time::

PyVarObject_HEAD_INIT(NULL, 0)
.ob_base = PyVarObject_HEAD_INIT(NULL, 0)

This line is mandatory boilerplate to initialize the ``ob_base``
field mentioned above. ::
Expand Down
2 changes: 1 addition & 1 deletion Doc/glossary.rst
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ Glossary
A callable is an object that can be called, possibly with a set
of arguments (see :term:`argument`), with the following syntax::

callable(argument1, argument2, ...)
callable(argument1, argument2, argumentN)

A :term:`function`, and by extension a :term:`method`, is a callable.
An instance of a class that implements the :meth:`~object.__call__`
Expand Down
7 changes: 3 additions & 4 deletions Doc/howto/enum.rst
Original file line number Diff line number Diff line change
Expand Up @@ -988,12 +988,11 @@ but remain normal attributes.
""""""""""""""""""""

Enum members are instances of their enum class, and are normally accessed as
``EnumClass.member``. In Python versions starting with ``3.5`` you could access
members from other members -- this practice is discouraged, is deprecated
in ``3.12``, and will be removed in ``3.14``.
``EnumClass.member``. In certain situations, such as writing custom enum
behavior, being able to access one member directly from another is useful,
and is supported.

.. versionchanged:: 3.5
.. versionchanged:: 3.12


Creating members that are mixed with other data types
Expand Down
4 changes: 2 additions & 2 deletions Doc/includes/custom.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ typedef struct {
} CustomObject;

static PyTypeObject CustomType = {
PyVarObject_HEAD_INIT(NULL, 0)
.ob_base = PyVarObject_HEAD_INIT(NULL, 0)
.tp_name = "custom.Custom",
.tp_doc = PyDoc_STR("Custom objects"),
.tp_basicsize = sizeof(CustomObject),
Expand All @@ -17,7 +17,7 @@ static PyTypeObject CustomType = {
};

static PyModuleDef custommodule = {
PyModuleDef_HEAD_INIT,
.m_base = PyModuleDef_HEAD_INIT,
.m_name = "custom",
.m_doc = "Example module that creates an extension type.",
.m_size = -1,
Expand Down
4 changes: 2 additions & 2 deletions Doc/includes/custom2.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ static PyMethodDef Custom_methods[] = {
};

static PyTypeObject CustomType = {
PyVarObject_HEAD_INIT(NULL, 0)
.ob_base = PyVarObject_HEAD_INIT(NULL, 0)
.tp_name = "custom2.Custom",
.tp_doc = PyDoc_STR("Custom objects"),
.tp_basicsize = sizeof(CustomObject),
Expand All @@ -104,7 +104,7 @@ static PyTypeObject CustomType = {
};

static PyModuleDef custommodule = {
PyModuleDef_HEAD_INIT,
.m_base =PyModuleDef_HEAD_INIT,
.m_name = "custom2",
.m_doc = "Example module that creates an extension type.",
.m_size = -1,
Expand Down
4 changes: 2 additions & 2 deletions Doc/includes/custom3.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ static PyMethodDef Custom_methods[] = {
};

static PyTypeObject CustomType = {
PyVarObject_HEAD_INIT(NULL, 0)
.ob_base = PyVarObject_HEAD_INIT(NULL, 0)
.tp_name = "custom3.Custom",
.tp_doc = PyDoc_STR("Custom objects"),
.tp_basicsize = sizeof(CustomObject),
Expand All @@ -145,7 +145,7 @@ static PyTypeObject CustomType = {
};

static PyModuleDef custommodule = {
PyModuleDef_HEAD_INIT,
.m_base = PyModuleDef_HEAD_INIT,
.m_name = "custom3",
.m_doc = "Example module that creates an extension type.",
.m_size = -1,
Expand Down
4 changes: 2 additions & 2 deletions Doc/includes/custom4.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ static PyMethodDef Custom_methods[] = {
};

static PyTypeObject CustomType = {
PyVarObject_HEAD_INIT(NULL, 0)
.ob_base = PyVarObject_HEAD_INIT(NULL, 0)
.tp_name = "custom4.Custom",
.tp_doc = PyDoc_STR("Custom objects"),
.tp_basicsize = sizeof(CustomObject),
Expand All @@ -163,7 +163,7 @@ static PyTypeObject CustomType = {
};

static PyModuleDef custommodule = {
PyModuleDef_HEAD_INIT,
.m_base = PyModuleDef_HEAD_INIT,
.m_name = "custom4",
.m_doc = "Example module that creates an extension type.",
.m_size = -1,
Expand Down
8 changes: 4 additions & 4 deletions Doc/library/bisect.rst
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,10 @@ records in a table::
>>> Movie = namedtuple('Movie', ('name', 'released', 'director'))

>>> movies = [
... Movie('Jaws', 1975, 'Speilberg'),
... Movie('Jaws', 1975, 'Spielberg'),
... Movie('Titanic', 1997, 'Cameron'),
... Movie('The Birds', 1963, 'Hitchcock'),
... Movie('Aliens', 1986, 'Scott')
... Movie('Aliens', 1986, 'Cameron')
... ]

>>> # Find the first movie released after 1960
Expand All @@ -228,8 +228,8 @@ records in a table::
>>> pprint(movies)
[Movie(name='The Birds', released=1963, director='Hitchcock'),
Movie(name='Love Story', released=1970, director='Hiller'),
Movie(name='Jaws', released=1975, director='Speilberg'),
Movie(name='Aliens', released=1986, director='Scott'),
Movie(name='Jaws', released=1975, director='Spielberg'),
Movie(name='Aliens', released=1986, director='Cameron'),
Movie(name='Titanic', released=1997, director='Cameron')]

If the key function is expensive, it is possible to avoid repeated function
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
2 changes: 1 addition & 1 deletion Doc/library/ctypes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ regular, non-variadic, function arguments:
libc.printf.argtypes = [ctypes.c_char_p]
Because specifying the attribute does inhibit portability it is advised to always
Because specifying the attribute does not inhibit portability it is advised to always
specify ``argtypes`` for all variadic functions.


Expand Down
47 changes: 26 additions & 21 deletions Doc/library/datetime.rst
Original file line number Diff line number Diff line change
Expand Up @@ -737,18 +737,16 @@ Instance methods:
.. method:: date.strftime(format)

Return a string representing the date, controlled by an explicit format string.
Format codes referring to hours, minutes or seconds will see 0 values. For a
complete list of formatting directives, see
:ref:`strftime-strptime-behavior`.
Format codes referring to hours, minutes or seconds will see 0 values.
See also :ref:`strftime-strptime-behavior` and :meth:`date.isoformat`.


.. method:: date.__format__(format)

Same as :meth:`.date.strftime`. This makes it possible to specify a format
string for a :class:`.date` object in :ref:`formatted string
literals <f-strings>` and when using :meth:`str.format`. For a
complete list of formatting directives, see
:ref:`strftime-strptime-behavior`.
literals <f-strings>` and when using :meth:`str.format`.
See also :ref:`strftime-strptime-behavior` and :meth:`date.isoformat`.

Examples of Usage: :class:`date`
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down Expand Up @@ -1051,8 +1049,8 @@ Other constructors, all class methods:

:exc:`ValueError` is raised if the date_string and format
can't be parsed by :func:`time.strptime` or if it returns a value which isn't a
time tuple. For a complete list of formatting directives, see
:ref:`strftime-strptime-behavior`.
time tuple. See also :ref:`strftime-strptime-behavior` and
:meth:`datetime.fromisoformat`.



Expand Down Expand Up @@ -1510,20 +1508,21 @@ Instance methods:
(which :func:`time.ctime` invokes, but which
:meth:`datetime.ctime` does not invoke) conforms to the C standard.


.. method:: datetime.strftime(format)

Return a string representing the date and time, controlled by an explicit format
string. For a complete list of formatting directives, see
:ref:`strftime-strptime-behavior`.
Return a string representing the date and time,
controlled by an explicit format string.
See also :ref:`strftime-strptime-behavior` and :meth:`datetime.isoformat`.


.. method:: datetime.__format__(format)

Same as :meth:`.datetime.strftime`. This makes it possible to specify a format
string for a :class:`.datetime` object in :ref:`formatted string
literals <f-strings>` and when using :meth:`str.format`. For a
complete list of formatting directives, see
:ref:`strftime-strptime-behavior`.
literals <f-strings>` and when using :meth:`str.format`.
See also :ref:`strftime-strptime-behavior` and :meth:`datetime.isoformat`.


Examples of Usage: :class:`.datetime`
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down Expand Up @@ -1868,17 +1867,15 @@ Instance methods:
.. method:: time.strftime(format)

Return a string representing the time, controlled by an explicit format
string. For a complete list of formatting directives, see
:ref:`strftime-strptime-behavior`.
string. See also :ref:`strftime-strptime-behavior` and :meth:`time.isoformat`.


.. method:: time.__format__(format)

Same as :meth:`.time.strftime`. This makes it possible to specify a format string
for a :class:`.time` object in :ref:`formatted string
literals <f-strings>` and when using :meth:`str.format`. For a
complete list of formatting directives, see
:ref:`strftime-strptime-behavior`.
Same as :meth:`.time.strftime`. This makes it possible to specify
a format string for a :class:`.time` object in :ref:`formatted string
literals <f-strings>` and when using :meth:`str.format`.
See also :ref:`strftime-strptime-behavior` and :meth:`time.isoformat`.


.. method:: time.utcoffset()
Expand Down Expand Up @@ -2320,6 +2317,14 @@ versus :meth:`strptime`:
:meth:`strftime` and :meth:`strptime` Format Codes
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

These methods accept format codes that can be used to parse and format dates::

>>> datetime.strptime('31/01/22 23:59:59.999999',
... '%d/%m/%y %H:%M:%S.%f')
datetime.datetime(2022, 1, 31, 23, 59, 59, 999999)
>>> _.strftime('%a %d %b %Y, %I:%M%p')
'Mon 31 Jan 2022, 11:59PM'

The following is a list of all the format codes that the 1989 C standard
requires, and these work on all platforms with a standard C implementation.

Expand Down
2 changes: 1 addition & 1 deletion Doc/library/dis.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ the following command can be used to display the disassembly of
3 2 LOAD_GLOBAL 1 (NULL + len)
12 LOAD_FAST 0 (alist)
14 CALL 1
24 RETURN_VALUE
22 RETURN_VALUE

(The "2" is a line number).

Expand Down
7 changes: 4 additions & 3 deletions Doc/library/functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1444,8 +1444,9 @@ are always available. They are listed here in alphabetical order.
arguments are converted to text strings, :func:`print` cannot be used with
binary mode file objects. For these, use ``file.write(...)`` instead.

Whether the output is buffered is usually determined by *file*, but if the
*flush* keyword argument is true, the stream is forcibly flushed.
Output buffering is usually determined by *file*.
However, if *flush* is true, the stream is forcibly flushed.


.. versionchanged:: 3.3
Added the *flush* keyword argument.
Expand Down Expand Up @@ -1680,7 +1681,7 @@ are always available. They are listed here in alphabetical order.

class C:
@staticmethod
def f(arg1, arg2, ...): ...
def f(arg1, arg2, argN): ...

The ``@staticmethod`` form is a function :term:`decorator` -- see
:ref:`function` for details.
Expand Down
Loading

0 comments on commit 1ec730f

Please sign in to comment.