Skip to content
Open
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
4 changes: 0 additions & 4 deletions Include/cpython/listobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,7 @@ typedef struct {

static inline Py_ssize_t PyList_GET_SIZE(PyObject *op) {
PyListObject *list = _PyList_CAST(op);
#ifdef Py_GIL_DISABLED
return _Py_atomic_load_ssize_relaxed(&(_PyVarObject_CAST(list)->ob_size));
#else
return Py_SIZE(list);
#endif
}
#define PyList_GET_SIZE(op) PyList_GET_SIZE(_PyObject_CAST(op))

Expand Down
6 changes: 5 additions & 1 deletion Include/object.h
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,11 @@ _Py_SIZE_impl(PyObject *ob)
{
assert(Py_TYPE(ob) != &PyLong_Type);
assert(Py_TYPE(ob) != &PyBool_Type);
return _PyVarObject_CAST(ob)->ob_size;
#ifdef Py_GIL_DISABLED
return _Py_atomic_load_ssize_relaxed(&(_PyVarObject_CAST(ob)->ob_size));
#else
return _PyVarObject_CAST(ob)->ob_size;
#endif
}

static inline int
Expand Down
1 change: 1 addition & 0 deletions Objects/bytearrayobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "pycore_object.h" // _PyObject_GC_UNTRACK()
#include "pycore_strhex.h" // _Py_strhex_with_sep()
#include "pycore_long.h" // _PyLong_FromUnsignedChar()
#include "pycore_list.h" // _PyList_GetItemRef
#include "pycore_pyatomic_ft_wrappers.h"
#include "bytesobject.h"

Expand Down
9 changes: 9 additions & 0 deletions Objects/stringlib/join.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,16 @@ STRINGLIB(bytes_join)(PyObject *sep, PyObject *iterable)
*/
for (i = 0, nbufs = 0; i < seqlen; i++) {
Py_ssize_t itemlen;
#ifdef Py_GIL_DISABLED
if (PyList_Check(seq)) {
item = _PyList_GetItemRef((PyListObject *)seq, i);
}
else {
item = PyTuple_GET_ITEM(seq, i);
}
#else
item = PySequence_Fast_GET_ITEM(seq, i);
#endif
if (PyBytes_CheckExact(item)) {
/* Fast path. */
buffers[i].obj = Py_NewRef(item);
Expand Down
Loading