Skip to content

Path migration #25082

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 39 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
9a50ef4
bpo-43569: Add test/test_importlib/namespacedata01 to TESTSUBDIRS (GH…
jaraco Mar 21, 2021
690aca7
bpo-43420: Simple optimizations for Fraction's arithmetics (GH-24779)
skirpichev Mar 22, 2021
56f031e
bpo-35134: Add include/cpython/compile.h (GH-24922)
shihai1991 Mar 22, 2021
88d9983
bpo-43551: Fix PyImport_Import() for subinterpreters (GH-24929)
Mar 22, 2021
86883d4
bpo-43575: Use PEP 590 vectorcall to speed up map() (GH-24955)
corona10 Mar 22, 2021
39f6436
Revert "bpo-40521: Make dtoa bigint free list per-interpreter (GH-248…
vstinner Mar 22, 2021
123ff26
bpo-43591: Fix error location in interactive mode for errors at the e…
pablogsal Mar 22, 2021
96eeff5
bpo-43555: Report the column offset for invalid line continuation cha…
pablogsal Mar 22, 2021
532e063
bpo-41718: regrtest saved_test_environment avoids imports (GH-24934)
vstinner Mar 22, 2021
10417dd
bpo-41718: Reduce libregrtest runtest imports (GH-24980)
vstinner Mar 22, 2021
0473fb2
bpo-41718: libregrtest runtest avoids import_helper (GH-24983)
vstinner Mar 23, 2021
30793e8
bpo-41718: Disable support.testresult XML output by default (GH-24982)
vstinner Mar 23, 2021
9feae41
bpo-41718: libregrtest avoids importing datetime (GH-24985)
vstinner Mar 23, 2021
76b5d71
Clarify attribute docs on types.ModuleType (GH-24974)
brettcannon Mar 23, 2021
d72e8d4
bpo-41718: subprocess imports grp and pwd on demand (GH-24987)
vstinner Mar 23, 2021
bd9154a
bpo-41718: runpy now imports pkgutil in functions (GH-24996)
vstinner Mar 23, 2021
cd27af7
bpo-41718: Update runpy startup time What's New (GH-24998)
vstinner Mar 23, 2021
94faa07
bpo-43244: Remove ast.h, asdl.h, Python-ast.h headers (GH-24933)
vstinner Mar 23, 2021
f0a6fde
bpo-31861: Add aiter and anext to builtins (#23847)
jab Mar 23, 2021
a81fca6
bpo-43244: Add pycore_compile.h header file (GH-25000)
vstinner Mar 23, 2021
d969202
bpo-31861: Complete the C-API docs for PyObject_GetAiter and PyAiter_…
pablogsal Mar 23, 2021
a054f6b
bpo-43452: Document the PyType_Lookup optimizations in the What's New…
pablogsal Mar 24, 2021
57364ce
bpo-43244: Remove parser_interface.h header file (GH-25001)
vstinner Mar 24, 2021
919d42d
bpo-31861: Fix possible crash in PyAnextAwaitable_New (GH-25005)
pablogsal Mar 24, 2021
8370e07
bpo-43244: Remove the pyarena.h header (GH-25007)
vstinner Mar 24, 2021
a02683a
bpo-31861: Fix reference leak in builtin_anext_impl() (GH-25008)
pablogsal Mar 24, 2021
3ba3d51
bpo-42914: add a pprint underscore_numbers option (GH-24864)
sblondon Mar 24, 2021
9cb31d6
bpo-42137: have ModuleType.__repr__ prefer __spec__ over module_repr(…
brettcannon Mar 24, 2021
232f4cb
Fix typo in fuzzer.c (GH-25013)
eltociear Mar 24, 2021
4958f5d
Only check evalbreaker after calls and on backwards egdes. Makes sure…
markshannon Mar 24, 2021
8efad61
bpo-41064: Improve syntax error for invalid usage of '**' in f-string…
pablogsal Mar 24, 2021
7278959
bpo-43198: Revert 3dd2157 that removed freeslot tracking. (#25010)
rhettinger Mar 24, 2021
df9ade9
AC: Update unsupported_special_methods (GH-24956)
corona10 Mar 25, 2021
b045cda
Doc: io: Remove "In-memory streams" section (GH-24927)
methane Mar 25, 2021
a7885e1
Create python-publish.yml
kaocher82 Mar 26, 2021
0669995
Update morning
kaocher82 Mar 29, 2021
9b646f7
'Refactored by Sourcery'
Mar 29, 2021
c054a00
Merge pull request #5 from kaocher82/sourcery/kaocher82-patch-dir
kaocher82 Mar 29, 2021
1d49545
Merge pull request #4 from kaocher82/kaocher82-patch-dir
kaocher82 Mar 29, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ 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
Include/Python-ast.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
Python/opcode_targets.h linguist-generated=true
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

name: Upload Python Package

on:
release:
types: [created]

jobs:
deploy:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
6 changes: 6 additions & 0 deletions Doc/c-api/iter.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ There are two functions specifically for working with iterators.
Return non-zero if the object *o* supports the iterator protocol, and ``0``
otherwise. This function always succeeds.

.. c:function:: int PyAiter_Check(PyObject *o)

Returns non-zero if the object 'obj' provides :class:`AsyncIterator`
protocols, and ``0`` otherwise. This function always succeeds.

.. versionadded:: 3.10

.. c:function:: PyObject* PyIter_Next(PyObject *o)

Expand Down
11 changes: 11 additions & 0 deletions Doc/c-api/object.rst
Original file line number Diff line number Diff line change
Expand Up @@ -356,3 +356,14 @@ Object Protocol
iterator for the object argument, or the object itself if the object is already
an iterator. Raises :exc:`TypeError` and returns ``NULL`` if the object cannot be
iterated.


.. c:function:: PyObject* PyObject_GetAiter(PyObject *o)

This is the equivalent to the Python expression ``aiter(o)``. Takes an
:class:`AsyncIterable` object and returns an :class:`AsyncIterator` for it.
This is typically a new iterator but if the argument is an
:class:`AsyncIterator`, this returns itself. Raises :exc:`TypeError` and
returns ``NULL`` if the object cannot be iterated.

.. versionadded:: 3.10
6 changes: 6 additions & 0 deletions Doc/data/refcounts.dat
Original file line number Diff line number Diff line change
Expand Up @@ -1073,6 +1073,9 @@ PyInterpreterState_New:PyInterpreterState*:::
PyIter_Check:int:::
PyIter_Check:PyObject*:o:0:

PyAiter_Check:int:::
PyAiter_Check:PyObject*:o:0:

PyIter_Next:PyObject*::+1:
PyIter_Next:PyObject*:o:0:

Expand Down Expand Up @@ -1679,6 +1682,9 @@ PyObject_GetItem:PyObject*:key:0:
PyObject_GetIter:PyObject*::+1:
PyObject_GetIter:PyObject*:o:0:

PyObject_GetAiter:PyObject*::+1:
PyObject_GetAiter:PyObject*:o:0:

PyObject_HasAttr:int:::
PyObject_HasAttr:PyObject*:o:0:
PyObject_HasAttr:PyObject*:attr_name:0:
Expand Down
2 changes: 2 additions & 0 deletions Doc/data/stable_abi.dat
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# File generated by 'make regen-limited-abi'
# This is NOT an authoritative list of stable ABI symbols
PyAiter_Check
PyArg_Parse
PyArg_ParseTuple
PyArg_ParseTupleAndKeywords
Expand Down Expand Up @@ -465,6 +466,7 @@ PyObject_GenericGetAttr
PyObject_GenericGetDict
PyObject_GenericSetAttr
PyObject_GenericSetDict
PyObject_GetAiter
PyObject_GetAttr
PyObject_GetAttrString
PyObject_GetItem
Expand Down
77 changes: 52 additions & 25 deletions Doc/library/functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,31 @@ are always available. They are listed here in alphabetical order.
+=========================+=======================+=======================+=========================+
| | **A** | | **E** | | **L** | | **R** |
| | :func:`abs` | | :func:`enumerate` | | :func:`len` | | |func-range|_ |
| | :func:`all` | | :func:`eval` | | |func-list|_ | | :func:`repr` |
| | :func:`any` | | :func:`exec` | | :func:`locals` | | :func:`reversed` |
| | :func:`ascii` | | | | | | :func:`round` |
| | | | **F** | | **M** | | |
| | **B** | | :func:`filter` | | :func:`map` | | **S** |
| | :func:`bin` | | :func:`float` | | :func:`max` | | |func-set|_ |
| | :func:`bool` | | :func:`format` | | |func-memoryview|_ | | :func:`setattr` |
| | :func:`breakpoint` | | |func-frozenset|_ | | :func:`min` | | :func:`slice` |
| | |func-bytearray|_ | | | | | | :func:`sorted` |
| | |func-bytes|_ | | **G** | | **N** | | :func:`staticmethod` |
| | | | :func:`getattr` | | :func:`next` | | |func-str|_ |
| | **C** | | :func:`globals` | | | | :func:`sum` |
| | :func:`callable` | | | | **O** | | :func:`super` |
| | :func:`chr` | | **H** | | :func:`object` | | |
| | :func:`classmethod` | | :func:`hasattr` | | :func:`oct` | | **T** |
| | :func:`compile` | | :func:`hash` | | :func:`open` | | |func-tuple|_ |
| | :func:`complex` | | :func:`help` | | :func:`ord` | | :func:`type` |
| | | | :func:`hex` | | | | |
| | **D** | | | | **P** | | **V** |
| | :func:`delattr` | | **I** | | :func:`pow` | | :func:`vars` |
| | |func-dict|_ | | :func:`id` | | :func:`print` | | |
| | :func:`dir` | | :func:`input` | | :func:`property` | | **Z** |
| | :func:`divmod` | | :func:`int` | | | | :func:`zip` |
| | | | :func:`isinstance` | | | | |
| | | | :func:`issubclass` | | | | **_** |
| | :func:`aiter` | | :func:`eval` | | |func-list|_ | | :func:`repr` |
| | :func:`all` | | :func:`exec` | | :func:`locals` | | :func:`reversed` |
| | :func:`any` | | | | | | :func:`round` |
| | :func:`anext` | | **F** | | **M** | | |
| | :func:`ascii` | | :func:`filter` | | :func:`map` | | **S** |
| | | | :func:`float` | | :func:`max` | | |func-set|_ |
| | **B** | | :func:`format` | | |func-memoryview|_ | | :func:`setattr` |
| | :func:`bin` | | |func-frozenset|_ | | :func:`min` | | :func:`slice` |
| | :func:`bool` | | | | | | :func:`sorted` |
| | :func:`breakpoint` | | **G** | | **N** | | :func:`staticmethod` |
| | |func-bytearray|_ | | :func:`getattr` | | :func:`next` | | |func-str|_ |
| | |func-bytes|_ | | :func:`globals` | | | | :func:`sum` |
| | | | | | **O** | | :func:`super` |
| | **C** | | **H** | | :func:`object` | | |
| | :func:`callable` | | :func:`hasattr` | | :func:`oct` | | **T** |
| | :func:`chr` | | :func:`hash` | | :func:`open` | | |func-tuple|_ |
| | :func:`classmethod` | | :func:`help` | | :func:`ord` | | :func:`type` |
| | :func:`compile` | | :func:`hex` | | | | |
| | :func:`complex` | | | | **P** | | **V** |
| | | | **I** | | :func:`pow` | | :func:`vars` |
| | **D** | | :func:`id` | | :func:`print` | | |
| | :func:`delattr` | | :func:`input` | | :func:`property` | | **Z** |
| | |func-dict|_ | | :func:`int` | | | | :func:`zip` |
| | :func:`dir` | | :func:`isinstance` | | | | |
| | :func:`divmod` | | :func:`issubclass` | | | | **_** |
| | | | :func:`iter` | | | | :func:`__import__` |
+-------------------------+-----------------------+-----------------------+-------------------------+

Expand All @@ -61,6 +61,18 @@ are always available. They are listed here in alphabetical order.
If the argument is a complex number, its magnitude is returned.


.. function:: aiter(async_iterable)

Return an :term:`asynchronous iterator` for an :term:`asynchronous iterable`.
Equivalent to calling ``x.__aiter__()``.

``aiter(x)`` itself has an ``__aiter__()`` method that returns ``x``,
so ``aiter(aiter(x))`` is the same as ``aiter(x)``.

Note: Unlike :func:`iter`, :func:`aiter` has no 2-argument variant.

.. versionadded:: 3.10

.. function:: all(iterable)

Return ``True`` if all elements of the *iterable* are true (or if the iterable
Expand All @@ -73,6 +85,21 @@ are always available. They are listed here in alphabetical order.
return True


.. awaitablefunction:: anext(async_iterator[, default])

When awaited, return the next item from the given :term:`asynchronous
iterator`, or *default* if given and the iterator is exhausted.

This is the async variant of the :func:`next` builtin, and behaves
similarly.

This calls the :meth:`~object.__anext__` method of *async_iterator*,
returning an :term:`awaitable`. Awaiting this returns the next value of the
iterator. If *default* is given, it is returned if the iterator is exhausted,
otherwise :exc:`StopAsyncIteration` is raised.

.. versionadded:: 3.10

.. function:: any(iterable)

Return ``True`` if any element of the *iterable* is true. If the iterable
Expand Down
14 changes: 7 additions & 7 deletions Doc/library/importlib.rst
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ Functions
.. versionadded:: 3.4
.. versionchanged:: 3.7
:exc:`ModuleNotFoundError` is raised when the module being reloaded lacks
a :class:`ModuleSpec`.
a :class:`~importlib.machinery.ModuleSpec`.


:mod:`importlib.abc` -- Abstract base classes related to import
Expand Down Expand Up @@ -1591,19 +1591,19 @@ an :term:`importer`.

.. function:: spec_from_loader(name, loader, *, origin=None, is_package=None)

A factory function for creating a :class:`ModuleSpec` instance based
on a loader. The parameters have the same meaning as they do for
ModuleSpec. The function uses available :term:`loader` APIs, such as
A factory function for creating a :class:`~importlib.machinery.ModuleSpec`
instance based on a loader. The parameters have the same meaning as they do
for ModuleSpec. The function uses available :term:`loader` APIs, such as
:meth:`InspectLoader.is_package`, to fill in any missing
information on the spec.

.. versionadded:: 3.4

.. function:: spec_from_file_location(name, location, *, loader=None, submodule_search_locations=None)

A factory function for creating a :class:`ModuleSpec` instance based
on the path to a file. Missing information will be filled in on the
spec by making use of loader APIs and by the implication that the
A factory function for creating a :class:`~importlib.machinery.ModuleSpec`
instance based on the path to a file. Missing information will be filled in
on the spec by making use of loader APIs and by the implication that the
module will be file-based.

.. versionadded:: 3.4
Expand Down
10 changes: 0 additions & 10 deletions Doc/library/io.rst
Original file line number Diff line number Diff line change
Expand Up @@ -155,16 +155,6 @@ High-level Module Interface
when an unsupported operation is called on a stream.


In-memory streams
^^^^^^^^^^^^^^^^^

It is also possible to use a :class:`str` or :term:`bytes-like object` as a
file for both reading and writing. For strings :class:`StringIO` can be used
like a file opened in text mode. :class:`BytesIO` can be used like a file
opened in binary mode. Both provide full read-write capabilities with random
access.


.. seealso::

:mod:`sys`
Expand Down
23 changes: 17 additions & 6 deletions Doc/library/pprint.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ The :mod:`pprint` module defines one class:
.. index:: single: ...; placeholder

.. class:: PrettyPrinter(indent=1, width=80, depth=None, stream=None, *, \
compact=False, sort_dicts=True)
compact=False, sort_dicts=True, underscore_numbers=False)

Construct a :class:`PrettyPrinter` instance. This constructor understands
several keyword parameters. An output stream may be set using the *stream*
Expand All @@ -55,14 +55,19 @@ The :mod:`pprint` module defines one class:
will be formatted on a separate line. If *compact* is true, as many items
as will fit within the *width* will be formatted on each output line. If
*sort_dicts* is true (the default), dictionaries will be formatted with their
keys sorted, otherwise they will display in insertion order.
keys sorted, otherwise they will display in insertion order. If
*underscore_numbers* is true, integers will be formatted with
```_``` character for a thousands separator, otherwise underscores are not
displayed (the default).

.. versionchanged:: 3.4
Added the *compact* parameter.

.. versionchanged:: 3.8
Added the *sort_dicts* parameter.

.. versionchanged:: 3.10
Added the *underscore_numbers* parameter.

>>> import pprint
>>> stuff = ['spam', 'eggs', 'lumberjack', 'knights', 'ni']
Expand Down Expand Up @@ -91,10 +96,10 @@ The :mod:`pprint` module defines one class:
The :mod:`pprint` module also provides several shortcut functions:

.. function:: pformat(object, indent=1, width=80, depth=None, *, \
compact=False, sort_dicts=True)
compact=False, sort_dicts=True, underscore_numbers=False)

Return the formatted representation of *object* as a string. *indent*,
*width*, *depth*, *compact* and *sort_dicts* will be passed to the
*width*, *depth*, *compact*, *sort_dicts* and *underscore_numbers* will be passed to the
:class:`PrettyPrinter` constructor as formatting parameters.

.. versionchanged:: 3.4
Expand All @@ -103,6 +108,9 @@ The :mod:`pprint` module also provides several shortcut functions:
.. versionchanged:: 3.8
Added the *sort_dicts* parameter.

.. versionchanged:: 3.10
Added the *underscore_numbers* parameter.


.. function:: pp(object, *args, sort_dicts=False, **kwargs)

Expand All @@ -116,13 +124,13 @@ The :mod:`pprint` module also provides several shortcut functions:


.. function:: pprint(object, stream=None, indent=1, width=80, depth=None, *, \
compact=False, sort_dicts=True)
compact=False, sort_dicts=True, underscore_numbers=False)

Prints the formatted representation of *object* on *stream*, followed by a
newline. If *stream* is ``None``, ``sys.stdout`` is used. This may be used
in the interactive interpreter instead of the :func:`print` function for
inspecting values (you can even reassign ``print = pprint.pprint`` for use
within a scope). *indent*, *width*, *depth*, *compact* and *sort_dicts* will
within a scope). *indent*, *width*, *depth*, *compact*, *sort_dicts* and *underscore_numbers* will
be passed to the :class:`PrettyPrinter` constructor as formatting parameters.

.. versionchanged:: 3.4
Expand All @@ -131,6 +139,9 @@ The :mod:`pprint` module also provides several shortcut functions:
.. versionchanged:: 3.8
Added the *sort_dicts* parameter.

.. versionchanged:: 3.10
Added the *underscore_numbers* parameter.

>>> import pprint
>>> stuff = ['spam', 'eggs', 'lumberjack', 'knights', 'ni']
>>> stuff.insert(0, stuff)
Expand Down
32 changes: 30 additions & 2 deletions Doc/library/types.rst
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ Standard names are defined for the following types:

.. class:: ModuleType(name, doc=None)

The type of :term:`modules <module>`. Constructor takes the name of the
The type of :term:`modules <module>`. The constructor takes the name of the
module to be created and optionally its :term:`docstring`.

.. note::
Expand All @@ -238,12 +238,23 @@ Standard names are defined for the following types:

The :term:`loader` which loaded the module. Defaults to ``None``.

This attribute is to match :attr:`importlib.machinery.ModuleSpec.loader`
as stored in the attr:`__spec__` object.

.. note::
A future version of Python may stop setting this attribute by default.
To guard against this potential change, preferrably read from the
:attr:`__spec__` attribute instead or use
``getattr(module, "__loader__", None)`` if you explicitly need to use
this attribute.

.. versionchanged:: 3.4
Defaults to ``None``. Previously the attribute was optional.

.. attribute:: __name__

The name of the module.
The name of the module. Expected to match
:attr:`importlib.machinery.ModuleSpec.name`.

.. attribute:: __package__

Expand All @@ -252,9 +263,26 @@ Standard names are defined for the following types:
to ``''``, else it should be set to the name of the package (which can be
:attr:`__name__` if the module is a package itself). Defaults to ``None``.

This attribute is to match :attr:`importlib.machinery.ModuleSpec.parent`
as stored in the attr:`__spec__` object.

.. note::
A future version of Python may stop setting this attribute by default.
To guard against this potential change, preferrably read from the
:attr:`__spec__` attribute instead or use
``getattr(module, "__package__", None)`` if you explicitly need to use
this attribute.

.. versionchanged:: 3.4
Defaults to ``None``. Previously the attribute was optional.

.. attribute:: __spec__

A record of the the module's import-system-related state. Expected to be
an instance of :class:`importlib.machinery.ModuleSpec`.

.. versionadded:: 3.4


.. data:: EllipsisType

Expand Down
Loading