Message416694
| Author |
mbadaire |
| Recipients |
asvetlov, mbadaire, yselivanov |
| Date |
2022年04月04日.19:57:07 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1649102228.02.0.401912675697.issue47219@roundup.psfhosted.org> |
| In-reply-to |
| Content |
Hi,
I have an issue when using asyncio and two interpreter instances each launched and used in a seperated thread.
I am getting a asyncio loop for each thread .However asyncio is getting me the same loop because of this code in get_running_loop. Indeed when I have two interpreter, the ts_id would be the same for both my threads and therefore I will get the cached value of the first thread. cached_running_holder being static, it is the same value for all instances of interpreter.
Maybe we should check if we are in the same interpreter or same thread ,.. I am not sure how it could be fixed.
_asynciomodule.c:
get_running_loop(PyObject **loop)
{
PyObject *rl;
PyThreadState *ts = _PyThreadState_GET();
uint64_t ts_id = PyThreadState_GetID(ts);
if (ts_id == cached_running_holder_tsid && cached_running_holder != NULL) {
If it does not make sense, I have some sample code but it is not just 10 lines. |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2022年04月04日 19:57:08 | mbadaire | set | recipients:
+ mbadaire, asvetlov, yselivanov |
| 2022年04月04日 19:57:08 | mbadaire | set | messageid: <1649102228.02.0.401912675697.issue47219@roundup.psfhosted.org> |
| 2022年04月04日 19:57:08 | mbadaire | link | issue47219 messages |
| 2022年04月04日 19:57:07 | mbadaire | create |
|