Skip to content

Commit

Permalink
Merge branch 'main' into strict-map
Browse files Browse the repository at this point in the history
  • Loading branch information
nineteendo authored Jun 19, 2024
2 parents f9a2a49 + a86e625 commit 800ac10
Show file tree
Hide file tree
Showing 250 changed files with 4,584 additions and 1,564 deletions.
6 changes: 4 additions & 2 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

# Build system
configure* @erlend-aasland @corona10
Makefile.pre.in @erlend-aasland
Modules/Setup* @erlend-aasland

# asyncio
**/*asyncio* @1st1 @asvetlov @gvanrossum @kumaraditya303 @willingc
Expand Down Expand Up @@ -40,7 +42,7 @@ Python/bytecodes.c @markshannon
Python/optimizer*.c @markshannon
Python/optimizer_analysis.c @Fidget-Spinner
Python/optimizer_bytecodes.c @Fidget-Spinner
Python/symtable.c @JelleZijlstra @carljm
Python/symtable.c @JelleZijlstra @carljm
Lib/_pyrepl/* @pablogsal @lysnikolaou @ambv
Lib/test/test_patma.py @brandtbucher
Lib/test/test_type_*.py @JelleZijlstra
Expand Down Expand Up @@ -199,7 +201,6 @@ Doc/c-api/stable.rst @encukou
**/*itertools* @rhettinger
**/*collections* @rhettinger
**/*random* @rhettinger
**/*queue* @rhettinger
**/*bisect* @rhettinger
**/*heapq* @rhettinger
**/*functools* @rhettinger
Expand All @@ -210,6 +211,7 @@ Doc/c-api/stable.rst @encukou
**/*ensurepip* @pfmoore @pradyunsg

**/*idlelib* @terryjreedy
/Doc/library/idle.rst @terryjreedy

**/*typing* @JelleZijlstra @AlexWaygood

Expand Down
84 changes: 84 additions & 0 deletions Doc/c-api/unicode.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1502,3 +1502,87 @@ They all return ``NULL`` or ``-1`` if an exception occurs.
:c:func:`PyUnicode_InternInPlace`, returning either a new Unicode string
object that has been interned, or a new ("owned") reference to an earlier
interned string object with the same value.
PyUnicodeWriter
^^^^^^^^^^^^^^^
The :c:type:`PyUnicodeWriter` API can be used to create a Python :class:`str`
object.
.. versionadded:: 3.14
.. c:type:: PyUnicodeWriter
A Unicode writer instance.
The instance must be destroyed by :c:func:`PyUnicodeWriter_Finish` on
success, or :c:func:`PyUnicodeWriter_Discard` on error.
.. c:function:: PyUnicodeWriter* PyUnicodeWriter_Create(Py_ssize_t length)
Create a Unicode writer instance.
Set an exception and return ``NULL`` on error.
.. c:function:: PyObject* PyUnicodeWriter_Finish(PyUnicodeWriter *writer)
Return the final Python :class:`str` object and destroy the writer instance.
Set an exception and return ``NULL`` on error.
.. c:function:: void PyUnicodeWriter_Discard(PyUnicodeWriter *writer)
Discard the internal Unicode buffer and destroy the writer instance.
.. c:function:: int PyUnicodeWriter_WriteChar(PyUnicodeWriter *writer, Py_UCS4 ch)
Write the single Unicode character *ch* into *writer*.
On success, return ``0``.
On error, set an exception, leave the writer unchanged, and return ``-1``.
.. c:function:: int PyUnicodeWriter_WriteUTF8(PyUnicodeWriter *writer, const char *str, Py_ssize_t size)
Decode the string *str* from UTF-8 in strict mode and write the output into *writer*.
*size* is the string length in bytes. If *size* is equal to ``-1``, call
``strlen(str)`` to get the string length.
On success, return ``0``.
On error, set an exception, leave the writer unchanged, and return ``-1``.
To use a different error handler than ``strict``,
:c:func:`PyUnicode_DecodeUTF8` can be used with
:c:func:`PyUnicodeWriter_WriteStr`.
.. c:function:: int PyUnicodeWriter_WriteStr(PyUnicodeWriter *writer, PyObject *obj)
Call :c:func:`PyObject_Str` on *obj* and write the output into *writer*.
On success, return ``0``.
On error, set an exception, leave the writer unchanged, and return ``-1``.
.. c:function:: int PyUnicodeWriter_WriteRepr(PyUnicodeWriter *writer, PyObject *obj)
Call :c:func:`PyObject_Repr` on *obj* and write the output into *writer*.
On success, return ``0``.
On error, set an exception, leave the writer unchanged, and return ``-1``.
.. c:function:: int PyUnicodeWriter_WriteSubstring(PyUnicodeWriter *writer, PyObject *str, Py_ssize_t start, Py_ssize_t end)
Write the substring ``str[start:end]`` into *writer*.
*str* must be Python :class:`str` object. *start* must be greater than or
equal to 0, and less than or equal to *end*. *end* must be less than or
equal to *str* length.
On success, return ``0``.
On error, set an exception, leave the writer unchanged, and return ``-1``.
.. c:function:: int PyUnicodeWriter_Format(PyUnicodeWriter *writer, const char *format, ...)
Similar to :c:func:`PyUnicode_FromFormat`, but write the output directly into *writer*.
On success, return ``0``.
On error, set an exception, leave the writer unchanged, and return ``-1``.
16 changes: 16 additions & 0 deletions Doc/c-api/weakref.rst
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,19 @@ as much as it can.
This iterates through the weak references for *object* and calls callbacks
for those references which have one. It returns when all callbacks have
been attempted.
.. c:function:: void PyUnstable_Object_ClearWeakRefsNoCallbacks(PyObject *object)
Clears the weakrefs for *object* without calling the callbacks.
This function is called by the :c:member:`~PyTypeObject.tp_dealloc` handler
for types with finalizers (i.e., :meth:`~object.__del__`). The handler for
those objects first calls :c:func:`PyObject_ClearWeakRefs` to clear weakrefs
and call their callbacks, then the finalizer, and finally this function to
clear any weakrefs that may have been created by the finalizer.
In most circumstances, it's more appropriate to use
:c:func:`PyObject_ClearWeakRefs` to clear weakrefs instead of this function.
.. versionadded:: 3.13
1 change: 1 addition & 0 deletions Doc/data/stable_abi.dat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Doc/glossary.rst
Original file line number Diff line number Diff line change
Expand Up @@ -694,6 +694,9 @@ Glossary

CPython does not consistently apply the requirement that an iterator
define :meth:`~iterator.__iter__`.
And also please note that the free-threading CPython does not guarantee
the thread-safety of iterator operations.


key function
A key function or collation function is a callable that returns a value
Expand Down
2 changes: 2 additions & 0 deletions Doc/howto/enum.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.. _enum-howto:

==========
Enum HOWTO
==========
Expand Down
Loading

0 comments on commit 800ac10

Please sign in to comment.