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
23 changes: 11 additions & 12 deletions Modules/_collectionsmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -674,8 +674,18 @@ deque___copy___impl(dequeobject *deque)
return deque_copy_impl(deque);
}

/*[clinic input]
@critical_section
_collections.deque.__add__ as deque_concat

deque: dequeobject
other: object
/
[clinic start generated code]*/

static PyObject *
deque_concat_lock_held(dequeobject *deque, PyObject *other)
deque_concat_impl(dequeobject *deque, PyObject *other)
/*[clinic end generated code: output=fa6c28f7752f0b28 input=1816c51a4c6c4f05]*/
{
PyObject *new_deque, *result;
int rv;
Expand Down Expand Up @@ -706,17 +716,6 @@ deque_concat_lock_held(dequeobject *deque, PyObject *other)
return new_deque;
}

static PyObject *
deque_concat(PyObject *self, PyObject *other)
{
dequeobject *deque = dequeobject_CAST(self);
PyObject *result;
Py_BEGIN_CRITICAL_SECTION(deque);
result = deque_concat_lock_held(deque, other);
Py_END_CRITICAL_SECTION();
return result;
}

static int
deque_clear(PyObject *self)
{
Expand Down
17 changes: 16 additions & 1 deletion Modules/clinic/_collectionsmodule.c.h

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

24 changes: 11 additions & 13 deletions Objects/bytearrayobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -403,11 +403,19 @@ bytearray_length(PyObject *op)
return PyByteArray_GET_SIZE(op);
}

/*[clinic input]
@critical_section
bytearray.__iadd__ as bytearray_iconcat

other: object
/
[clinic start generated code]*/

static PyObject *
bytearray_iconcat_lock_held(PyObject *op, PyObject *other)
bytearray_iconcat_impl(PyByteArrayObject *self, PyObject *other)
/*[clinic end generated code: output=ba172f2db8f7a8dd input=5b6fb07ab387084d]*/
{
_Py_CRITICAL_SECTION_ASSERT_OBJECT_LOCKED(op);
PyByteArrayObject *self = _PyByteArray_CAST(op);
_Py_CRITICAL_SECTION_ASSERT_OBJECT_LOCKED(self);

Py_buffer vo;
if (PyObject_GetBuffer(other, &vo, PyBUF_SIMPLE) != 0) {
Expand All @@ -432,16 +440,6 @@ bytearray_iconcat_lock_held(PyObject *op, PyObject *other)
return Py_NewRef(self);
}

static PyObject *
bytearray_iconcat(PyObject *op, PyObject *other)
{
PyObject *ret;
Py_BEGIN_CRITICAL_SECTION(op);
ret = bytearray_iconcat_lock_held(op, other);
Py_END_CRITICAL_SECTION();
return ret;
}

/*[clinic input]
@critical_section
bytearray.__mul__ as bytearray_repeat
Expand Down
17 changes: 16 additions & 1 deletion Objects/clinic/bytearrayobject.c.h

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

2 changes: 0 additions & 2 deletions Tools/clinic/libclinic/dsl_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
unsupported_special_methods: set[str] = set("""

__abs__
__add__
__and__
__call__
__delitem__
Expand All @@ -54,7 +53,6 @@
__getitem__
__gt__
__hash__
__iadd__
__iand__
__ifloordiv__
__ilshift__
Expand Down
2 changes: 2 additions & 0 deletions Tools/clinic/libclinic/slots.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ def make_return_converter(self) -> CReturnConverter:
SLOTS: Final[dict[str, SlotSpec]] = {
'__next__': SlotSpec(return_converter='object'),
'__len__': SlotSpec(return_converter='Py_ssize_t'),
'__add__': SlotSpec(return_converter='object'),
'__iadd__': SlotSpec(return_converter='object'),
'__mul__': SlotSpec(return_converter='object'),
'__imul__': SlotSpec(return_converter='object'),
'__repr__': SlotSpec(return_converter='object'),
Expand Down
Loading