Skip to content

3.13: Monkey patching broken: '_MainThread' object has no attribute '_tstate_lock': monkey.py, line 826, in patch_thread #2054

@arcivanov

Description

@arcivanov

Found in vivo testing geventmp: https://github.com/karellen/geventmp/actions/runs/10378049652/job/29958033565#step:4:602

 File /home/runner/work/geventmp/geventmp/target/reports/integrationtests/monkey_mp_tests:

File /home/runner/work/geventmp/geventmp/target/reports/integrationtests/monkey_mp_tests.err:
    Traceback (most recent call last):
      File "/home/runner/work/geventmp/geventmp/src/integrationtest/python/monkey_mp_tests.py", line 21, in <module>
        monkey.patch_all()
        ~~~~~~~~~~~~~~~~^^
      File "/opt/hostedtoolcache/Python/3.13.0-rc.2/x64/lib/python3.13/site-packages/gevent/monkey.py", line 1219, in patch_all
        patch_thread(Event=Event, _warnings=_warnings)
        ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/opt/hostedtoolcache/Python/3.13.0-rc.2/x64/lib/python3.13/site-packages/gevent/monkey.py", line 187, in ignores
        return func(*args, **kwargs)
      File "/opt/hostedtoolcache/Python/3.13.0-rc.2/x64/lib/python3.13/site-packages/gevent/monkey.py", line 826, in patch_thread
        main_thread.__real_tstate_lock = main_thread._tstate_lock
                                         ^^^^^^^^^^^^^^^^^^^^^^^^
    AttributeError: '_MainThread' object has no attribute '_tstate_lock'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions