Skip to content

Some Pygame types do not support weak referencing #3585

@cherez

Description

@cherez

Some Pygame types do not support weak references, which can be an obstacle in some use cases such as caching:

  File "/usr/lib/python3.13/weakref.py", line 348, in __new__
    self = ref.__new__(type, ob, callback)
TypeError: cannot create weak reference to 'pygame._sdl2.video.Texture' object
  File "/usr/lib/python3.13/weakref.py", line 348, in __new__
    self = ref.__new__(type, ob, callback)
TypeError: cannot create weak reference to 'pygame.freetype.Font' object

Similar classes (pygame.Surface and pygame.Font for example) do support weak referencing, so I would suggest more consistently supporting it. Would a PR for this be welcome?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions