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.

Author serhiy.storchaka
Recipients brett.cannon, eric.snow, ncoghlan, serhiy.storchaka
Date 2018-02-25.08:46:54
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
The proposed PR optimizes "from ... import ..." from non-package modules.

$ ./python -m perf timeit 'from locale import getlocale'
Unpatched:  Mean +- std dev: 811 ns +- 27 ns
Patched:    Mean +- std dev: 624 ns +- 17 ns

Currently _bootstrap._handle_fromlist() is called which does nothing if the module is not a package, but adds an overhead of calling a Python function. The PR moves this check out of _handle_fromlist and avoid calling it if not needed.
Date User Action Args
2018-02-25 08:46:54serhiy.storchakasetrecipients: + serhiy.storchaka, brett.cannon, ncoghlan, eric.snow
2018-02-25 08:46:54serhiy.storchakasetmessageid: <>
2018-02-25 08:46:54serhiy.storchakalinkissue32946 messages
2018-02-25 08:46:54serhiy.storchakacreate