Skip to content

Commit

Permalink
Merge branch 'main' into pythongh-100479-add-makepath
Browse files Browse the repository at this point in the history
  • Loading branch information
barneygale committed Apr 9, 2023
2 parents 595b8ae + 2c673d5 commit dcfe70a
Show file tree
Hide file tree
Showing 222 changed files with 4,695 additions and 2,779 deletions.
6 changes: 6 additions & 0 deletions .devcontainer/devcontainer.json
Expand Up @@ -37,10 +37,16 @@
// "ms-python.python"
],
"settings": {
"C_Cpp.default.compilerPath": "/usr/bin/clang",
"C_Cpp.default.cStandard": "c11",
"C_Cpp.default.defines": [
"CONFIG_64",
"Py_BUILD_CORE"
],
"C_Cpp.default.includePath": [
"${workspaceFolder}/*",
"${workspaceFolder}/Include/**"
],
// https://github.com/microsoft/vscode-cpptools/issues/10732
"C_Cpp.errorSquiggles": "disabled",
"editor.insertSpaces": true,
Expand Down
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
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
17 changes: 17 additions & 0 deletions .github/workflows/require-pr-label.yml
@@ -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
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: 2 additions & 2 deletions Doc/extending/newtypes_tutorial.rst
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
13 changes: 9 additions & 4 deletions Doc/howto/enum.rst
Expand Up @@ -284,6 +284,7 @@ The values are chosen by :func:`_generate_next_value_`, which can be
overridden::

>>> class AutoName(Enum):
... @staticmethod
... def _generate_next_value_(name, start, count, last_values):
... return name
...
Expand Down Expand Up @@ -372,6 +373,11 @@ below)::
>>> Color.BLUE == 2
False

.. warning::

It is possible to reload modules -- if a reloaded module contains
enums, they will be recreated, and the new members may not
compare identical/equal to the original members.

Allowed members and attributes of enumerations
----------------------------------------------
Expand Down Expand Up @@ -982,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
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
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
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
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
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
2 changes: 1 addition & 1 deletion Doc/library/ctypes.rst
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
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
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

0 comments on commit dcfe70a

Please sign in to comment.