bpo-39573: Add Py_SET_TYPE() function (GH-18394)
Add Py_SET_TYPE() function to set the type of an object.
This commit is contained in:
@@ -882,10 +882,12 @@ PyWeakref_NewProxy(PyObject *ob, PyObject *callback)
|
||||
if (result != NULL) {
|
||||
PyWeakReference *prev;
|
||||
|
||||
if (PyCallable_Check(ob))
|
||||
Py_TYPE(result) = &_PyWeakref_CallableProxyType;
|
||||
else
|
||||
Py_TYPE(result) = &_PyWeakref_ProxyType;
|
||||
if (PyCallable_Check(ob)) {
|
||||
Py_SET_TYPE(result, &_PyWeakref_CallableProxyType);
|
||||
}
|
||||
else {
|
||||
Py_SET_TYPE(result, &_PyWeakref_ProxyType);
|
||||
}
|
||||
get_basic_refs(*list, &ref, &proxy);
|
||||
if (callback == NULL) {
|
||||
if (proxy != NULL) {
|
||||
|
||||
Reference in New Issue
Block a user