Skip to content

Fix traceback in threads when SetTrace used. - #2075

Merged
slozier merged 2 commits into
IronLanguages:mainfrom
mickp:map/2072_FixSetTraceStack
Sep 30, 2026
Merged

slozier merged 2 commits into
IronLanguages:mainfrom
mickp:map/2072_FixSetTraceStack

Conversation

@mickp

@mickp mickp commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Testing

The following script returns normamly, where previously it encountered: ValueError: call stack is not deep enough.

import sys
import threading
import typing

def tracer(frame, event, arg):
    return tracer

def do_check():
    isinstance(None, typing.Iterable)

sys.settrace(tracer)

t = threading.Thread(target=do_check)
t.start()
t.join()

Testing
===
The following script returns normamly, where previously it encountered: `ValueError: call stack is not deep enough`.

```
import sys
import threading
import typing

def tracer(frame, event, arg):
    return tracer

def do_check():
    isinstance(None, typing.Iterable)

sys.settrace(tracer)

t = threading.Thread(target=do_check)
t.start()
t.join()
```
@mickp

mickp commented Jul 16, 2026

Copy link
Copy Markdown
Contributor Author

Resolves #2072

@mickp

mickp commented Jul 16, 2026 •

Copy link
Copy Markdown
Contributor Author

I think the CI tests are failing here, for each configuration.

image

I see that fail intermittently when I test locally.

When I attach the debugger, the pass rate may be higher, and I see occasional failures at the location above, and here:

image

@slozier

slozier commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Thanks for the PR! Will be a couple weeks before I have time to properly look at this.

@mickp

mickp commented Jul 16, 2026 •

Copy link
Copy Markdown
Contributor Author

I think this addresses the root cause of the call stack loss in threads, but I can not figure out how the change is getting hit to cause that one test failure in all runtime targets.

@slozier

slozier commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

@mickp I finally got around to looking at this, apologies that it took a while. It was an issue with counting listeners. I pushed a fix along with some tests.

@slozier slozier left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the PR!

@slozier
slozier merged commit f686b6b into IronLanguages:main Sep 30, 2026
26 checks passed
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.

2 participants