Skip to content

Commit

Permalink
Merge branch 'main' into dictwatch
Browse files Browse the repository at this point in the history
* main: (66 commits)
  pythongh-65961: Raise `DeprecationWarning` when `__package__` differs from `__spec__.parent` (python#97879)
  docs(typing): add "see PEP 675" to LiteralString (python#97926)
  pythongh-97850: Remove all known instances of module_repr() (python#97876)
  I changed my surname early this year (python#96671)
  pythongh-93738: Documentation C syntax (:c:type:<C type> -> :c:expr:<C type>) (python#97768)
  pythongh-91539: improve performance of get_proxies_environment  (python#91566)
  build(deps): bump actions/stale from 5 to 6 (python#97701)
  pythonGH-95172 Make the same version `versionadded` oneline (python#95172)
  pythongh-88050: Fix asyncio subprocess to kill process cleanly when process is blocked (python#32073)
  pythongh-93738: Documentation C syntax (Function glob patterns -> literal markup) (python#97774)
  pythongh-93357: Port test cases to IsolatedAsyncioTestCase, part 2 (python#97896)
  pythongh-95196: Disable incorrect pickling of the C implemented classmethod descriptors (pythonGH-96383)
  pythongh-97758: Fix a crash in getpath_joinpath() called without arguments (pythonGH-97759)
  pythongh-74696: Pass root_dir to custom archivers which support it (pythonGH-94251)
  pythongh-97661: Improve accuracy of sqlite3.Cursor.fetchone docs (python#97662)
  pythongh-87092: bring compiler code closer to a preprocessing-opt-assembler organisation (pythonGH-97644)
  pythonGH-96704: Add {Task,Handle}.get_context(), use it in call_exception_handler() (python#96756)
  pythongh-93738: Documentation C syntax (:c:type:`PyTypeObject*` -> :c:expr:`PyTypeObject*`) (python#97778)
  pythongh-97825: fix AttributeError when calling subprocess.check_output(input=None) with encoding or errors args (python#97826)
  Add re.VERBOSE flag documentation example (python#97678)
  ...
  • Loading branch information
carljm committed Oct 5, 2022
2 parents 6e5cee2 + c206e53 commit 4bb5d9d
Show file tree
Hide file tree
Showing 216 changed files with 52,415 additions and 8,849 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ Include/internal/pycore_runtime_init_generated.h generated
Include/opcode.h generated
Include/token.h generated
Lib/keyword.py generated
Lib/test/levenshtein_examples.json generated
Lib/test/test_stable_abi_ctypes.py generated
Lib/token.py generated
Objects/typeslots.inc generated
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/project-updater.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
- { project: 2, label: "release-blocker, deferred-blocker" }
- { project: 3, label: expert-subinterpreters }
- { project: 29, label: expert-asyncio }
- { project: 32, label: sprint }

steps:
- uses: actions/[email protected]
Expand Down
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@v5
uses: actions/stale@v6
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
88 changes: 44 additions & 44 deletions Doc/c-api/arg.rst
Original file line number Diff line number Diff line change
Expand Up @@ -129,17 +129,17 @@ which disallows mutable objects such as :class:`bytearray`.
``S`` (:class:`bytes`) [PyBytesObject \*]
Requires that the Python object is a :class:`bytes` object, without
attempting any conversion. Raises :exc:`TypeError` if the object is not
a bytes object. The C variable may also be declared as :c:type:`PyObject*`.
a bytes object. The C variable may also be declared as :c:expr:`PyObject*`.

``Y`` (:class:`bytearray`) [PyByteArrayObject \*]
Requires that the Python object is a :class:`bytearray` object, without
attempting any conversion. Raises :exc:`TypeError` if the object is not
a :class:`bytearray` object. The C variable may also be declared as :c:type:`PyObject*`.
a :class:`bytearray` object. The C variable may also be declared as :c:expr:`PyObject*`.

``U`` (:class:`str`) [PyObject \*]
Requires that the Python object is a Unicode object, without attempting
any conversion. Raises :exc:`TypeError` if the object is not a Unicode
object. The C variable may also be declared as :c:type:`PyObject*`.
object. The C variable may also be declared as :c:expr:`PyObject*`.

``w*`` (read-write :term:`bytes-like object`) [Py_buffer]
This format accepts any object which implements the read-write buffer
Expand All @@ -152,10 +152,10 @@ which disallows mutable objects such as :class:`bytearray`.
It only works for encoded data without embedded NUL bytes.

This format requires two arguments. The first is only used as input, and
must be a :c:type:`const char*` which points to the name of an encoding as a
must be a :c:expr:`const char*` which points to the name of an encoding as a
NUL-terminated string, or ``NULL``, in which case ``'utf-8'`` encoding is used.
An exception is raised if the named encoding is not known to Python. The
second argument must be a :c:type:`char**`; the value of the pointer it
second argument must be a :c:expr:`char**`; the value of the pointer it
references will be set to a buffer with the contents of the argument text.
The text will be encoded in the encoding specified by the first argument.

Expand All @@ -175,10 +175,10 @@ which disallows mutable objects such as :class:`bytearray`.
characters.

It requires three arguments. The first is only used as input, and must be a
:c:type:`const char*` which points to the name of an encoding as a
:c:expr:`const char*` which points to the name of an encoding as a
NUL-terminated string, or ``NULL``, in which case ``'utf-8'`` encoding is used.
An exception is raised if the named encoding is not known to Python. The
second argument must be a :c:type:`char**`; the value of the pointer it
second argument must be a :c:expr:`char**`; the value of the pointer it
references will be set to a buffer with the contents of the argument text.
The text will be encoded in the encoding specified by the first argument.
The third argument must be a pointer to an integer; the referenced integer
Expand Down Expand Up @@ -215,59 +215,59 @@ Numbers

``b`` (:class:`int`) [unsigned char]
Convert a nonnegative Python integer to an unsigned tiny int, stored in a C
:c:type:`unsigned char`.
:c:expr:`unsigned char`.

``B`` (:class:`int`) [unsigned char]
Convert a Python integer to a tiny int without overflow checking, stored in a C
:c:type:`unsigned char`.
:c:expr:`unsigned char`.

``h`` (:class:`int`) [short int]
Convert a Python integer to a C :c:type:`short int`.
Convert a Python integer to a C :c:expr:`short int`.

``H`` (:class:`int`) [unsigned short int]
Convert a Python integer to a C :c:type:`unsigned short int`, without overflow
Convert a Python integer to a C :c:expr:`unsigned short int`, without overflow
checking.

``i`` (:class:`int`) [int]
Convert a Python integer to a plain C :c:type:`int`.
Convert a Python integer to a plain C :c:expr:`int`.

``I`` (:class:`int`) [unsigned int]
Convert a Python integer to a C :c:type:`unsigned int`, without overflow
Convert a Python integer to a C :c:expr:`unsigned int`, without overflow
checking.

``l`` (:class:`int`) [long int]
Convert a Python integer to a C :c:type:`long int`.
Convert a Python integer to a C :c:expr:`long int`.

``k`` (:class:`int`) [unsigned long]
Convert a Python integer to a C :c:type:`unsigned long` without
Convert a Python integer to a C :c:expr:`unsigned long` without
overflow checking.

``L`` (:class:`int`) [long long]
Convert a Python integer to a C :c:type:`long long`.
Convert a Python integer to a C :c:expr:`long long`.

``K`` (:class:`int`) [unsigned long long]
Convert a Python integer to a C :c:type:`unsigned long long`
Convert a Python integer to a C :c:expr:`unsigned long long`
without overflow checking.

``n`` (:class:`int`) [:c:type:`Py_ssize_t`]
Convert a Python integer to a C :c:type:`Py_ssize_t`.

``c`` (:class:`bytes` or :class:`bytearray` of length 1) [char]
Convert a Python byte, represented as a :class:`bytes` or
:class:`bytearray` object of length 1, to a C :c:type:`char`.
:class:`bytearray` object of length 1, to a C :c:expr:`char`.

.. versionchanged:: 3.3
Allow :class:`bytearray` objects.

``C`` (:class:`str` of length 1) [int]
Convert a Python character, represented as a :class:`str` object of
length 1, to a C :c:type:`int`.
length 1, to a C :c:expr:`int`.

``f`` (:class:`float`) [float]
Convert a Python floating point number to a C :c:type:`float`.
Convert a Python floating point number to a C :c:expr:`float`.

``d`` (:class:`float`) [double]
Convert a Python floating point number to a C :c:type:`double`.
Convert a Python floating point number to a C :c:expr:`double`.

``D`` (:class:`complex`) [Py_complex]
Convert a Python complex number to a C :c:type:`Py_complex` structure.
Expand All @@ -283,7 +283,7 @@ Other objects
``O!`` (object) [*typeobject*, PyObject \*]
Store a Python object in a C object pointer. This is similar to ``O``, but
takes two C arguments: the first is the address of a Python type object, the
second is the address of the C variable (of type :c:type:`PyObject*`) into which
second is the address of the C variable (of type :c:expr:`PyObject*`) into which
the object pointer is stored. If the Python object does not have the required
type, :exc:`TypeError` is raised.

Expand All @@ -292,13 +292,13 @@ Other objects
``O&`` (object) [*converter*, *anything*]
Convert a Python object to a C variable through a *converter* function. This
takes two arguments: the first is a function, the second is the address of a C
variable (of arbitrary type), converted to :c:type:`void *`. The *converter*
variable (of arbitrary type), converted to :c:expr:`void *`. The *converter*
function in turn is called as follows::

status = converter(object, address);

where *object* is the Python object to be converted and *address* is the
:c:type:`void*` argument that was passed to the :c:func:`PyArg_Parse\*` function.
:c:expr:`void*` argument that was passed to the ``PyArg_Parse*`` function.
The returned *status* should be ``1`` for a successful conversion and ``0`` if
the conversion has failed. When the conversion fails, the *converter* function
should raise an exception and leave the content of *address* unmodified.
Expand Down Expand Up @@ -372,9 +372,9 @@ what is specified for the corresponding format unit in that case.

For the conversion to succeed, the *arg* object must match the format
and the format must be exhausted. On success, the
:c:func:`PyArg_Parse\*` functions return true, otherwise they return
``PyArg_Parse*`` functions return true, otherwise they return
false and raise an appropriate exception. When the
:c:func:`PyArg_Parse\*` functions fail due to conversion failure in one
``PyArg_Parse*`` functions fail due to conversion failure in one
of the format units, the variables at the addresses corresponding to that
and the following format units are left untouched.

Expand Down Expand Up @@ -444,7 +444,7 @@ API Functions
*args*; it must actually be a tuple. The length of the tuple must be at least
*min* and no more than *max*; *min* and *max* may be equal. Additional
arguments must be passed to the function, each of which should be a pointer to a
:c:type:`PyObject*` variable; these will be filled in with the values from
:c:expr:`PyObject*` variable; these will be filled in with the values from
*args*; they will contain :term:`borrowed references <borrowed reference>`.
The variables which correspond
to optional parameters not given by *args* will not be filled in; these should
Expand Down Expand Up @@ -481,7 +481,7 @@ Building values
.. c:function:: PyObject* Py_BuildValue(const char *format, ...)
Create a new value based on a format string similar to those accepted by the
:c:func:`PyArg_Parse\*` family of functions and a sequence of values. Returns
``PyArg_Parse*`` family of functions and a sequence of values. Returns
the value or ``NULL`` in the case of an error; an exception will be raised if
``NULL`` is returned.
Expand Down Expand Up @@ -531,7 +531,7 @@ Building values
Same as ``s#``.
``u`` (:class:`str`) [const wchar_t \*]
Convert a null-terminated :c:type:`wchar_t` buffer of Unicode (UTF-16 or UCS-4)
Convert a null-terminated :c:expr:`wchar_t` buffer of Unicode (UTF-16 or UCS-4)
data to a Python Unicode object. If the Unicode buffer pointer is ``NULL``,
``None`` is returned.
Expand All @@ -547,51 +547,51 @@ Building values
Same as ``s#``.
``i`` (:class:`int`) [int]
Convert a plain C :c:type:`int` to a Python integer object.
Convert a plain C :c:expr:`int` to a Python integer object.
``b`` (:class:`int`) [char]
Convert a plain C :c:type:`char` to a Python integer object.
Convert a plain C :c:expr:`char` to a Python integer object.
``h`` (:class:`int`) [short int]
Convert a plain C :c:type:`short int` to a Python integer object.
Convert a plain C :c:expr:`short int` to a Python integer object.
``l`` (:class:`int`) [long int]
Convert a C :c:type:`long int` to a Python integer object.
Convert a C :c:expr:`long int` to a Python integer object.
``B`` (:class:`int`) [unsigned char]
Convert a C :c:type:`unsigned char` to a Python integer object.
Convert a C :c:expr:`unsigned char` to a Python integer object.
``H`` (:class:`int`) [unsigned short int]
Convert a C :c:type:`unsigned short int` to a Python integer object.
Convert a C :c:expr:`unsigned short int` to a Python integer object.
``I`` (:class:`int`) [unsigned int]
Convert a C :c:type:`unsigned int` to a Python integer object.
Convert a C :c:expr:`unsigned int` to a Python integer object.
``k`` (:class:`int`) [unsigned long]
Convert a C :c:type:`unsigned long` to a Python integer object.
Convert a C :c:expr:`unsigned long` to a Python integer object.
``L`` (:class:`int`) [long long]
Convert a C :c:type:`long long` to a Python integer object.
Convert a C :c:expr:`long long` to a Python integer object.
``K`` (:class:`int`) [unsigned long long]
Convert a C :c:type:`unsigned long long` to a Python integer object.
Convert a C :c:expr:`unsigned long long` to a Python integer object.
``n`` (:class:`int`) [:c:type:`Py_ssize_t`]
Convert a C :c:type:`Py_ssize_t` to a Python integer.
``c`` (:class:`bytes` of length 1) [char]
Convert a C :c:type:`int` representing a byte to a Python :class:`bytes` object of
Convert a C :c:expr:`int` representing a byte to a Python :class:`bytes` object of
length 1.
``C`` (:class:`str` of length 1) [int]
Convert a C :c:type:`int` representing a character to Python :class:`str`
Convert a C :c:expr:`int` representing a character to Python :class:`str`
object of length 1.
``d`` (:class:`float`) [double]
Convert a C :c:type:`double` to a Python floating point number.
Convert a C :c:expr:`double` to a Python floating point number.
``f`` (:class:`float`) [float]
Convert a C :c:type:`float` to a Python floating point number.
Convert a C :c:expr:`float` to a Python floating point number.
``D`` (:class:`complex`) [Py_complex \*]
Convert a C :c:type:`Py_complex` structure to a Python complex number.
Expand All @@ -614,7 +614,7 @@ Building values
``O&`` (object) [*converter*, *anything*]
Convert *anything* to a Python object through a *converter* function. The
function is called with *anything* (which should be compatible with :c:type:`void*`)
function is called with *anything* (which should be compatible with :c:expr:`void*`)
as its argument and should return a "new" Python object, or ``NULL`` if an
error occurred.
Expand Down
8 changes: 4 additions & 4 deletions Doc/c-api/call.rst
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ please see individual documentation for details.
This is the equivalent of the Python expression: ``callable(*args)``.
Note that if you only pass :c:type:`PyObject *` args,
Note that if you only pass :c:expr:`PyObject *` args,
:c:func:`PyObject_CallFunctionObjArgs` is a faster alternative.
.. versionchanged:: 3.4
Expand All @@ -305,7 +305,7 @@ please see individual documentation for details.
This is the equivalent of the Python expression:
``obj.name(arg1, arg2, ...)``.
Note that if you only pass :c:type:`PyObject *` args,
Note that if you only pass :c:expr:`PyObject *` args,
:c:func:`PyObject_CallMethodObjArgs` is a faster alternative.
.. versionchanged:: 3.4
Expand All @@ -315,7 +315,7 @@ please see individual documentation for details.
.. c:function:: PyObject* PyObject_CallFunctionObjArgs(PyObject *callable, ...)
Call a callable Python object *callable*, with a variable number of
:c:type:`PyObject *` arguments. The arguments are provided as a variable number
:c:expr:`PyObject *` arguments. The arguments are provided as a variable number
of parameters followed by *NULL*.
Return the result of the call on success, or raise an exception and return
Expand All @@ -329,7 +329,7 @@ please see individual documentation for details.
Call a method of the Python object *obj*, where the name of the method is given as a
Python string object in *name*. It is called with a variable number of
:c:type:`PyObject *` arguments. The arguments are provided as a variable number
:c:expr:`PyObject *` arguments. The arguments are provided as a variable number
of parameters followed by *NULL*.
Return the result of the call on success, or raise an exception and return
Expand Down
2 changes: 1 addition & 1 deletion Doc/c-api/capsule.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Refer to :ref:`using-capsules` for more information on using these objects.
.. c:type:: PyCapsule
This subtype of :c:type:`PyObject` represents an opaque value, useful for C
extension modules who need to pass an opaque value (as a :c:type:`void*`
extension modules who need to pass an opaque value (as a :c:expr:`void*`
pointer) through Python code to other C code. It is often used to make a C
function pointer defined in one module available to other modules, so the
regular import mechanism can be used to access C APIs defined in dynamically
Expand Down
4 changes: 2 additions & 2 deletions Doc/c-api/complex.rst
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,12 @@ Complex Numbers as Python Objects
.. c:function:: double PyComplex_RealAsDouble(PyObject *op)
Return the real part of *op* as a C :c:type:`double`.
Return the real part of *op* as a C :c:expr:`double`.
.. c:function:: double PyComplex_ImagAsDouble(PyObject *op)
Return the imaginary part of *op* as a C :c:type:`double`.
Return the imaginary part of *op* as a C :c:expr:`double`.
.. c:function:: Py_complex PyComplex_AsCComplex(PyObject *op)
Expand Down
4 changes: 2 additions & 2 deletions Doc/c-api/conversion.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ The following functions provide locale-independent string to number conversions.
.. c:function:: double PyOS_string_to_double(const char *s, char **endptr, PyObject *overflow_exception)
Convert a string ``s`` to a :c:type:`double`, raising a Python
Convert a string ``s`` to a :c:expr:`double`, raising a Python
exception on failure. The set of accepted strings corresponds to
the set of strings accepted by Python's :func:`float` constructor,
except that ``s`` must not have leading or trailing whitespace.
Expand Down Expand Up @@ -83,7 +83,7 @@ The following functions provide locale-independent string to number conversions.
.. c:function:: char* PyOS_double_to_string(double val, char format_code, int precision, int flags, int *ptype)
Convert a :c:type:`double` *val* to a string using supplied
Convert a :c:expr:`double` *val* to a string using supplied
*format_code*, *precision*, and *flags*.
*format_code* must be one of ``'e'``, ``'E'``, ``'f'``, ``'F'``,
Expand Down
6 changes: 3 additions & 3 deletions Doc/c-api/dict.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ Dictionary Objects
.. index:: single: PyUnicode_FromString()
Insert *val* into the dictionary *p* using *key* as a key. *key* should
be a :c:type:`const char*`. The key object is created using
be a :c:expr:`const char*`. The key object is created using
``PyUnicode_FromString(key)``. Return ``0`` on success or ``-1`` on
failure. This function *does not* steal a reference to *val*.
Expand Down Expand Up @@ -118,7 +118,7 @@ Dictionary Objects
.. c:function:: PyObject* PyDict_GetItemString(PyObject *p, const char *key)
This is the same as :c:func:`PyDict_GetItem`, but *key* is specified as a
:c:type:`const char*`, rather than a :c:type:`PyObject*`.
:c:expr:`const char*`, rather than a :c:expr:`PyObject*`.
Note that exceptions which occur while calling :meth:`__hash__` and
:meth:`__eq__` methods and creating a temporary string object
Expand Down Expand Up @@ -167,7 +167,7 @@ Dictionary Objects
prior to the first call to this function to start the iteration; the
function returns true for each pair in the dictionary, and false once all
pairs have been reported. The parameters *pkey* and *pvalue* should either
point to :c:type:`PyObject*` variables that will be filled in with each key
point to :c:expr:`PyObject*` variables that will be filled in with each key
and value, respectively, or may be ``NULL``. Any references returned through
them are borrowed. *ppos* should not be altered during iteration. Its
value represents offsets within the internal dictionary structure, and
Expand Down
Loading

0 comments on commit 4bb5d9d

Please sign in to comment.