PyObject *callback);
PyAPI_FUNC(PyObject *) PyWeakref_GetObject(PyObject *ref);
-PyAPI_FUNC(long) _PyWeakref_GetWeakrefCount(PyWeakReference *head);
+PyAPI_FUNC(Py_ssize_t) _PyWeakref_GetWeakrefCount(PyWeakReference *head);
PyAPI_FUNC(void) _PyWeakref_ClearRef(PyWeakReference *self);
Core and builtins
-----------------
+- _PyWeakref_GetWeakrefCount() now returns a Py_ssize_t, it previously
+ returned a long (see PEP 353).
+
- Bug #1515471: string.replace() accepts character buffers again.
- Add PyErr_WarnEx() so C code can pass the stacklevel to warnings.warn().
if (PyType_SUPPORTS_WEAKREFS(object->ob_type)) {
PyWeakReference **list = GET_WEAKREFS_LISTPTR(object);
- result = PyInt_FromLong(_PyWeakref_GetWeakrefCount(*list));
+ result = PyInt_FromSsize_t(_PyWeakref_GetWeakrefCount(*list));
}
else
result = PyInt_FromLong(0);
if (PyType_SUPPORTS_WEAKREFS(object->ob_type)) {
PyWeakReference **list = GET_WEAKREFS_LISTPTR(object);
- long count = _PyWeakref_GetWeakrefCount(*list);
+ Py_ssize_t count = _PyWeakref_GetWeakrefCount(*list);
result = PyList_New(count);
if (result != NULL) {
PyWeakReference *current = *list;
- long i;
+ Py_ssize_t i;
for (i = 0; i < count; ++i) {
PyList_SET_ITEM(result, i, (PyObject *) current);
Py_INCREF(current);