Skip to content

Conversation

@EugeneJinXin
Copy link
Contributor

@EugeneJinXin EugeneJinXin force-pushed the xin/improve-unnamed-runtree-naming branch from c962563 to 431ceae Compare November 13, 2025 21:41
values["name"] = "Unnamed"
name = None
try:
import inspect
Copy link
Collaborator

Choose a reason for hiding this comment

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

Imports like this should be top level right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it should be rare case we even need to enter "make a name" mode. so i don't worry too much about perf.
yeah inspect can go to top

import os

# Look up the stack, skipping internal frames
for frame_info in inspect.stack()[1:8]:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Any perf concerns here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it should be rare case we even need to enter "make a name" mode. i.e, this conditoin should not be entered.
so i don't worry too much about perf.

name = frame_locals["self"].__class__.__name__
break
elif "cls" in frame_locals:
name = frame_locals["cls"].__name__
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't know enough about Python to know if this is a good idea

Is there no easier fallback?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

there's try catch so at least it won't error, no better fallback afaik

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.

3 participants