Jeroen Demeyer <j.deme...@ugent.be> added the comment:

> But the standard library has no need to ever find source for extension modules
> So there's no need for the stdlib to be involved

The standard library is not a closed system. It's not meant to support only 
itself, it's supposed to be an API. If linecache.getlines() is the Python API 
to get source code, then Cython code should use that API. Having a different 
competing API for getting source code (for other projects like Cython) is 
really the worst possible solution: some tools will only use linecache, other 
tools will use the new API and this will be a mess.

> Note that I haven't said it shouldn't be fixed, merely that I'm not as
> convinced, having read this discussion, that having linecache do a path search
> if the loader returns None is *necessarily* the best solution here.

Do you have other proposals? Like I said, the only thing that I want is one 
officially supported way to have the loader answer to linecache "I don't know 
where the sources are but continue looking for them".

> Ideally, of course, there would be a CythonExtensionLoader that handled this 
> in get_source.

That would be ideal solution indeed and it's the first thing that we tried to 
fix this.

Unfortunately for Cython, PEP 302 (and in particular the get_source signature) 
was written with the assumption that a *single* module only has a *single* 
source file. This assumption doesn't hold for Cython code: like C, it supports 
include/declaration files which can contain code. So my conclusion is that 
loader.get_source() simply cannot work for Cython.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32797>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to