GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — _PyOS_SigintEvent() is needed for interruptible waiting on main thread · Issue #128684 · python/cpython

_PyOS_SigintEvent() is needed for interruptible waiting on main thread #128684

New issue
Copy link
New issue
Copy link
Open
Open
_PyOS_SigintEvent() is needed for interruptible waiting on main thread#128684
Copy link
Labels
topic-C-APItype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@jbms
jbms
opened on Jan 9, 2025
Issue body actions

Bug report

Bug description:

Moved from #108605 (comment)

In #108605, _PyOS_SigintEvent was removed from the public headers.

TensorStore relies on that function here: https://github.com/google/tensorstore/blob/eda046b10158e7d82fdb0f23aeecdfdeb8ac5aa3/python/tensorstore/future.cc#L105 to enable synchronously blocking on the readiness of a custom Future type while allowing Ctrl+C to interrupt when running on the main thread.

The current workaround is to manually declare the function since the symbol is still available.

I'm not aware of a usable alternative. Since signal.set_wakeup_fd only allows a single fd to be set globally, it isn't usable from a library. The best alternative would probably be to poll by waking up every few hundred milliseconds.

CPython versions tested on:

3.13

Operating systems tested on:

No response

Activity

  1. jbms
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    on Jan 9, 2025
  2. vstinner
    added
    topic-C-API
    on Jan 9, 2025
  3. vstinner commented on Jan 13, 2025

    @vstinner
    vstinner
    on Jan 13, 2025
    Member
    More actions

    TensorStore relies on that function here: https://github.com/google/tensorstore/blob/eda046b10158e7d82fdb0f23aeecdfdeb8ac5aa3/python/tensorstore/future.cc#L105 to enable synchronously blocking on the readiness of a custom Future type while allowing Ctrl+C to interrupt when running on the main thread.

    The problem is that the "sigint event" should not be used in threads other than main. If we add a public function, it should return NULL in this case.

  4. vstinner commented on Feb 6, 2025

    @vstinner
    vstinner
    on Feb 6, 2025
    Member
    More actions

    I found another user of this function by searching for _PyOS_SigintEvent:

    billiard-4.2.1.tar.gz: billiard-4.2.1/Modules/_billiard/win32_functions.c: sigint_event = _PyOS_SigintEvent();
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic-C-APItype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.