This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2013年11月13日 21:49 by vstinner, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| PyGILState_Ensure.patch | vstinner, 2013年11月14日 08:28 | review | ||
| Messages (8) | |||
|---|---|---|---|
| msg202787 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2013年11月13日 21:49 | |
While working on a unit test for the issue #14432, I hit a bug. My C thread got the GIL with PyGILState_Ensure(), but it was strange because the main Python thread also had the GIL... Then I saw that gil_created() returned false. The solution is to call PyEval_InitThreads() to create the GIL. I was reading "Non-Python created threads" documentation, but this section doesn't mention PyEval_InitThreads(). I don't know if it's something new in Python 3.2 with the new GIL. |
|||
| msg202815 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2013年11月14日 01:39 | |
Perhaps we can fix PyGILState to call PyEval_InitThreads automatically? |
|||
| msg202821 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2013年11月14日 08:28 | |
> Perhaps we can fix PyGILState to call PyEval_InitThreads automatically? Yes, I had the same idea. Here is a patch to call PyEval_InitThreads() in PyGILState_Ensure() for new threads. |
|||
| msg205999 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2013年12月13日 00:35 | |
So Antoine, what do you think of the fix? |
|||
| msg206000 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2013年12月13日 00:36 | |
Looks good to me. |
|||
| msg206002 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2013年12月13日 00:48 | |
New changeset dc4e805ec68a by Victor Stinner in branch 'default': Close #19576: PyGILState_Ensure() now initializes threads. At startup, Python http://hg.python.org/cpython/rev/dc4e805ec68a |
|||
| msg217860 - (view) | Author: Jiong Du (lolynx) | Date: 2014年05月04日 07:42 | |
this patch made a new issue<20891> |
|||
| msg257426 - (view) | Author: (tzickel) * | Date: 2016年01月03日 19:08 | |
I think that the document regarding PyGILState_Ensure and PyEval_InitThreads should be clarified better, written in issue #26003 |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:53 | admin | set | github: 63775 |
| 2016年01月03日 19:08:17 | tzickel | set | nosy:
+ tzickel messages: + msg257426 |
| 2014年05月04日 07:42:40 | lolynx | set | nosy:
+ lolynx messages: + msg217860 |
| 2013年12月13日 00:48:00 | python-dev | set | status: open -> closed nosy: + python-dev messages: + msg206002 resolution: fixed stage: resolved |
| 2013年12月13日 00:36:30 | pitrou | set | messages: + msg206000 |
| 2013年12月13日 00:35:36 | vstinner | set | messages: + msg205999 |
| 2013年11月14日 08:28:02 | vstinner | set | files:
+ PyGILState_Ensure.patch keywords: + patch messages: + msg202821 |
| 2013年11月14日 01:39:23 | pitrou | set | messages: + msg202815 |
| 2013年11月13日 21:49:30 | vstinner | create | |