[issue3158] Doctest fails to find doctests in extension modules

Fernando Pérez report at bugs.python.org
Sat Jun 21 19:50:13 CEST 2008


Fernando Pérez <fer_perez at users.sourceforge.net> added the comment:

I think there are two issues that need to be separated:

1. The doctest bug.  I'm happy with any resolution for it, and I'm not
claiming that my patch is the best approach.  isroutine() indeed works
in my case, and if that approach works well in general for doctest, I'm
perfectly happy with it.

2. Terminology.  I really disagree with the idea that 

- 'function' describes the implementation language of an object instead
of whether it's a standalone callable (vs an object method).

- 'builtin' doesn't mean the object is "built into the shipped Python"
but instead that it's "written in C".  

The language exposes its builtins via the __builtin__ module precisely
to declare what is part of itself, and it even has in the documentation:

http://docs.python.org/lib/built-in-funcs.html

a section that starts:

"""2.1 Built-in Functions

The Python interpreter has a number of functions built into it that are
always available."""


Nowhere does it say that "builtins are written in C and functions in
Python".

In summary, I'm happy with any fix for the bug, but I very strongly
disagree with a use of terminology that is confusing and misleading (and
which unfortunately is enshrined in the inspect and types modules in how
they distinguish 'Function' from 'BuiltinFunctionType').

And by the way, by 'extension module' I mean to describe C-extensions,
since that is how most C code is shipped by third-party authors, those
affected by this bug (since the stdlib doesn't seem to use doctests
itself for its own testing of C code).

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3158>
_______________________________________


More information about the Python-bugs-list mailing list