You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
sub-interpreters: datetime segfaults if imported from two sub-interpreters #110415
The datetime module is not fully isolated. I started working on it last year, but I took a break from module isolation work around the 3.12 feature freeze, and I haven't found the energy needed to restart that work. You can take a look at the existing issue/PR:
The major pain point of isolating _datetime is that it has an exposed C API (though datetime.h, which must be explicitly included). I discussed this with @pganssle at the Language Summit and it was not immediately obvious if the datetime.h C API is bound by PEP-387 in the same way API exposed by Python.h is. This point must be resolved before the _datetime module can be completely isolated.
Also, I prefer a more structured approach similar to my draft PR; a large scale change like #110420 is not optimal wrt. debugging and bisecting. I prefer to implement such changes in more manageable batches. See for example the PRs related to isolating _io, _sqlite, or _decimal.
Well, you might want to ask the Steering Council for confirmation, but if third-party libraries are expected to use it, then I'd call it C-API -- which means it's covered by PEP-387.
Meta: either we close this issue as a duplicate and continue the discussion on the original issue (gh-71587), or we close the original issue as superseded. I'm +1 for the former.
I couldn't find the old bug when I had looked for one, and this was a nice excuse for me to dip my toes in the code a little bit.
Very happy to wait for the old issue/PR to be resurrected. I was considering sub-interpreters for something we wanted to do at work, but there's sadly far too many blockers like this for that to be feasible right now.
Also happy to contribute in the other discussion in my own time, I find the isolated sub-interpreters to be quite a promising idea.
I couldn't find the old bug when I had looked for one [...]
Well, it is not easy to spot the old issue; the symptom is not the same, but OTOH the prescription is :) I started working with Victor on the old PR. It should be possible to split it up in manageable sizes relatively quickly. I'll ping you if you want to join.
Activity
gaogaotiantian commentedon Oct 5, 2023
Sorry but this does not look like a bug report. The content of the issue is a bit unrelated to the title.
Could you paste your code in a minimum reproducible example so we can track it down?
costasgambit commentedon Oct 5, 2023
Sorry @gaogaotiantian, here is a bit of code that should demonstrate the segfault on 3.12+:
gaogaotiantian commentedon Oct 5, 2023
I'm not able to repro it with
3.12.0+ WSL(Ubuntu 20.04). Are you using the official release? What's yourpython -V?gaogaotiantian commentedon Oct 5, 2023
I am able to repro it on
mainwith--with-pydebug.costasgambit commentedon Oct 5, 2023
Python 3.12.0+, but main is the same.If you scan over
_datetime_exec()you'll see there's global state everywhere.erlend-aasland commentedon Oct 6, 2023
The datetime module is not fully isolated. I started working on it last year, but I took a break from module isolation work around the 3.12 feature freeze, and I haven't found the energy needed to restart that work. You can take a look at the existing issue/PR:
_datetime#102995erlend-aasland commentedon Oct 6, 2023
Duplicate of #71587
erlend-aasland commentedon Oct 6, 2023
The major pain point of isolating
_datetimeis that it has an exposed C API (though datetime.h, which must be explicitly included). I discussed this with @pganssle at the Language Summit and it was not immediately obvious if the datetime.h C API is bound by PEP-387 in the same way API exposed by Python.h is. This point must be resolved before the_datetimemodule can be completely isolated.erlend-aasland commentedon Oct 6, 2023
Also, I prefer a more structured approach similar to my draft PR; a large scale change like #110420 is not optimal wrt. debugging and bisecting. I prefer to implement such changes in more manageable batches. See for example the PRs related to isolating
_io,_sqlite, or_decimal.encukou commentedon Oct 6, 2023
Well, you might want to ask the Steering Council for confirmation, but if third-party libraries are expected to use it, then I'd call it C-API -- which means it's covered by PEP-387.
erlend-aasland commentedon Oct 6, 2023
Meta: either we close this issue as a duplicate and continue the discussion on the original issue (gh-71587), or we close the original issue as superseded. I'm +1 for the former.
costasgambit commentedon Oct 6, 2023
I couldn't find the old bug when I had looked for one, and this was a nice excuse for me to dip my toes in the code a little bit.
Very happy to wait for the old issue/PR to be resurrected. I was considering sub-interpreters for something we wanted to do at work, but there's sadly far too many blockers like this for that to be feasible right now.
Also happy to contribute in the other discussion in my own time, I find the isolated sub-interpreters to be quite a promising idea.
erlend-aasland commentedon Oct 6, 2023
Well, it is not easy to spot the old issue; the symptom is not the same, but OTOH the prescription is :) I started working with Victor on the old PR. It should be possible to split it up in manageable sizes relatively quickly. I'll ping you if you want to join.