Line numbers outside exceptions

Thomas Wouters thomas at xs4all.net
Tue Jul 18 17:19:33 EDT 2000


On Tue, Jul 18, 2000 at 05:33:53PM +0000, Calvelo Daniel wrote:

> >>> def spam(n="eggs"):
> ...   print n
> ...   return n
> ... 
> >>> spam.func_code.co_code 
> '\177\001\000\177\002\000|\000\000GH\177\003\000|\000\000Sd\000\000S'

> In that last string, the two bytes (this may be platform-specific) after
> a '\177' are line numbers. See 'dis'.

It's not really platform dependant. The opcode arguments (which is what you
are talking about) are always stored as two characters, regardless of, for
instance, the size of 'int' or 'long', but it *is* dependant on the size of
a 'char'. However, a ton more things are likely to break if the size of a
char isn't 8 bytes, so it's highly unlikely that you'll encounter a Python
where the above does not hold ;)

-- 
Thomas Wouters <thomas at xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!




More information about the Python-list mailing list