Skip to content

Fix/staticmethod callable python 3 10 #2263#2466

Open
leonor-p wants to merge 2 commits into
3b1b:masterfrom
motamdaniela:fix/staticmethod-callable-python-3-10-#2263
Open

Fix/staticmethod callable python 3 10 #2263#2466
leonor-p wants to merge 2 commits into
3b1b:masterfrom
motamdaniela:fix/staticmethod-callable-python-3-10-#2263

Conversation

@leonor-p
Copy link
Copy Markdown

Motivation

ManimGL fails to import on Python < 3.10 with TypeError: 'staticmethod' object is not callable.

Multiple functions across the codebase are declared with @staticmethod
and then used as decorators on other methods inside the same class body.
Prior to Python 3.10, staticmethod objects were not callable, making
this pattern invalid.

Fixes #2263

Proposed changes

  • Removed @staticmethod from note_undrawn_event in manimlib/window.py
  • Removed @staticmethod from affects_data, affects_family_data, stash_mobject_pointers, affects_shader_info_id in manimlib/mobject/mobject.py
  • Removed @staticmethod from affects_mobject_list in manimlib/scene/scene.py
  • Fixed @lru_cache to @lru_cache() in manimlib/shader_wrapper.py

Test

Code:
python -c "from manimlib import *"

Result: Import completes successfully on Python 3.9.25 with no TypeError.
The ffmpeg RuntimeWarning is expected and unrelated to this fix.

Before:
image

After:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python < 3.10 - TypeError: 'staticmethod' object is not callable

1 participant