mirror of
https://github.com/python/cpython.git
synced 2025-08-22 01:35:16 +00:00
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:
parent
daa9756cb6
commit
d2ec81a8c9
24 changed files with 77 additions and 48 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue