Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
20 changes: 0 additions & 20 deletions Doc/library/typing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2435,19 +2435,6 @@ types.
Using :func:`super` (and the ``__class__`` :term:`closure variable`) in methods of ``NamedTuple`` subclasses
is unsupported and causes a :class:`TypeError`.

.. deprecated-removed:: 3.13 3.15
The undocumented keyword argument syntax for creating NamedTuple classes
(``NT = NamedTuple("NT", x=int)``) is deprecated, and will be disallowed
in 3.15. Use the class-based syntax or the functional syntax instead.

.. deprecated-removed:: 3.13 3.15
When using the functional syntax to create a NamedTuple class, failing to
pass a value to the 'fields' parameter (``NT = NamedTuple("NT")``) is
deprecated. Passing ``None`` to the 'fields' parameter
(``NT = NamedTuple("NT", None)``) is also deprecated. Both will be
disallowed in Python 3.15. To create a NamedTuple class with 0 fields,
use ``class NT(NamedTuple): pass`` or ``NT = NamedTuple("NT", [])``.

.. class:: NewType(name, tp)

Helper class to create low-overhead :ref:`distinct types <distinct>`.
Expand Down Expand Up @@ -2823,13 +2810,6 @@ types.
.. versionchanged:: 3.13
Support for the :data:`ReadOnly` qualifier was added.

.. deprecated-removed:: 3.13 3.15
When using the functional syntax to create a TypedDict class, failing to
pass a value to the 'fields' parameter (``TD = TypedDict("TD")``) is
deprecated. Passing ``None`` to the 'fields' parameter
(``TD = TypedDict("TD", None)``) is also deprecated. Both will be
disallowed in Python 3.15. To create a TypedDict class with 0 fields,
use ``class TD(TypedDict): pass`` or ``TD = TypedDict("TD", {})``.

Protocols
---------
Expand Down
20 changes: 20 additions & 0 deletions Include/internal/pycore_bytesobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,26 @@ struct PyBytesWriter {
// Export for '_testcapi' shared extension
PyAPI_FUNC(PyBytesWriter*) _PyBytesWriter_CreateByteArray(Py_ssize_t size);

static inline Py_ssize_t
_PyBytesWriter_GetSize(PyBytesWriter *writer)
{
return writer->size;
}

static inline char*
_PyBytesWriter_GetData(PyBytesWriter *writer)
{
if (writer->obj == NULL) {
return writer->small_buffer;
}
else if (writer->use_bytearray) {
return PyByteArray_AS_STRING(writer->obj);
}
else {
return PyBytes_AS_STRING(writer->obj);
}
}

#ifdef __cplusplus
}
#endif
Expand Down
12 changes: 2 additions & 10 deletions Objects/bytesobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -3480,15 +3480,7 @@ _PyBytes_Repeat(char* dest, Py_ssize_t len_dest,
static inline char*
byteswriter_data(PyBytesWriter *writer)
{
if (writer->obj == NULL) {
return writer->small_buffer;
}
else if (writer->use_bytearray) {
return PyByteArray_AS_STRING(writer->obj);
}
else {
return PyBytes_AS_STRING(writer->obj);
}
return _PyBytesWriter_GetData(writer);
}


Expand Down Expand Up @@ -3710,7 +3702,7 @@ PyBytesWriter_GetData(PyBytesWriter *writer)
Py_ssize_t
PyBytesWriter_GetSize(PyBytesWriter *writer)
{
return writer->size;
return _PyBytesWriter_GetSize(writer);
}


Expand Down
Loading
Loading