[Epydoc-commits] SF.net SVN: epydoc: [1607] trunk/epydoc/src/epydoc/docstringparser.py
Brought to you by:
edloper
From: <ed...@us...> - 2007-09-23 02:44:23
|
Revision: 1607 http://epydoc.svn.sourceforge.net/epydoc/?rev=1607&view=rev Author: edloper Date: 2007-09-22 19:44:21 -0700 (Sat, 22 Sep 2007) Log Message: ----------- - Fixed sf bug 1796723 -- don't compare user objects using 'in' or '==', because they might override __cmp__ to lie or to thrown an exception; use 'is' instead. Modified Paths: -------------- trunk/epydoc/src/epydoc/docstringparser.py Modified: trunk/epydoc/src/epydoc/docstringparser.py =================================================================== --- trunk/epydoc/src/epydoc/docstringparser.py 2007-09-23 02:17:25 UTC (rev 1606) +++ trunk/epydoc/src/epydoc/docstringparser.py 2007-09-23 02:44:21 UTC (rev 1607) @@ -451,12 +451,16 @@ filename = '??' # [xx] Don't report markup errors for standard builtins. - if (isinstance(api_doc, ValueDoc) and api_doc != module and - (api_doc.pyval in __builtin__.__dict__.values() or - (module not in (None, UNKNOWN) and - module.pyval in (__builtin__, exceptions)))): - return - + # n.b. that we must use 'is' to compare pyvals here -- if we use + # 'in' or '==', then a user __cmp__ method might raise an + # exception, or lie. + if isinstance(api_doc, ValueDoc) and api_doc != module: + if module not in (None, UNKNOWN) and module.pyval is exceptions: + return + for builtin_val in __builtin__.__dict__.values(): + if builtin_val is api_doc.pyval: + return + # Get the start line of the docstring containing the error. startline = api_doc.docstring_lineno if startline in (None, UNKNOWN): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |