Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f66cb5d

Browse files
committed
Corrected an error in the information on supporting weak references in
extension types (the docs reflected a development version of the API). This closes SF bug #435066.
1 parent 9ca78ac commit f66cb5d

1 file changed

Lines changed: 7 additions & 9 deletions

File tree

Doc/lib/libweakref.tex

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -226,28 +226,26 @@ \subsection{Weak References in Extension Types
226226
0,
227227
"instance",
228228
229-
/* lots of stuff omitted for brevity */
229+
/* Lots of stuff omitted for brevity... */
230230
231231
offsetof(PyInstanceObject, in_weakreflist) /* tp_weaklistoffset */
232232
};
233233
\end{verbatim}
234234

235235
The only further addition is that the destructor needs to call the
236-
weak reference manager to clear any weak references and return if the
237-
object has been resurrected. This needs to occur before any other
238-
parts of the destruction have occurred:
236+
weak reference manager to clear any weak references. This should be
237+
done before any other parts of the destruction have occurred:
239238

240239
\begin{verbatim}
241240
static void
242241
instance_dealloc(PyInstanceObject *inst)
243242
{
244-
/* allocate tempories if needed, but do not begin
245-
destruction here
243+
/* Allocate tempories if needed, but do not begin
244+
destruction just yet.
246245
*/
247246
248-
if (!PyObject_ClearWeakRefs((PyObject *) inst))
249-
return;
247+
PyObject_ClearWeakRefs((PyObject *) inst);
250248
251-
/* proceed with object destuction normally */
249+
/* Proceed with object destuction normally. */
252250
}
253251
\end{verbatim}

0 commit comments

Comments
 (0)