Skip to content

Commit 026c9be

Browse files
committed
listcomp -> for-loop (listcopms create a new scope in py3), bypass AttributeError on Pandas.str
1 parent 0a5e36a commit 026c9be

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

doc/sphinxext/numpydoc/docscrape.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -499,10 +499,14 @@ def splitlines_x(s):
499499
for field, items in [('Methods', self.methods),
500500
('Attributes', self.properties)]:
501501
if not self[field]:
502-
self[field] = [
503-
(name, '',
504-
splitlines_x(pydoc.getdoc(getattr(self._cls, name))))
505-
for name in sorted(items)]
502+
doc_list = []
503+
for name in sorted(items):
504+
try:
505+
doc_item = pydoc.getdoc(getattr(self._cls, name))
506+
doc_list.append((name, '', splitlines_x(doc_item)))
507+
except AttributeError:
508+
pass # method doesn't exist
509+
self[field] = doc_list
506510

507511
@property
508512
def methods(self):

0 commit comments

Comments
 (0)