| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
The job fails with: Error: Label error. Requires exactly 1 of: awaiting merge. Found: type-feature, awaiting core review, interpreter-core, topic-C-API I don't understand this error. Let me try to close/reopen the PR to try to repair the CI. |
Sorry, something went wrong.
|
I added the awaiting merge label to work around the CI issue. |
Sorry, something went wrong.
|
Can those users switch to PyObject_GenericGetDict, or be better served by a variant of PyObject_GenericGetDict that doesn't raise for the “no __dict__” case? |
Sorry, something went wrong.
It seems like PyObject** is needed. SWIG generates code which writes into the PyObject **dict_ptr: #if !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
PyObject **dictptr = _PyObject_GetDictPtr(inst);
if (dictptr != NULL) {
PyObject *dict = *dictptr;
if (dict == NULL) {
dict = PyDict_New();
*dictptr = dict;
}
if (dict) {
PyDict_SetItem(dict, SWIG_This(), swig_this);
} else{
Py_DECREF(inst);
inst = 0;
}
}
#else
if (PyObject_SetAttr(inst, SWIG_This(), swig_this) == -1) {
Py_DECREF(inst);
inst = 0;
}
#endifpybind11 also writes into the PyObject **dict_ptr: PyObject **dict_ptr = _PyObject_GetDictPtr(self);
if (dict_ptr) {
Py_CLEAR(*dict_ptr);
}Obviously, there are other usages which only read the dictionary. Example from pybind11: PyObject *&dict = *_PyObject_GetDictPtr(self);
Py_VISIT(dict); |
Sorry, something went wrong.
That comes up because of the type-feature label, because of the plan to make core review required for new features, but I don't know what happened to that. |
Sorry, something went wrong.
| @@ -1550,18 +1571,12 @@ _PyObject_ComputedDictPointer(PyObject *obj) | |||
| PyObject ** | |||
| _PyObject_GetDictPtr(PyObject *obj) | |||
There was a problem hiding this comment.
Should this be deprecated?
Sorry, something went wrong.
I don't think Swig uses that code path for Python 3: |
Sorry, something went wrong.
|
Making this API a public function seems to be a bad idea: #139852 (comment). I prefer to close this PR for now. I proposed #139968 to add PyObject_GetDict() function instead. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
📚 Documentation preview 📚: https://cpython-previews--139854.org.readthedocs.build/