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.

classification
Title: bz2 does not work when threads are disabled
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: amaury.forgeotdarc, georg.brandl, nadeem.vawda, python-dev
Priority: normal Keywords: patch

Created on 2012-01-17 22:20 by amaury.forgeotdarc, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
bz2_nothread.patch amaury.forgeotdarc, 2012-01-17 22:20 review
Messages (5)
msg151491 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2012-01-17 22:20
In bz2.py, "import threading" prevents the bz2 module from working when threads are not enabled.  The attached patch removes the limitation and provides a fake lock object.

I don't know if this should be backported to 3.2.
msg151492 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2012-01-17 22:49
Isn't there already a dummy lock in dummy_threading?
msg151493 - (view) Author: Nadeem Vawda (nadeem.vawda) * (Python committer) Date: 2012-01-17 22:55
As Georg suggested, it would be better to use dummy_threading.RLock,
rather than providing our own implementation.

The test in the patch fails when I try to run it on a no-thread build.
support.import_fresh_module seems to treat the absence of the threading
module as an error, and returns None instead of allowing the bz2 module
to recover from the ImportError.

We needn't worry about 3.2. It still uses the old all-C implementation,
which has its threading dependencies protected by #ifdefs.
msg151497 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-01-17 23:57
New changeset 2fb93282887a by Nadeem Vawda in branch 'default':
Issue #13809: Make bz2 module work with threads disabled.
http://hg.python.org/cpython/rev/2fb93282887a
msg151498 - (view) Author: Nadeem Vawda (nadeem.vawda) * (Python committer) Date: 2012-01-17 23:59
Fix committed. For the test, it turns out we can get the desired behavior
by telling import_fresh_module to block the threading module directly,
instead of blocking _thread.
History
Date User Action Args
2022-04-11 14:57:25adminsetgithub: 58017
2012-01-17 23:59:04nadeem.vawdasetstatus: open -> closed
resolution: fixed
messages: + msg151498

stage: patch review -> resolved
2012-01-17 23:57:43python-devsetnosy: + python-dev
messages: + msg151497
2012-01-17 22:55:38nadeem.vawdasetmessages: + msg151493
2012-01-17 22:49:02georg.brandlsetnosy: + georg.brandl
messages: + msg151492
2012-01-17 22:21:23pitrousetnosy: + nadeem.vawda
2012-01-17 22:20:56amaury.forgeotdarccreate