| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -819,8 +819,18 @@ deque_clearmethod_impl(dequeobject *deque) | |||
| 819 | 819 | Py_RETURN_NONE; | |
| 820 | 820 | } | |
| 821 | 821 | ||
| 822 | + /*[clinic input] | ||
| 823 | + @critical_section | ||
| 824 | + _collections.deque.__imul__ as deque_inplace_repeat | ||
| 825 | + | ||
| 826 | + deque: dequeobject | ||
| 827 | + n: Py_ssize_t | ||
| 828 | + / | ||
| 829 | + [clinic start generated code]*/ | ||
| 830 | + | ||
| 822 | 831 | static PyObject * | |
| 823 | - deque_inplace_repeat_lock_held(dequeobject *deque, Py_ssize_t n) | ||
| 832 | + deque_inplace_repeat_impl(dequeobject *deque, Py_ssize_t n) | ||
| 833 | + /*[clinic end generated code: output=e9052495a8eb46f9 input=0ebbaedad03b8abf]*/ | ||
| 824 | 834 | { | |
| 825 | 835 | Py_ssize_t i, m, size; | |
| 826 | 836 | PyObject *seq; | |
@@ -896,17 +906,6 @@ deque_inplace_repeat_lock_held(dequeobject *deque, Py_ssize_t n) | |||
| 896 | 906 | return (PyObject *)deque; | |
| 897 | 907 | } | |
| 898 | 908 | ||
| 899 | - static PyObject * | ||
| 900 | - deque_inplace_repeat(PyObject *self, Py_ssize_t n) | ||
| 901 | - { | ||
| 902 | - dequeobject *deque = dequeobject_CAST(self); | ||
| 903 | - PyObject *result; | ||
| 904 | - Py_BEGIN_CRITICAL_SECTION(deque); | ||
| 905 | - result = deque_inplace_repeat_lock_held(deque, n); | ||
| 906 | - Py_END_CRITICAL_SECTION(); | ||
| 907 | - return result; | ||
| 908 | - } | ||
| 909 | - | ||
| 910 | 909 | static PyObject * | |
| 911 | 910 | deque_repeat(PyObject *self, Py_ssize_t n) | |
| 912 | 911 | { | |
@@ -921,7 +920,7 @@ deque_repeat(PyObject *self, Py_ssize_t n) | |||
| 921 | 920 | return NULL; | |
| 922 | 921 | // It's safe to not acquire the per-object lock for new_deque; it's | |
| 923 | 922 | // invisible to other threads. | |
| 924 | - rv = deque_inplace_repeat_lock_held(new_deque, n); | ||
| 923 | + rv = deque_inplace_repeat_impl(new_deque, n); | ||
| 925 | 924 | Py_DECREF(new_deque); | |
| 926 | 925 | return rv; | |
| 927 | 926 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -442,11 +442,19 @@ bytearray_iconcat(PyObject *op, PyObject *other) | |||
| 442 | 442 | return ret; | |
| 443 | 443 | } | |
| 444 | 444 | ||
| 445 | + /*[clinic input] | ||
| 446 | + @critical_section | ||
| 447 | + bytearray.__mul__ as bytearray_repeat | ||
| 448 | + | ||
| 449 | + count: Py_ssize_t | ||
| 450 | + / | ||
| 451 | + [clinic start generated code]*/ | ||
| 452 | + | ||
| 445 | 453 | static PyObject * | |
| 446 | - bytearray_repeat_lock_held(PyObject *op, Py_ssize_t count) | ||
| 454 | + bytearray_repeat_impl(PyByteArrayObject *self, Py_ssize_t count) | ||
| 455 | + /*[clinic end generated code: output=0889e9ebbe61890a input=3363528e6db1f39b]*/ | ||
| 447 | 456 | { | |
| 448 | - _Py_CRITICAL_SECTION_ASSERT_OBJECT_LOCKED(op); | ||
| 449 | - PyByteArrayObject *self = _PyByteArray_CAST(op); | ||
| 457 | + _Py_CRITICAL_SECTION_ASSERT_OBJECT_LOCKED(self); | ||
| 450 | 458 | if (count < 0) { | |
| 451 | 459 | count = 0; | |
| 452 | 460 | } | |
@@ -464,21 +472,19 @@ bytearray_repeat_lock_held(PyObject *op, Py_ssize_t count) | |||
| 464 | 472 | return (PyObject *)result; | |
| 465 | 473 | } | |
| 466 | 474 | ||
| 467 | - static PyObject * | ||
| 468 | - bytearray_repeat(PyObject *op, Py_ssize_t count) | ||
| 469 | - { | ||
| 470 | - PyObject *ret; | ||
| 471 | - Py_BEGIN_CRITICAL_SECTION(op); | ||
| 472 | - ret = bytearray_repeat_lock_held(op, count); | ||
| 473 | - Py_END_CRITICAL_SECTION(); | ||
| 474 | - return ret; | ||
| 475 | - } | ||
| 475 | + /*[clinic input] | ||
| 476 | + @critical_section | ||
| 477 | + bytearray.__imul__ as bytearray_irepeat | ||
| 478 | + | ||
| 479 | + count: Py_ssize_t | ||
| 480 | + / | ||
| 481 | + [clinic start generated code]*/ | ||
| 476 | 482 | ||
| 477 | 483 | static PyObject * | |
| 478 | - bytearray_irepeat_lock_held(PyObject *op, Py_ssize_t count) | ||
| 484 | + bytearray_irepeat_impl(PyByteArrayObject *self, Py_ssize_t count) | ||
| 485 | + /*[clinic end generated code: output=4cfee919b3489219 input=e12991c89153490b]*/ | ||
| 479 | 486 | { | |
| 480 | - _Py_CRITICAL_SECTION_ASSERT_OBJECT_LOCKED(op); | ||
| 481 | - PyByteArrayObject *self = _PyByteArray_CAST(op); | ||
| 487 | + _Py_CRITICAL_SECTION_ASSERT_OBJECT_LOCKED(self); | ||
| 482 | 488 | if (count < 0) { | |
| 483 | 489 | count = 0; | |
| 484 | 490 | } | |
@@ -501,16 +507,6 @@ bytearray_irepeat_lock_held(PyObject *op, Py_ssize_t count) | |||
| 501 | 507 | return Py_NewRef(self); | |
| 502 | 508 | } | |
| 503 | 509 | ||
| 504 | - static PyObject * | ||
| 505 | - bytearray_irepeat(PyObject *op, Py_ssize_t count) | ||
| 506 | - { | ||
| 507 | - PyObject *ret; | ||
| 508 | - Py_BEGIN_CRITICAL_SECTION(op); | ||
| 509 | - ret = bytearray_irepeat_lock_held(op, count); | ||
| 510 | - Py_END_CRITICAL_SECTION(); | ||
| 511 | - return ret; | ||
| 512 | - } | ||
| 513 | - | ||
| 514 | 510 | static PyObject * | |
| 515 | 511 | bytearray_getitem_lock_held(PyObject *op, Py_ssize_t i) | |
| 516 | 512 | { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -869,8 +869,18 @@ _PyList_Concat(PyObject *aa, PyObject *bb) | |||
| 869 | 869 | return ret; | |
| 870 | 870 | } | |
| 871 | 871 | ||
| 872 | + /*[clinic input] | ||
| 873 | + @critical_section | ||
| 874 | + list.__mul__ as list_repeat | ||
| 875 | + | ||
| 876 | + a: self(type="PyListObject *") | ||
| 877 | + n: Py_ssize_t | ||
| 878 | + / | ||
| 879 | + [clinic start generated code]*/ | ||
| 880 | + | ||
| 872 | 881 | static PyObject * | |
| 873 | - list_repeat_lock_held(PyListObject *a, Py_ssize_t n) | ||
| 882 | + list_repeat_impl(PyListObject *a, Py_ssize_t n) | ||
| 883 | + /*[clinic end generated code: output=65bb40ed76d3e733 input=dfef16e067b2abb6]*/ | ||
| 874 | 884 | { | |
| 875 | 885 | const Py_ssize_t input_size = Py_SIZE(a); | |
| 876 | 886 | if (input_size == 0 || n <= 0) | |
@@ -911,17 +921,6 @@ list_repeat_lock_held(PyListObject *a, Py_ssize_t n) | |||
| 911 | 921 | return (PyObject *) np; | |
| 912 | 922 | } | |
| 913 | 923 | ||
| 914 | - static PyObject * | ||
| 915 | - list_repeat(PyObject *aa, Py_ssize_t n) | ||
| 916 | - { | ||
| 917 | - PyObject *ret; | ||
| 918 | - PyListObject *a = (PyListObject *)aa; | ||
| 919 | - Py_BEGIN_CRITICAL_SECTION(a); | ||
| 920 | - ret = list_repeat_lock_held(a, n); | ||
| 921 | - Py_END_CRITICAL_SECTION(); | ||
| 922 | - return ret; | ||
| 923 | - } | ||
| 924 | - | ||
| 925 | 924 | static void | |
| 926 | 925 | list_clear_impl(PyListObject *a, bool is_resize) | |
| 927 | 926 | { | |
@@ -1171,20 +1170,22 @@ list_inplace_repeat_lock_held(PyListObject *self, Py_ssize_t n) | |||
| 1171 | 1170 | return 0; | |
| 1172 | 1171 | } | |
| 1173 | 1172 | ||
| 1173 | + /*[clinic input] | ||
| 1174 | + @critical_section | ||
| 1175 | + list.__imul__ as list_inplace_repeat | ||
| 1176 | + | ||
| 1177 | + n: Py_ssize_t | ||
| 1178 | + / | ||
| 1179 | + [clinic start generated code]*/ | ||
| 1180 | + | ||
| 1174 | 1181 | static PyObject * | |
| 1175 | - list_inplace_repeat(PyObject *_self, Py_ssize_t n) | ||
| 1182 | + list_inplace_repeat_impl(PyListObject *self, Py_ssize_t n) | ||
| 1183 | + /*[clinic end generated code: output=d318a9f047b4fcaf input=530d74de0e4a61f0]*/ | ||
| 1176 | 1184 | { | |
| 1177 | - PyObject *ret; | ||
| 1178 | - PyListObject *self = (PyListObject *) _self; | ||
| 1179 | - Py_BEGIN_CRITICAL_SECTION(self); | ||
| 1180 | 1185 | if (list_inplace_repeat_lock_held(self, n) < 0) { | |
| 1181 | - ret = NULL; | ||
| 1182 | - } | ||
| 1183 | - else { | ||
| 1184 | - ret = Py_NewRef(self); | ||
| 1186 | + return NULL; | ||
| 1185 | 1187 | } | |
| 1186 | - Py_END_CRITICAL_SECTION(); | ||
| 1187 | - return ret; | ||
| 1188 | + return Py_NewRef(self); | ||
| 1188 | 1189 | } | |
| 1189 | 1190 | ||
| 1190 | 1191 | /*[clinic input] | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -60,7 +60,6 @@ | |||
| 60 | 60 | __ilshift__ | |
| 61 | 61 | __imatmul__ | |
| 62 | 62 | __imod__ | |
| 63 | - __imul__ | ||
| 64 | 63 | __index__ | |
| 65 | 64 | __int__ | |
| 66 | 65 | __invert__ | |
@@ -76,7 +75,6 @@ | |||
| 76 | 75 | __lt__ | |
| 77 | 76 | __matmul__ | |
| 78 | 77 | __mod__ | |
| 79 | - __mul__ | ||
| 80 | 78 | __neg__ | |
| 81 | 79 | __or__ | |
| 82 | 80 | __pos__ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -40,6 +40,8 @@ def make_return_converter(self) -> CReturnConverter: | |||
| 40 | 40 | SLOTS: Final[dict[str, SlotSpec]] = { | |
| 41 | 41 | '__next__': SlotSpec(return_converter='object'), | |
| 42 | 42 | '__len__': SlotSpec(return_converter='Py_ssize_t'), | |
| 43 | + '__mul__': SlotSpec(return_converter='object'), | ||
| 44 | + '__imul__': SlotSpec(return_converter='object'), | ||
| 43 | 45 | '__repr__': SlotSpec(return_converter='object'), | |
| 44 | 46 | '__setitem__': SlotSpec(return_converter='int'), | |
| 45 | 47 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments