microsoft / microsoft/Trace

Trace doesn't work with python 3.13

Open
#43 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
759
Forks
63
PR merge metrics
No merged PRs in 30d

Description

Trace seems to have some error with the bundle decorator when running on python 3.13. Downgrading to 3.12 does not have this error.

Traceback (most recent call last):
File "/Users/ryanrong/Documents/GitHub/cs224n_llm_agent/pong_LLM_agent.py", line 269, in
rewards = optimize_policy(
env_name="ALE/Pong-v5",
...<4 lines>...
model="gpt-4o-mini"
)
File "/Users/ryanrong/Documents/GitHub/cs224n_llm_agent/pong_LLM_agent.py", line 169, in optimize_policy
@trace.bundle(trainable=True)
~~~~^^^^^^^^^^^^^^^^
File "/Users/ryanrong/.pyenv/versions/3.13.1/lib/python3.13/site-packages/opto/trace/bundle.py", line 57, in decorator
fun_module = FunModule(
fun=fun,
...<7 lines>...
_ldict=prev_f_locals, # Get the locals of the calling function
)
File "/Users/ryanrong/.pyenv/versions/3.13.1/lib/python3.13/site-packages/opto/trace/bundle.py", line 114, in init
assert _ldict is None or isinstance(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ldict, dict
^^^^^^^^^^^^
), "_ldict must be a dictionary. or None"
^
AssertionError: _ldict must be a dictionary. or None

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure from pong_LLM_agent.py in optimize_policy, focusing on the @trace.bundle(trainable=True) entry point. Inspect opto/trace/bundle.py around decorator and FunModule initialization, then verify that the call works on Python 3.13 without regressing Python 3.12 behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.