Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions python/tank/platform/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import pprint
import traceback
import inspect
import warnings
import weakref
import threading

Expand Down Expand Up @@ -294,6 +295,16 @@ def __repr__(self):
self.__env.name,
)

def __getattribute__(self, attr):
if attr == "init_engine":
warnings.warn(
f"The method Engine.init_engine is deprecated and will be removed in future versions. "
f"Please use pre_app_init instead.",
DeprecationWarning,
)

return super().__getattribute__(attr)

Comment on lines +298 to +307
Copy link

Copilot AI Oct 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The __getattribute__ method is called for every attribute access on Engine instances, which could impact performance. Consider using a decorator on the init_engine method itself or checking if the attribute exists before issuing the warning to avoid unnecessary overhead for non-existent attributes.

Suggested change
def __getattribute__(self, attr):
if attr == "init_engine":
warnings.warn(
f"The method Engine.init_engine is deprecated and will be removed in future versions. "
f"Please use pre_app_init instead.",
DeprecationWarning,
)
return super().__getattribute__(attr)
# Removed __getattribute__ override. Deprecation warning will be added to init_engine.

Copilot uses AI. Check for mistakes.
##########################################################################################
# properties used by internal classes, not part of the public interface

Expand Down
Loading