From d95e23a7f443aff803ae2cee4c4b01b26883fad3 Mon Sep 17 00:00:00 2001 From: shenjack <3695888@qq.com> Date: Wed, 5 Apr 2023 19:38:31 +0800 Subject: [PATCH] fetch up pyglet [build skip] --- libs/pyglet/shapes.py | 6 ++++++ libs/pyglet/sprite.py | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/libs/pyglet/shapes.py b/libs/pyglet/shapes.py index 08a25cc..8ae19c3 100644 --- a/libs/pyglet/shapes.py +++ b/libs/pyglet/shapes.py @@ -239,6 +239,12 @@ class ShapeBase(ABC): self._group.unset_state_recursive() def delete(self): + """Force immediate removal of the shape from video memory. + + It is recommended to call this whenever you delete a shape, + as the Python garbage collector will not necessarily call the + finalizer as soon as the sprite falls out of scope. + """ self._vertex_list.delete() self._vertex_list = None diff --git a/libs/pyglet/sprite.py b/libs/pyglet/sprite.py index 31ad3e2..300a8bd 100644 --- a/libs/pyglet/sprite.py +++ b/libs/pyglet/sprite.py @@ -323,9 +323,9 @@ class Sprite(event.EventDispatcher): def delete(self): """Force immediate removal of the sprite from video memory. - This is often necessary when using batches, as the Python garbage - collector will not necessarily call the finalizer as soon as the - sprite is garbage. + It is recommended to call this whenever you delete a sprite, + as the Python garbage collector will not necessarily call the + finalizer as soon as the sprite falls out of scope. """ if self._animation: clock.unschedule(self._animate)