Skip to content

Commit d381a91

Browse files
Fix build on linux
1 parent 311f629 commit d381a91

File tree

6 files changed

+17
-14
lines changed

6 files changed

+17
-14
lines changed

Modules/_ctypes/_ctypes.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3251,7 +3251,7 @@ PyCData_MallocBuffer(CDataObject *obj, StgInfo *info)
32513251
* used in constructors and therefore does not have concurrent
32523252
* access.
32533253
*/
3254-
assert (_PyObject_IsUniquelyReferenced(obj));
3254+
assert (_PyObject_IsUniquelyReferenced((PyObject *)obj));
32553255
assert(stginfo_get_dict_final(info) == 1);
32563256

32573257
if ((size_t)info->size <= sizeof(obj->b_value)) {

Modules/_testcapi/object.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ negative_refcount(PyObject *self, PyObject *Py_UNUSED(args))
258258
if (obj == NULL) {
259259
return NULL;
260260
}
261-
assert(_PyObject_IsUniquelyReferenced(obj));
261+
assert(PyUnstable_Object_IsUniquelyReferenced(obj));
262262

263263
Py_SET_REFCNT(obj, 0);
264264
/* Py_DECREF() must call _Py_NegativeRefcount() and abort Python */
@@ -275,7 +275,7 @@ decref_freed_object(PyObject *self, PyObject *Py_UNUSED(args))
275275
if (obj == NULL) {
276276
return NULL;
277277
}
278-
assert(_PyObject_IsUniquelyReferenced(obj));
278+
assert(PyUnstable_Object_IsUniquelyReferenced(obj));
279279

280280
// Deallocate the memory
281281
Py_DECREF(obj);

Modules/_testcapimodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2249,7 +2249,7 @@ test_weakref_capi(PyObject *Py_UNUSED(module), PyObject *Py_UNUSED(args))
22492249
assert(ref == obj);
22502250

22512251
// delete the referenced object: clear the weakref
2252-
assert(_PyObject_IsUniquelyReferenced(obj));
2252+
assert(PyUnstable_Object_IsUniquelyReferenced(obj));
22532253
Py_DECREF(obj);
22542254

22552255
assert(PyWeakref_IsDead(weakref));

Objects/longobject.c

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ _PyLong_Negate(PyLongObject **x_p)
352352
PyLongObject *x;
353353

354354
x = (PyLongObject *)*x_p;
355-
if (_PyObject_IsUniquelyReferenced(x)) {
355+
if (_PyObject_IsUniquelyReferenced((PyObject *)x)) {
356356
_PyLong_FlipSign(x);
357357
return;
358358
}
@@ -3848,7 +3848,7 @@ long_add(PyLongObject *a, PyLongObject *b)
38483848
and thus z must be a multiple-digit int.
38493849
That also means z is not an element of
38503850
small_ints, so negating it in-place is safe. */
3851-
assert(_PyObject_IsUniquelyReferenced(z));
3851+
assert(_PyObject_IsUniquelyReferenced((PyObject *)z));
38523852
_PyLong_FlipSign(z);
38533853
}
38543854
}
@@ -3895,7 +3895,8 @@ long_sub(PyLongObject *a, PyLongObject *b)
38953895
else {
38963896
z = x_add(a, b);
38973897
if (z != NULL) {
3898-
assert(_PyLong_IsZero(z) || _PyObject_IsUniquelyReferenced(z));
3898+
assert(_PyLong_IsZero(z) ||
3899+
_PyObject_IsUniquelyReferenced((PyObject *)z));
38993900
_PyLong_FlipSign(z);
39003901
}
39013902
}
@@ -5487,7 +5488,7 @@ long_lshift1(PyLongObject *a, Py_ssize_t wordshift, digit remshift)
54875488
if (z == NULL)
54885489
return NULL;
54895490
if (_PyLong_IsNegative(a)) {
5490-
assert(_PyObject_IsUniquelyReferenced(z));
5491+
assert(_PyObject_IsUniquelyReferenced((PyObject *)z));
54915492
_PyLong_FlipSign(z);
54925493
}
54935494
for (i = 0; i < wordshift; i++)
@@ -5849,7 +5850,7 @@ _PyLong_GCD(PyObject *aarg, PyObject *barg)
58495850
assert(size_a >= 0);
58505851
_PyLong_SetSignAndDigitCount(c, 1, size_a);
58515852
}
5852-
else if (_PyObject_IsUniquelyReferenced(a)) {
5853+
else if (_PyObject_IsUniquelyReferenced((PyObject *)a)) {
58535854
c = (PyLongObject*)Py_NewRef(a);
58545855
}
58555856
else {
@@ -5863,7 +5864,8 @@ _PyLong_GCD(PyObject *aarg, PyObject *barg)
58635864
assert(size_a >= 0);
58645865
_PyLong_SetSignAndDigitCount(d, 1, size_a);
58655866
}
5866-
else if (_PyObject_IsUniquelyReferenced(b) && size_a <= alloc_b) {
5867+
else if (_PyObject_IsUniquelyReferenced((PyObject *)b) &&
5868+
size_a <= alloc_b) {
58675869
d = (PyLongObject*)Py_NewRef(b);
58685870
assert(size_a >= 0);
58695871
_PyLong_SetSignAndDigitCount(d, 1, size_a);
@@ -6951,7 +6953,7 @@ PyLongWriter_Discard(PyLongWriter *writer)
69516953
}
69526954

69536955
PyLongObject *obj = (PyLongObject *)writer;
6954-
assert(_PyObject_IsUniquelyReferenced(obj));
6956+
assert(_PyObject_IsUniquelyReferenced((PyObject *)obj));
69556957
Py_DECREF(obj);
69566958
}
69576959

@@ -6960,7 +6962,7 @@ PyObject*
69606962
PyLongWriter_Finish(PyLongWriter *writer)
69616963
{
69626964
PyLongObject *obj = (PyLongObject *)writer;
6963-
assert(_PyObject_IsUniquelyReferenced(obj));
6965+
assert(_PyObject_IsUniquelyReferenced((PyObject *)obj));
69646966

69656967
// Normalize and get singleton if possible
69666968
obj = maybe_small_long(long_normalize(obj));

Objects/setobject.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1058,7 +1058,7 @@ set_update_lock_held(PySetObject *so, PyObject *other)
10581058
static int
10591059
set_update_local(PySetObject *so, PyObject *other)
10601060
{
1061-
assert(_PyObject_IsUniquelyReferenced(so));
1061+
assert(_PyObject_IsUniquelyReferenced((PyObject *)so));
10621062
if (PyAnySet_Check(other)) {
10631063
int rv;
10641064
Py_BEGIN_CRITICAL_SECTION(other);
@@ -2444,7 +2444,7 @@ set_init(PyObject *so, PyObject *args, PyObject *kwds)
24442444
if (!PyArg_UnpackTuple(args, Py_TYPE(self)->tp_name, 0, 1, &iterable))
24452445
return -1;
24462446

2447-
if (_PyObject_IsUniquelyReferenced(self) && self->fill == 0) {
2447+
if (_PyObject_IsUniquelyReferenced((PyObject *)self) && self->fill == 0) {
24482448
self->hash = -1;
24492449
if (iterable == NULL) {
24502450
return 0;

Python/marshal.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "pycore_code.h" // _PyCode_New()
1212
#include "pycore_hashtable.h" // _Py_hashtable_t
1313
#include "pycore_long.h" // _PyLong_IsZero()
14+
#include "pycore_object.h" // _PyObject_IsUniquelyReferenced
1415
#include "pycore_pystate.h" // _PyInterpreterState_GET()
1516
#include "pycore_setobject.h" // _PySet_NextEntryRef()
1617
#include "pycore_unicodeobject.h" // _PyUnicode_InternImmortal()

0 commit comments

Comments
 (0)