[Python-Dev] seeing off SET_LINENO
Guido van Rossum
guido@python.org
Fri, 02 Aug 2002 12:13:56 -0400
> The problem is that when we jump into the epilogue, a 'line' trace
> event gets generated before the 'return' one. So there is no
> --Return-- hint.
Ah, I missed that detail in your transcript.
> 1) Don't you find the idea of type(co.co_code) == types.ArrayType at
> least a little scary? Mainly due to resizes -- having mutable code
> might be nice for development environments and such.
Yes, it's scary. But nobody does this, and as you say, it can't be
done from Python.
> 2) I thought it was possible for bf_getreadbuffer to fail (maybe I'm
> wrong here). _PyCode_GETCODEPTR does no error checking.
So one should only use objects whose bf_getreadbuffer won't fail (when
invoked with segment index 0).
> > I'd be happy to kill it as a YAGNI.
>
> That's nice, but if...
>
> > But that still doesn't mean I approve checking for "4 bytes from the
> > end".
>
> ...it doesn't actually help.
Well, it kills off a potentially unsafe feature.
> Does anyone have any better ideas for not generating 'line' trace
> events in the epilogue?
Use a separate opcode for which you could check?
--Guido van Rossum (home page: http://www.python.org/~guido/)