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 2010年07月13日 19:05 by pitrou, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| mtimport.py | pitrou, 2010年07月13日 19:06 | |||
| Messages (10) | |||
|---|---|---|---|
| msg110219 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2010年07月13日 19:05 | |
The import lock is lacking tests that it functions properly. Coming up with a way of checking it was unexpectedly hard. I finally managed to write a script which quite reliably fails if you patch Python/import.c to not take the import lock. The script relies on garbage collection trickery to release the GIL at arbitrary moments. It should probably be converted to an unit test. |
|||
| msg110226 - (view) | Author: Alyssa Coghlan (ncoghlan) * (Python committer) | Date: 2010年07月13日 20:54 | |
test_threaded_import is designed to check the import lock (and it does at least to some degree - I changed runpy's handling of the import lock because my original approach broke that test). (Haven't looked at this patch in detail as yet) |
|||
| msg110263 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2010年07月14日 10:46 | |
> test_threaded_import is designed to check the import lock (and it does > at least to some degree - I changed runpy's handling of the import > lock because my original approach broke that test). Apparently, Lib/test/test_threaded_import only works if run directly. If run through regrtest, it succeeds even with the import lock disabled (probably because random.py is already included by regrtest). |
|||
| msg110267 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2010年07月14日 11:27 | |
Ok, here is a patch for test_threaded_import that makes it work for regrtest too. I've removed all global variables and converted it to unittest. |
|||
| msg110269 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2010年07月14日 11:57 | |
I've committed the fix in r82885 (3.2) and r82886 (3.1). The reliance on random still looks a bit quirky to me, but at least the test now does what it should do, and has a cleaned up coding style. I'm leaving this issue open, for the other test might be interesting to integrate as well. |
|||
| msg110294 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2010年07月14日 16:11 | |
Here is another patch that also tests that calls to path hooks and meta_path entries are serialized. Again, they pass in normal conditions and fail when the import lock is disabled. |
|||
| msg114540 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2010年08月21日 18:41 | |
Ping? |
|||
| msg114643 - (view) | Author: Alyssa Coghlan (ncoghlan) * (Python committer) | Date: 2010年08月22日 08:24 | |
With the new setUp and tearDown methods, the threadedimp2 patch doesn't apply cleanly any more. Looks good and passes for me - fixed patch attached. Was I meant to still be looking at mtimport or threadimp, or have both of those been applied? |
|||
| msg114658 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2010年08月22日 10:12 | |
> Was I meant to still be looking at mtimport or threadimp, or have both > of those been applied? threadimp has already been committed. As for mtimport, I'll try to refactor it into a proper unit test. |
|||
| msg114662 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2010年08月22日 10:19 | |
The new patch was committed in r84258, thanks Nick. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:03 | admin | set | github: 53497 |
| 2012年05月16日 16:10:58 | pitrou | set | status: open -> closed resolution: fixed stage: needs patch -> resolved |
| 2010年08月22日 10:19:21 | pitrou | set | files: - issue9251_threadimp_py3k_head.patch |
| 2010年08月22日 10:19:18 | pitrou | set | files: - threadimp2.patch |
| 2010年08月22日 10:19:15 | pitrou | set | files: - threadimp.patch |
| 2010年08月22日 10:19:06 | pitrou | set | messages: + msg114662 |
| 2010年08月22日 10:12:47 | pitrou | set | messages: + msg114658 |
| 2010年08月22日 08:24:51 | ncoghlan | set | files:
+ issue9251_threadimp_py3k_head.patch messages: + msg114643 |
| 2010年08月21日 18:41:40 | pitrou | set | messages: + msg114540 |
| 2010年07月14日 16:11:37 | pitrou | set | files:
+ threadimp2.patch messages: + msg110294 |
| 2010年07月14日 11:57:24 | pitrou | set | messages: + msg110269 |
| 2010年07月14日 11:27:10 | pitrou | set | files:
+ threadimp.patch keywords: + patch messages: + msg110267 |
| 2010年07月14日 10:46:00 | pitrou | set | messages: + msg110263 |
| 2010年07月13日 20:54:23 | ncoghlan | set | messages: + msg110226 |
| 2010年07月13日 19:06:59 | pitrou | set | files: + mtimport.py |
| 2010年07月13日 19:06:52 | pitrou | set | files: - mtimport.py |
| 2010年07月13日 19:05:30 | pitrou | create | |