1. Armin Rigo
  2. cpython-withatomic

Commits

Ka-Ping Yee  committed 25f55b2

Use inspect.stack()[1][3] to tell if Helper.__repr__ is called interactively.

  • Participants
  • Parent commits 4ab5862
  • Branches legacy-trunk

Comments (0)

Files changed (1)

File Lib/pydoc.py

View file
  • Ignore whitespace
                 self.docdir = dir
 
     def __repr__(self):
-        if len(inspect.stack()) <= 2:
+        if inspect.stack()[1][3] == '?':
             self()
             return ''
-        return '<pydoc.Helper instance at %p>' % id(self)
+        return '<pydoc.Helper instance>'
 
     def __call__(self, request=None):
         if request is not None: