From 94d0a77c4bb02e20800e9d1945d9bd23f7e60db0 Mon Sep 17 00:00:00 2001 From: matanster Date: Fri, 10 May 2024 00:12:02 +0300 Subject: [PATCH] avoid the autological self-reference and provide more direct clarity to ShapeBase.delete() --- pyglet/shapes.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/pyglet/shapes.py b/pyglet/shapes.py index 6a3e39fee..0d2781873 100644 --- a/pyglet/shapes.py +++ b/pyglet/shapes.py @@ -395,12 +395,14 @@ def draw(self) -> None: def delete(self) -> None: """Force immediate removal of the shape from video memory. - You should usually call this whenever you delete a shape. Unless - you are using manual garbage collection, Python might not call - the finalizer as soon as the sprite falls out of scope. - - Manual garbage collection is a very advanced technique. See - Python's :py:mod:`gc` module documentation to learn more. + You should usually call this whenever you no longer need the shape. + Otherwise, Python may call the finalizer of the shape instance only + some time after the shape has fallen out of scope, and the shape's video + memory will not be freed until the finalizer is eventually called by + garbage collection. + + Implementing manual garbage collection may satisfy the same concern + without using the current method, but is a very advanced technique. """ if self._vertex_list is not None: self._vertex_list.delete()