summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--Completion/Unix/Type/_python_modules6
2 files changed, 7 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 86cd9a3bd..15acc1b6a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-07-26  Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
+
+	* Antony Lee: 35899: Completion/Unix/Type/_python_modules:
+	faster method of generating list of python modules
+
 2015-07-25  Barton E. Schaefer  <schaefer@zsh.org>
 
 	* unposted: Functions/Prompts/prompt_bart_setup: add RPS2 handling,
diff --git a/Completion/Unix/Type/_python_modules b/Completion/Unix/Type/_python_modules
index b30848d83..e82f8efbf 100644
--- a/Completion/Unix/Type/_python_modules
+++ b/Completion/Unix/Type/_python_modules
@@ -26,10 +26,8 @@ _python_modules () {
   if ( [[ ${(P)+array_name} -eq 0 ]] || _cache_invalid $cache_id ) &&
       ! _retrieve_cache $cache_id; then
 
-    local script='import sys, pydoc
-def f(p,m,d):
-    if m.find(".") < 0: sys.stdout.write(m+"\n")
-pydoc.ModuleScanner().run(f)'
+   local script='import pkgutil
+for importer, name, ispkg in pkgutil.iter_modules(): print(name)'
 
     typeset -agU $array_name
     set -A $array_name \