classification
Title: Remove support for threads-less builds
Type: enhancement Stage: resolved
Components: Build, Interpreter Core Versions: Python 3.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Arfrever, Steve Gomez, brian.curtin, christian.heimes, gregory.p.smith, kb1000, pitrou, r.david.murray, serhiy.storchaka, vstinner
Priority: normal Keywords: patch

Created on 2017-09-06 21:10 by pitrou, last changed 2019-07-26 13:14 by kb1000. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 3385 merged pitrou, 2017-09-06 21:11
PR 3482 merged pitrou, 2017-09-10 18:19
PR 3648 merged pitrou, 2017-09-18 17:20
PR 3649 merged pitrou, 2017-09-18 17:35
PR 8805 merged ZackerySpytz, 2018-08-18 12:42
Messages (22)
msg301518 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2017-09-06 21:10
The --without-threads option has a lot of repercussions on the code base, forcing us to maintain specific paths for builds with threads disabled, for no useful purpose.
msg301520 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2017-09-06 21:12
See discussion in https://mail.python.org/pipermail/python-dev/2017-September/149156.html
msg301521 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2017-09-06 21:15
Question: should we keep Modules/Setup.config.in?  It's going to become empty:
https://github.com/python/cpython/blob/master/Modules/Setup.config.in
msg301539 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-09-06 22:58
The PEP 11 should be updated just to mention that platforms without threading support are not supported in Python 3.7.
msg301543 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-09-06 23:23
We had a buildbot testing --without-threads, but it's gone. I just removed its unused class from the buildbot configuration:

https://github.com/python/buildmaster-config/commit/091f52aa05a8977966796ba3ef4b8257bef1c0e9
msg301559 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2017-09-07 00:50
I guess Setup.config.in can go.  It's only purpose was for autoconf driven Setup changes.
msg301595 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-09-07 16:56
New changeset a6a4dc816d68df04a7d592e0b6af8c7ecc4d4344 by Victor Stinner (Antoine Pitrou) in branch 'master':
bpo-31370: Remove support for threads-less builds (#3385)
https://github.com/python/cpython/commit/a6a4dc816d68df04a7d592e0b6af8c7ecc4d4344
msg301596 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-09-07 16:58
PEP 11 was updated, the change was merged, this issue can now be closed. Thanks Antoine!
msg301805 - (view) Author: Arfrever Frehtes Taifersar Arahesis (Arfrever) * (Python triager) Date: 2017-09-10 09:04
Also 'import threading' code in Tools/scripts/run_tests.py should be cleaned.
msg301964 - (view) Author: Arfrever Frehtes Taifersar Arahesis (Arfrever) * (Python triager) Date: 2017-09-12 15:46
Lib/_dummy_thread.py and Lib/dummy_threading.py were deleted, but Doc/library/_dummy_thread.rst and Doc/library/dummy_threading.rst still exist.

Probably Doc/whatsnew/3.7.rst should mention that these modules were deleted.

Or maybe they should be restored and firstly deprecated, before deletion in a later version of Python.
msg301968 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-09-12 16:01
Arfrever: "Lib/_dummy_thread.py and Lib/dummy_threading.py were deleted, but Doc/library/_dummy_thread.rst and Doc/library/dummy_threading.rst still exist."

Ah, it should be deleted as well.

Arfrever: "Probably Doc/whatsnew/3.7.rst should mention that these modules were deleted."

Right.

Arfrever: "Or maybe they should be restored and firstly deprecated, before deletion in a later version of Python."

I don't think that it's worth it, but I suggest to add a warning to Python 3.6 documentation. Something like the following warning in Python 2.7 documentation of the commands module:
"Deprecated since version 2.6: The commands module has been removed in Python 3. Use the subprocess module instead."
https://docs.python.org/2/library/commands.html
msg301971 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-09-12 16:12
Oh, Arfrever wrote me on IRC that the removal of dummy_threading broke portage on Gentoo: https://bugs.gentoo.org/630730

eventlet also uses dummy_threading:

eventlet/support/dns/entropy.py:23:    import dummy_threading as _threading
eventlet/support/dns/resolver.py:29:    import dummy_threading as _threading

Hum, maybe we need one release with the deprecated module, and only remove it in Python 3.8?
msg301973 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2017-09-12 16:23
+1 to restore dummy_threading and go through a proper deprecation phase in 3.7+.

-0 to restore _dummy_thread. It's an internal, private module.
msg301980 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-09-12 17:20
Following lines needs updating:

Lib/importlib/_bootstrap.py:1135
Lib/_pydecimal.py:436
Lib/test/ssl_servers.py:11
Lib/test/support/__init__.py:2053
Lib/test/test_httplib.py:1080
Lib/test/test_idle.py:4
Lib/test/test_multiprocessing_main_handling.py:3
Lib/test/test_thread.py:5
Lib/test/test_threadsignals.py:8
Lib/test/test_tools/test_sundry.py:43
Lib/test/test_winreg.py:7
Lib/test/test_wsgiref.py:256
Lib/test/test_xmlrpc.py:1179
msg301987 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2017-09-12 18:28
dummy_threading should definitely not have been removed, and like all the other APIs should not be removed until 2.7 is dead.  Deprecating it is of course fine :)
msg301988 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2017-09-12 18:31
And actually, I wouldn't be surprised if eventlet depended on the *functionality* in _dummy_threading, so you probably need to restore that, too.
msg302474 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2017-09-18 16:35
> eventlet also uses dummy_threading

Not sure what you mean by that.  eventlet uses the regular try/except import dance around "import threading":

https://github.com/eventlet/eventlet/blob/master/eventlet/support/dns/entropy.py#L20-L23
https://github.com/eventlet/eventlet/blob/master/eventlet/support/dns/resolver.py#L23-L26

As for portage, Arfrever fixed it :-)

https://gitweb.gentoo.org/proj/portage.git/commit/?id=504f66b0e25281e4465ebeceb799c3e54ff2b884

That said, I am not against bringing dummy_threading back, though it would sound rather weird to use it unconditionally...
msg302476 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2017-09-18 17:21
https://github.com/python/cpython/pull/3648 restores dummy_threading and _dummy_thread, but deprecates them.
msg302484 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2017-09-18 20:04
New changeset b43c4caf81b10e5c7ebaeb3a712c6db584f60bbd by Antoine Pitrou in branch 'master':
Restore dummy_threading and _dummy_thread, but deprecate them (bpo-31370) (#3648)
https://github.com/python/cpython/commit/b43c4caf81b10e5c7ebaeb3a712c6db584f60bbd
msg302492 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2017-09-18 21:50
New changeset 88c60c9668f0aa732693517a60b851cc1dfce0cb by Antoine Pitrou in branch 'master':
Trivial cleanups following bpo-31370 (#3649)
https://github.com/python/cpython/commit/88c60c9668f0aa732693517a60b851cc1dfce0cb
msg326681 - (view) Author: Brian Curtin (brian.curtin) * (Python committer) Date: 2018-09-29 16:07
New changeset eef059657d6b10babdb4831e1148d60cc644ee9a by Brian Curtin (Zackery Spytz) in branch 'master':
bpo-31370: Remove references to threadless builds (#8805)
https://github.com/python/cpython/commit/eef059657d6b10babdb4831e1148d60cc644ee9a
msg348490 - (view) Author: Kaeptm Blaubaer (kb1000) * Date: 2019-07-26 13:14
Unfortunately, this also leads to less good LTO if you use a single static executable, similar to what Tools/freeze produces but including libpython itself. I'm currently trying to make LLVM do that, but since I can't build without threads, it'd be extremely hard to tell it that it can remove all threading related things (like TLS) and inline them. This means I'll have to patch CPython on my own to remove thread support, but unfortunately this also means I can't guarantee that it continues to work, as well as that it makes it a lot more likely that my build won't support many third-party libraries.
History
Date User Action Args
2019-07-26 13:14:44kb1000setnosy: + kb1000
messages: + msg348490
2018-09-29 16:07:19brian.curtinsetnosy: + brian.curtin
messages: + msg326681
2018-08-18 12:42:04ZackerySpytzsetpull_requests: + pull_request8282
2017-11-03 06:42:40berker.peksagsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2017-11-03 06:42:11berker.peksagsetmessages: - msg302490
2017-09-18 21:50:45pitrousetmessages: + msg302492
2017-09-18 21:05:40Steve Gomezsetnosy: + Steve Gomez
messages: + msg302490
2017-09-18 20:04:27pitrousetmessages: + msg302484
2017-09-18 17:35:25pitrousetstage: resolved -> patch review
pull_requests: + pull_request3642
2017-09-18 17:21:41pitrousetmessages: + msg302476
stage: patch review -> resolved
2017-09-18 17:20:23pitrousetkeywords: + patch
stage: resolved -> patch review
pull_requests: + pull_request3641
2017-09-18 16:35:40pitrousetmessages: + msg302474
2017-09-12 18:31:14r.david.murraysetmessages: + msg301988
2017-09-12 18:28:57r.david.murraysetnosy: + r.david.murray
messages: + msg301987
2017-09-12 17:20:52serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg301980
2017-09-12 16:23:32christian.heimessetnosy: + christian.heimes
messages: + msg301973
2017-09-12 16:12:39vstinnersetmessages: + msg301971
2017-09-12 16:01:25vstinnersetmessages: + msg301968
2017-09-12 15:46:06Arfreversetstatus: closed -> open
resolution: fixed -> (no value)
messages: + msg301964
2017-09-10 18:19:37pitrousetpull_requests: + pull_request3472
2017-09-10 09:04:50Arfreversetnosy: + Arfrever
messages: + msg301805
2017-09-07 16:58:45vstinnersetstatus: open -> closed
resolution: fixed
messages: + msg301596

stage: patch review -> resolved
2017-09-07 16:56:26vstinnersetmessages: + msg301595
2017-09-07 00:50:54gregory.p.smithsetmessages: + msg301559
2017-09-06 23:23:08vstinnersetmessages: + msg301543
2017-09-06 22:58:47vstinnersetmessages: + msg301539
2017-09-06 21:15:49pitrousetstage: needs patch -> patch review
2017-09-06 21:15:38pitrousetmessages: + msg301521
2017-09-06 21:12:43pitrousetmessages: + msg301520
2017-09-06 21:11:07pitrousetpull_requests: + pull_request3398
2017-09-06 21:10:49pitroucreate