This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author jdemeyer
Recipients erik.bray, jdemeyer, paul.moore
Date 2018-05-01.07:23:02
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1525159383.12.0.682650639539.issue32797@psf.upfronthosting.co.za>
In-reply-to
Content
> 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.
History
Date User Action Args
2018-05-01 07:23:03jdemeyersetrecipients: + jdemeyer, paul.moore, erik.bray
2018-05-01 07:23:03jdemeyersetmessageid: <1525159383.12.0.682650639539.issue32797@psf.upfronthosting.co.za>
2018-05-01 07:23:03jdemeyerlinkissue32797 messages
2018-05-01 07:23:02jdemeyercreate