Merge pull request #3346 from xonsh/superhelp

Fix superhelp
This commit is contained in:
Anthony Scopatz 2019-10-07 16:20:13 -04:00 committed by GitHub
commit e217abd306
Failed to generate hash of commit
3 changed files with 32 additions and 2 deletions

24
news/superhelp.rst Normal file
View file

@ -0,0 +1,24 @@
**Added:**
* <news item>
**Changed:**
* <news item>
**Deprecated:**
* <news item>
**Removed:**
* <news item>
**Fixed:**
* Fixed a regession with xonsh superhelp ``??`` operator and ``which -v`` which showed Pythons builtin
doc strings.
**Security:**
* <news item>

View file

@ -33,9 +33,11 @@ _func_call_docstring = LazyObject(
_object_init_docstring = LazyObject(
lambda: object.__init__.__doc__, globals(), "_object_init_docstring"
)
_builtin_type_docstrings = LazyObject(
lambda: {
t.__doc__ for t in (types.ModuleType, types.MethodType, types.FunctionType)
inspect.getdoc(t)
for t in (types.ModuleType, types.MethodType, types.FunctionType, property)
},
globals(),
"_builtin_type_docstrings",

View file

@ -104,7 +104,11 @@ def print_alias(arg, stdout, verbose=False):
else:
print(arg, file=stdout)
else:
print("aliases['{}'] = {}".format(arg, builtins.aliases[arg]), file=stdout)
print(
"aliases['{}'] = {}".format(arg, builtins.aliases[arg]),
flush=True,
file=stdout,
)
if callable(builtins.aliases[arg]):
builtins.__xonsh__.superhelp(builtins.aliases[arg])