mirror of
https://github.com/python/cpython.git
synced 2025-10-15 03:10:29 +00:00
Use inspect.stack()[1][3] to tell if Helper.__repr__ is called interactively.
This commit is contained in:
parent
eca15c1fb1
commit
9bc576b7f6
1 changed files with 2 additions and 2 deletions
|
@ -1268,10 +1268,10 @@ class Helper:
|
||||||
self.docdir = dir
|
self.docdir = dir
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
if len(inspect.stack()) <= 2:
|
if inspect.stack()[1][3] == '?':
|
||||||
self()
|
self()
|
||||||
return ''
|
return ''
|
||||||
return '<pydoc.Helper instance at %p>' % id(self)
|
return '<pydoc.Helper instance>'
|
||||||
|
|
||||||
def __call__(self, request=None):
|
def __call__(self, request=None):
|
||||||
if request is not None:
|
if request is not None:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue