File tree 1 file changed +4
-4
lines changed 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -90,7 +90,7 @@ free_list_items(PyObject** items, bool use_qsbr)
90
90
static int
91
91
list_resize (PyListObject * self , Py_ssize_t newsize )
92
92
{
93
- Py_ssize_t new_allocated ;
93
+ size_t new_allocated ;
94
94
Py_ssize_t allocated = self -> allocated ;
95
95
96
96
/* Bypass realloc() when a previous overallocation is large enough
@@ -138,11 +138,11 @@ list_resize(PyListObject *self, Py_ssize_t newsize)
138
138
}
139
139
PyObject * * old_items = self -> ob_item ;
140
140
if (self -> ob_item ) {
141
- if (allocated < new_allocated ) {
142
- memcpy (& array -> ob_item , self -> ob_item , allocated * sizeof (PyObject * ));
141
+ if (new_allocated < ( size_t ) allocated ) {
142
+ memcpy (& array -> ob_item , self -> ob_item , new_allocated * sizeof (PyObject * ));
143
143
}
144
144
else {
145
- memcpy (& array -> ob_item , self -> ob_item , new_allocated * sizeof (PyObject * ));
145
+ memcpy (& array -> ob_item , self -> ob_item , allocated * sizeof (PyObject * ));
146
146
}
147
147
}
148
148
_Py_atomic_store_ptr_release (& self -> ob_item , & array -> ob_item );
You can’t perform that action at this time.
0 commit comments