[issue37088] Add a way to schedule a function to be called from the main thread

2020-02-11 Thread Yury Selivanov
Yury Selivanov added the comment: > I'm not strongly against the feature. I first proposed to expose it, but make > it private. Almost one year later, the PR was not updated. So I just closed > the PR and the issue. All clear, Victor. Let's keep this closed. The reason I didn't reply is

[issue37088] Add a way to schedule a function to be called from the main thread

2020-02-11 Thread STINNER Victor
STINNER Victor added the comment: > NP, here, but, hm, can you unilaterally reject features now? :) Eric Snow and me are basically against the idea of exposing the "pending calls" mechanism in Python, since it's fragile and dangerous. Andrew Sveltov wrote "@vstinner had objections, perhaps

[issue37088] Add a way to schedule a function to be called from the main thread

2020-02-11 Thread Yury Selivanov
Yury Selivanov added the comment: > There is not clear rationale to justify the addition of the function Yeah, with the new threaded watcher being the default we don't need this anymore. > so I reject the feature NP, here, but, hm, can you unilaterally reject features now? :) --

[issue37088] Add a way to schedule a function to be called from the main thread

2020-02-07 Thread STINNER Victor
STINNER Victor added the comment: There is not clear rationale to justify the addition of the function, so I reject the feature. If you are still interesting by the function, please elaborate the rationale. -- resolution: -> rejected stage: patch review -> resolved status: open ->

[issue37088] Add a way to schedule a function to be called from the main thread

2019-05-29 Thread Yury Selivanov
Yury Selivanov added the comment: Eric, regarding signals no longer using pending calls -- interesting, I'll take a look. Thanks for pointing this out. Sent from my iPhone -- ___ Python tracker

[issue37088] Add a way to schedule a function to be called from the main thread

2019-05-29 Thread STINNER Victor
STINNER Victor added the comment: I dislike pending calls. It is a weird beast which complicates ceval.c. I would prefer to remove it. It is no longer needed to handle signals! At least, it sounds like a bad idea to me to expose it in Python in a public API. If you really need it, hide it

[issue37088] Add a way to schedule a function to be called from the main thread

2019-05-29 Thread Eric Snow
Eric Snow added the comment: If this is about signals, it isn't enough just to run on the main thread. It also has to be the main interpreter. -- ___ Python tracker ___

[issue37088] Add a way to schedule a function to be called from the main thread

2019-05-29 Thread Eric Snow
Eric Snow added the comment: > Well, it's absolutely the same mechanism that signal handlers use. Antoine changed signals a while back so they no longer use the pending calls machinery. -- ___ Python tracker

[issue37088] Add a way to schedule a function to be called from the main thread

2019-05-29 Thread Yury Selivanov
Yury Selivanov added the comment: > As to exposing Py_AddPendingCall() as sys.addpendingcall, that might be > opening a can of worms. Injecting code into the eval loop at some arbitrary > ("soon") future time requires care and the code isn't well exercised > historically (much like

[issue37088] Add a way to schedule a function to be called from the main thread

2019-05-29 Thread Eric Snow
Eric Snow added the comment: Note that I'm working on making pending calls per-interpreter (see issue #33608 and https://github.com/python/cpython/pull/12360 (since reverted)). As to exposing Py_AddPendingCall() as sys.addpendingcall, that might be opening a can of worms. Injecting code

[issue37088] Add a way to schedule a function to be called from the main thread

2019-05-29 Thread Yury Selivanov
New submission from Yury Selivanov : When asyncio event loop is created in a non-main thread, it needs to initialize a so called ChildWatcher for it (a helper object to intercept subprocesses exits). Doing that requires to run code in the main thread. I propose to add a 'sys.addpendingcall'

[issue37088] Add a way to schedule a function to be called from the main thread

2019-05-29 Thread Yury Selivanov
Change by Yury Selivanov : -- keywords: +patch pull_requests: +13550 stage: -> patch review pull_request: https://github.com/python/cpython/pull/13656 ___ Python tracker ___