Hi folks,
I'm wondering if this is expected behavior. Consider some trivial
little class like
class Simpleton:
def __str__(self):
return "A simpleton"
def incr(self,x):
"""Increment x by one.
Examples:
>>> s = Simpleton()
>>> s.incr(1)
2
>>> s.incr(10)
12
"""
return x+1
If I build this thing in cython, the Simpleton.incr.__module__
attribute is set to None, while if I make it a pure python module,
it's correctly set to the module name:
In [18]: p sprimes.primes.Simpleton.incr.__module__
None
In [19]: p sprimes.pyprimes.Simpleton.incr.__module__
sprimes.pyprimes
This difference causes the doctest to miss any doctest examples that
might be included in the methods.
Note that for *top-level* functions in the extension module, the
__module__ attribute is correctly set:
In [21]: p sprimes.primes.primes
<built-in function primes>
In [22]: p sprimes.primes.primes.__module__
sprimes.primes
so the problem appears to be only for classes.
This is running cython 0.9.8.
Thanks for any feedback,
f
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev