Skip to content

Commit 422c459

Browse files
committed
Sync object.c with CPython
1 parent ec19f54 commit 422c459

File tree

2 files changed

+1886
-165
lines changed

2 files changed

+1886
-165
lines changed

graalpython/com.oracle.graal.python.cext/src/dictobject.c

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -132,47 +132,6 @@ PyObject_GenericGetDict(PyObject *obj, void *context)
132132
return dict;
133133
}
134134

135-
PyObject **
136-
_PyObject_DictPointer(PyObject *obj)
137-
{
138-
Py_ssize_t dictoffset;
139-
PyTypeObject *tp = Py_TYPE(obj);
140-
141-
if (tp->tp_flags & Py_TPFLAGS_MANAGED_DICT) {
142-
return _PyObject_ManagedDictPointer(obj);
143-
}
144-
dictoffset = tp->tp_dictoffset;
145-
if (dictoffset == 0)
146-
return NULL;
147-
if (dictoffset < 0) {
148-
Py_ssize_t tsize = Py_SIZE(obj);
149-
if (tsize < 0) {
150-
tsize = -tsize;
151-
}
152-
size_t size = _PyObject_VAR_SIZE(tp, tsize);
153-
assert(size <= (size_t)PY_SSIZE_T_MAX);
154-
dictoffset += (Py_ssize_t)size;
155-
156-
_PyObject_ASSERT(obj, dictoffset > 0);
157-
_PyObject_ASSERT(obj, dictoffset % SIZEOF_VOID_P == 0);
158-
}
159-
return (PyObject **) ((char *)obj + dictoffset);
160-
}
161-
162-
/* Helper to get a pointer to an object's __dict__ slot, if any.
163-
* Creates the dict from inline attributes if necessary.
164-
* Does not set an exception.
165-
*
166-
* Note that the tp_dictoffset docs used to recommend this function,
167-
* so it should be treated as part of the public API.
168-
*/
169-
PyObject **
170-
_PyObject_GetDictPtr(PyObject *obj)
171-
{
172-
// GraalPy change: we don't have inlined managed dict values, so just use the common path
173-
return _PyObject_DictPointer(obj);
174-
}
175-
176135
/* Taken from CPython */
177136
int
178137
_PyDict_ContainsId(PyObject *op, struct _Py_Identifier *key)

0 commit comments

Comments
 (0)