File tree Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -270,17 +270,16 @@ Object Protocol
270270
271271 Raise an :exc: `AttributeError ` if the object has no ``__dict__ ``.
272272
273- This function may also be called to get the :py:attr: `~object.__dict__ `
274- of the object *o *. Pass ``NULL `` for *context * when calling it.
275- Since this function may need to allocate memory for the
276- dictionary, it may be more efficient to call :c:func: `PyObject_GetAttr `
277- when accessing an attribute on the object.
278-
279273 On failure, returns ``NULL `` with an exception set.
280274
281- The :c:func: `PyObject_GetDict ` function is recommended instead of using this
282- function, since it does not raise an exception if the object has no
283- ``__dict__ ``.
275+ To get the ``__dict__ `` of an arbitrary object (that is, when you are not
276+ implementing a getter of a ``__dict__ `` descriptor), prefer using
277+ :c:func:`PyObject_GetDict` instead.
278+ Alternately, use this function and pass ``NULL`` for *context*.
279+
280+ Since this function may need to allocate memory for the
281+ dictionary, it may be more efficient to call :c:func:`PyObject_GetAttr`
282+ when accessing a single attribute on the object.
284283
285284 .. versionadded:: 3.3
286285
You can’t perform that action at this time.
0 commit comments