mirror of
https://github.com/python/cpython.git
synced 2025-09-17 22:20:23 +00:00
[3.11] GH-92898: Make _Py_Cast C++ version compatible with cast operator (gh-92951) (gh-93049)
This commit is contained in:
parent
d9a48d2b41
commit
dd923c5725
2 changed files with 35 additions and 2 deletions
|
@ -40,6 +40,15 @@ test_api_casts(PyObject *Py_UNUSED(module), PyObject *Py_UNUSED(args))
|
|||
PyTypeObject *type = Py_TYPE(const_obj);
|
||||
assert(Py_REFCNT(const_obj) >= 1);
|
||||
|
||||
struct PyObjectProxy {
|
||||
PyObject* obj;
|
||||
operator PyObject *() { return obj; }
|
||||
} proxy_obj = { obj };
|
||||
Py_INCREF(proxy_obj);
|
||||
Py_DECREF(proxy_obj);
|
||||
assert(Py_REFCNT(proxy_obj) >= 1);
|
||||
|
||||
|
||||
assert(type == &PyTuple_Type);
|
||||
assert(PyTuple_GET_SIZE(const_obj) == 2);
|
||||
PyObject *one = PyTuple_GET_ITEM(const_obj, 0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue