[Python-checkins] cpython: Issue #15508: Fix the docstring for __import__ to not mention negative

brett.cannon python-checkins at python.org
Mon Jul 30 23:46:03 CEST 2012


http://hg.python.org/cpython/rev/2a4ca86cc2b7
changeset:   78338:2a4ca86cc2b7
parent:      78336:2f3ccf4ec193
user:        Brett Cannon <brett at python.org>
date:        Mon Jul 30 17:45:54 2012 -0400
summary:
  Issue #15508: Fix the docstring for __import__ to not mention negative
'level' values and set its document default value to 0.

Thanks to Arfrever Frehtes Taifersar Arahesis for filing the bug.

files:
  Misc/NEWS            |  4 ++++
  Python/bltinmodule.c |  5 ++---
  2 files changed, 6 insertions(+), 3 deletions(-)


diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -10,6 +10,10 @@
 Core and Builtins
 -----------------
 
+- Issue #15508: Fix the docstring for __import__ to have the proper default
+  value of 0 for 'level' and to not mention negative levels since they are
+  not supported.
+
 - Issue #15425: Eliminated traceback noise from more situations involving
   importlib
 
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -195,7 +195,7 @@
 }
 
 PyDoc_STRVAR(import_doc,
-"__import__(name, globals={}, locals={}, fromlist=[], level=-1) -> module\n\
+"__import__(name, globals={}, locals={}, fromlist=[], level=0) -> module\n\
 \n\
 Import a module. Because this function is meant for use by the Python\n\
 interpreter and not for general use it is better to use\n\
@@ -208,8 +208,7 @@
 When importing a module from a package, note that __import__('A.B', ...)\n\
 returns package A when fromlist is empty, but its submodule B when\n\
 fromlist is not empty.  Level is used to determine whether to perform \n\
-absolute or relative imports.  -1 is the original strategy of attempting\n\
-both absolute and relative imports, 0 is absolute, a positive number\n\
+absolute or relative imports. 0 is absolute while a positive number\n\
 is the number of parent directories to search relative to the current module.");
 
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list