Skip to content

Commit

Permalink
Merge branch 'main' into namespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
noamcohen97 authored Oct 14, 2022
2 parents b14396e + 2fe44f7 commit 50c4809
Show file tree
Hide file tree
Showing 119 changed files with 1,307 additions and 2,956 deletions.
2 changes: 1 addition & 1 deletion .azure-pipelines/posix-steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ steps:
- ${{ if eq(parameters.patchcheck, 'true') }}:
- script: |
git fetch origin
./python Tools/scripts/patchcheck.py --ci true
./python Tools/patchcheck/patchcheck.py --ci true
displayName: 'Run patchcheck.py'
condition: and(succeeded(), eq(variables['Build.Reason'], 'PullRequest'))
Expand Down
3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
# It uses the same pattern rule for gitignore file
# https://git-scm.com/docs/gitignore#_pattern_format

# GitHub
.github/** @ezio-melotti

# asyncio
**/*asyncio* @1st1 @asvetlov @gvanrossum

Expand Down
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ also suggestions on how you can most effectively help the project.

Please be aware that our workflow does deviate slightly from the typical GitHub
project. Details on how to properly submit a pull request are covered in
`Lifecycle of a Pull Request <https://devguide.python.org/pullrequest/>`_.
`Lifecycle of a Pull Request <https://devguide.python.org/getting-started/pull-request-lifecycle.html>`_.
We utilize various bots and status checks to help with this, so do follow the
comments they leave and their "Details" links, respectively. The key points of
our workflow that are not covered by a bot or status check are:
Expand Down
12 changes: 8 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ on:
permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
check_source:
name: 'Check for source changes'
Expand Down Expand Up @@ -69,7 +73,7 @@ jobs:
- name: Add ccache to PATH
run: echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
- name: Configure ccache action
uses: hendrikmuhs/ccache-action@v1
uses: hendrikmuhs/ccache-action@v1.2
- name: Check Autoconf version 2.69 and aclocal 1.16.3
run: |
grep "Generated by GNU Autoconf 2.69" configure
Expand Down Expand Up @@ -198,7 +202,7 @@ jobs:
run: |
echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
- name: Configure ccache action
uses: hendrikmuhs/ccache-action@v1
uses: hendrikmuhs/ccache-action@v1.2
- name: Setup directory envs for out-of-tree builds
run: |
echo "CPYTHON_RO_SRCDIR=$(realpath -m ${GITHUB_WORKSPACE}/../cpython-ro-srcdir)" >> $GITHUB_ENV
Expand Down Expand Up @@ -261,7 +265,7 @@ jobs:
run: |
echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
- name: Configure ccache action
uses: hendrikmuhs/ccache-action@v1
uses: hendrikmuhs/ccache-action@v1.2
- name: Configure CPython
run: ./configure --with-pydebug --with-openssl=$OPENSSL_DIR
- name: Build CPython
Expand Down Expand Up @@ -305,7 +309,7 @@ jobs:
run: |
echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
- name: Configure ccache action
uses: hendrikmuhs/ccache-action@v1
uses: hendrikmuhs/ccache-action@v1.2
- name: Configure CPython
run: ./configure --with-address-sanitizer --without-pymalloc
- name: Build CPython
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/build_msi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ on:
permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
build:
name: Windows Installer
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ on:
permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
build_doc:
name: 'Docs'
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/project-updater.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
- opened
- labeled

permissions:
contents: read

jobs:
add-to-project:
name: Add issues to projects
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/verify-ensurepip-wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ on:
permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
verify:
runs-on: ubuntu-latest
Expand Down
19 changes: 3 additions & 16 deletions Doc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ PAPEROPT_letter = -D latex_elements.papersize=letterpaper
ALLSPHINXOPTS = -b $(BUILDER) -d build/doctrees $(PAPEROPT_$(PAPER)) -j auto \
$(SPHINXOPTS) $(SPHINXERRORHANDLING) . build/$(BUILDER) $(SOURCES)

.PHONY: help build html htmlhelp latex text texinfo changes linkcheck \
suspicious coverage doctest pydoc-topics htmlview clean dist check serve \
autobuild-dev autobuild-stable venv
.PHONY: help build html htmlhelp latex text texinfo epub changes linkcheck \
coverage doctest pydoc-topics htmlview clean clean-venv venv dist check serve \
autobuild-dev autobuild-dev-html autobuild-stable autobuild-stable-html

help:
@echo "Please use \`make <target>' where <target> is one of"
Expand All @@ -42,7 +42,6 @@ help:
@echo " doctest to run doctests in the documentation"
@echo " pydoc-topics to regenerate the pydoc topics file"
@echo " dist to create a \"dist\" directory with archived docs for download"
@echo " suspicious to check for suspicious markup in output text"
@echo " check to run a check for frequent markup errors"

build:
Expand Down Expand Up @@ -110,18 +109,6 @@ linkcheck:
"or in build/$(BUILDER)/output.txt"; \
false; }

suspicious: BUILDER = suspicious
suspicious:
@$(MAKE) build BUILDER=$(BUILDER) || { \
echo "Suspicious check complete; look for any errors in the above output" \
"or in build/$(BUILDER)/suspicious.csv. If all issues are false" \
"positives, append that file to tools/susp-ignored.csv."; \
false; }
@echo "⚠ make suspicious is deprecated and will be removed soon."
@echo "⚠ Use:"
@echo "⚠ make check"
@echo "⚠ instead."

coverage: BUILDER = coverage
coverage: build
@echo "Coverage finished; see c.txt and python.txt in build/coverage"
Expand Down
3 changes: 0 additions & 3 deletions Doc/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,6 @@ Available make targets are:
plain text documentation for the labels defined in
``tools/pyspecific.py`` -- pydoc needs these to show topic and keyword help.

* "suspicious", which checks the parsed markup for text that looks like
malformed and thus unconverted reST.

* "check", which checks for frequent markup errors.

* "serve", which serves the build/html directory on port 8000.
Expand Down
2 changes: 1 addition & 1 deletion Doc/c-api/buffer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ a buffer, see :c:func:`PyObject_GetBuffer`.
For :term:`contiguous` arrays, the value points to the beginning of
the memory block.

.. c:member:: void *obj
.. c:member:: PyObject *obj
A new reference to the exporting object. The reference is owned by
the consumer and automatically decremented and set to ``NULL`` by
Expand Down
21 changes: 20 additions & 1 deletion Doc/c-api/dict.rst
Original file line number Diff line number Diff line change
Expand Up @@ -246,24 +246,41 @@ Dictionary Objects
of error (e.g. no more watcher IDs available), return ``-1`` and set an
exception.
.. versionadded:: 3.12
.. c:function:: int PyDict_ClearWatcher(int watcher_id)
Clear watcher identified by *watcher_id* previously returned from
:c:func:`PyDict_AddWatcher`. Return ``0`` on success, ``-1`` on error (e.g.
if the given *watcher_id* was never registered.)
.. versionadded:: 3.12
.. c:function:: int PyDict_Watch(int watcher_id, PyObject *dict)
Mark dictionary *dict* as watched. The callback granted *watcher_id* by
:c:func:`PyDict_AddWatcher` will be called when *dict* is modified or
deallocated.
deallocated. Return ``0`` on success or ``-1`` on error.
.. versionadded:: 3.12
.. c:function:: int PyDict_Unwatch(int watcher_id, PyObject *dict)
Mark dictionary *dict* as no longer watched. The callback granted
*watcher_id* by :c:func:`PyDict_AddWatcher` will no longer be called when
*dict* is modified or deallocated. The dict must previously have been
watched by this watcher. Return ``0`` on success or ``-1`` on error.
.. versionadded:: 3.12
.. c:type:: PyDict_WatchEvent
Enumeration of possible dictionary watcher events: ``PyDict_EVENT_ADDED``,
``PyDict_EVENT_MODIFIED``, ``PyDict_EVENT_DELETED``, ``PyDict_EVENT_CLONED``,
``PyDict_EVENT_CLEARED``, or ``PyDict_EVENT_DEALLOCATED``.
.. versionadded:: 3.12
.. c:type:: int (*PyDict_WatchCallback)(PyDict_WatchEvent event, PyObject *dict, PyObject *key, PyObject *new_value)
Type of a dict watcher callback function.
Expand All @@ -289,3 +306,5 @@ Dictionary Objects
If the callback returns with an exception set, it must return ``-1``; this
exception will be printed as an unraisable exception using
:c:func:`PyErr_WriteUnraisable`. Otherwise it should return ``0``.
.. versionadded:: 3.12
2 changes: 1 addition & 1 deletion Doc/c-api/memoryview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ any other object.
*mview* **must** be a memoryview instance; this macro doesn't check its type,
you must do it yourself or you will risk crashes.
.. c:function:: Py_buffer *PyMemoryView_GET_BASE(PyObject *mview)
.. c:function:: PyObject *PyMemoryView_GET_BASE(PyObject *mview)
Return either a pointer to the exporting object that the memoryview is based
on or ``NULL`` if the memoryview has been created by one of the functions
Expand Down
30 changes: 18 additions & 12 deletions Doc/faq/general.rst
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,15 @@ find packages of interest to you.
How does the Python version numbering scheme work?
--------------------------------------------------

Python versions are numbered A.B.C or A.B. A is the major version number -- it
is only incremented for really major changes in the language. B is the minor
version number, incremented for less earth-shattering changes. C is the
micro-level -- it is incremented for each bugfix release. See :pep:`6` for more
information about bugfix releases.
Python versions are numbered "A.B.C" or "A.B":

* *A* is the major version number -- it is only incremented for really major
changes in the language.
* *B* is the minor version number -- it is incremented for less earth-shattering
changes.
* *C* is the micro version number -- it is incremented for each bugfix release.

See :pep:`6` for more information about bugfix releases.

Not all releases are bugfix releases. In the run-up to a new major release, a
series of development releases are made, denoted as alpha, beta, or release
Expand All @@ -139,12 +143,14 @@ Betas are more stable, preserving existing interfaces but possibly adding new
modules, and release candidates are frozen, making no changes except as needed
to fix critical bugs.

Alpha, beta and release candidate versions have an additional suffix. The
suffix for an alpha version is "aN" for some small number N, the suffix for a
beta version is "bN" for some small number N, and the suffix for a release
candidate version is "rcN" for some small number N. In other words, all versions
labeled 2.0aN precede the versions labeled 2.0bN, which precede versions labeled
2.0rcN, and *those* precede 2.0.
Alpha, beta and release candidate versions have an additional suffix:

* The suffix for an alpha version is "aN" for some small number *N*.
* The suffix for a beta version is "bN" for some small number *N*.
* The suffix for a release candidate version is "rcN" for some small number *N*.

In other words, all versions labeled *2.0aN* precede the versions labeled
*2.0bN*, which precede versions labeled *2.0rcN*, and *those* precede 2.0.

You may also find version numbers with a "+" suffix, e.g. "2.2+". These are
unreleased versions, built directly from the CPython development repository. In
Expand Down Expand Up @@ -429,7 +435,7 @@ With the interpreter, documentation is never far from the student as they are
programming.

There are also good IDEs for Python. IDLE is a cross-platform IDE for Python
that is written in Python using Tkinter. PythonWin is a Windows-specific IDE.
that is written in Python using Tkinter.
Emacs users will be happy to know that there is a very good Python mode for
Emacs. All of these programming environments provide syntax highlighting,
auto-indenting, and access to the interactive interpreter while coding. Consult
Expand Down
10 changes: 10 additions & 0 deletions Doc/glossary.rst
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,16 @@ Glossary
A list of bytecode instructions can be found in the documentation for
:ref:`the dis module <bytecodes>`.

callable
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, ...)

A :term:`function`, and by extension a :term:`method`, is a callable.
An instance of a class that implements the :meth:`~object.__call__`
method is also a callable.

callback
A subroutine function which is passed as an argument to be executed at
some point in the future.
Expand Down
14 changes: 8 additions & 6 deletions Doc/howto/descriptor.rst
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,7 @@ afterwards, :meth:`__set_name__` will need to be called manually.
ORM example
-----------

The following code is simplified skeleton showing how data descriptors could
The following code is a simplified skeleton showing how data descriptors could
be used to implement an `object relational mapping
<https://en.wikipedia.org/wiki/Object%E2%80%93relational_mapping>`_.

Expand Down Expand Up @@ -1535,6 +1535,8 @@ by member descriptors:
def __get__(self, obj, objtype=None):
'Emulate member_get() in Objects/descrobject.c'
# Also see PyMember_GetOne() in Python/structmember.c
if obj is None:
return self
value = obj._slotvalues[self.offset]
if value is null:
raise AttributeError(self.name)
Expand Down Expand Up @@ -1563,13 +1565,13 @@ variables:
class Type(type):
'Simulate how the type metaclass adds member objects for slots'

def __new__(mcls, clsname, bases, mapping):
def __new__(mcls, clsname, bases, mapping, **kwargs):
'Emulate type_new() in Objects/typeobject.c'
# type_new() calls PyTypeReady() which calls add_methods()
slot_names = mapping.get('slot_names', [])
for offset, name in enumerate(slot_names):
mapping[name] = Member(name, clsname, offset)
return type.__new__(mcls, clsname, bases, mapping)
return type.__new__(mcls, clsname, bases, mapping, **kwargs)
The :meth:`object.__new__` method takes care of creating instances that have
slots instead of an instance dictionary. Here is a rough simulation in pure
Expand All @@ -1580,7 +1582,7 @@ Python:
class Object:
'Simulate how object.__new__() allocates memory for __slots__'

def __new__(cls, *args):
def __new__(cls, *args, **kwargs):
'Emulate object_new() in Objects/typeobject.c'
inst = super().__new__(cls)
if hasattr(cls, 'slot_names'):
Expand All @@ -1593,7 +1595,7 @@ Python:
cls = type(self)
if hasattr(cls, 'slot_names') and name not in cls.slot_names:
raise AttributeError(
f'{type(self).__name__!r} object has no attribute {name!r}'
f'{cls.__name__!r} object has no attribute {name!r}'
)
super().__setattr__(name, value)

Expand All @@ -1602,7 +1604,7 @@ Python:
cls = type(self)
if hasattr(cls, 'slot_names') and name not in cls.slot_names:
raise AttributeError(
f'{type(self).__name__!r} object has no attribute {name!r}'
f'{cls.__name__!r} object has no attribute {name!r}'
)
super().__delattr__(name)

Expand Down
2 changes: 2 additions & 0 deletions Doc/howto/logging-cookbook.rst
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,8 @@ configuration::
print('complete')


.. _blocking-handlers:

Dealing with handlers that block
--------------------------------

Expand Down
3 changes: 2 additions & 1 deletion Doc/library/asyncio-dev.rst
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ adjusted::


Network logging can block the event loop. It is recommended to use
a separate thread for handling logs or use non-blocking IO.
a separate thread for handling logs or use non-blocking IO. For example,
see :ref:`blocking-handlers`.


.. _asyncio-coroutine-not-scheduled:
Expand Down
Loading

0 comments on commit 50c4809

Please sign in to comment.