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 brett.cannon
Recipients brett.cannon, christian.heimes, nnorwitz
Date 2007-11-30.07:57:05
SpamBayes Score 0.010660837
Marked as misclassified No
Message-id <>
I see two ways of implementing the fetching of a source code line from

One is to do it in Python.  We have a function provided that can
suppress the second line of output from a warning and just handle it in
Python code.  That has the requirement that Python code be available to
import, but if you are using Lib/ instead of
Python/_warnings.c that is pretty much guaranteed.

The other option is to rely on the fact that get_source() is supposed to
use universal newlines.  Then we can find the index of the x and x-1
newlines and print the substring between the two.  That can be done in C
code by checking for the loader, checking for get_source(), calling it,
getting the char buffer, and then just looping through looking for the
needed newlines to find the needed indexes.  Otherwise we can use the
Python API on strings to do what would have been done in pure Python,
but that is a lot of PyObject_Call() usage and seems overly inefficient
if one bothers with coding it in C.  =)
Date User Action Args
2007-11-30 07:57:07brett.cannonsetspambayes_score: 0.0106608 -> 0.010660837
recipients: + brett.cannon, nnorwitz, christian.heimes
2007-11-30 07:57:07brett.cannonsetspambayes_score: 0.0106608 -> 0.0106608
messageid: <>
2007-11-30 07:57:06brett.cannonlinkissue1631171 messages
2007-11-30 07:57:05brett.cannoncreate