[Python-Dev] seeing off SET_LINENO

Guido van Rossum guido@python.org
Thu, 01 Aug 2002 11:18:22 -0400

> After my patch there are no SET_LINENO opcodes, so execution is
> never on the def line[*], so no 'line' trace event is generated for
> the def line, so a debugger that only listens to the 'line' events and
> ignores the 'call' events will not stop on that line.

If the argument list contains embedded tuples, there's code executed
to unpack those before the first line of the function.  Example:

  >>> def f(a, (b, c), d):
  ...     print a, b, c, d
  >>> f(1, (2, 3), 4)
  1 2 3 4
  >>> f(1, 2, 3)
  Traceback (most recent call last):
    File "<stdin>", line 1, in ?
    File "<stdin>", line 1, in f
  TypeError: unpack non-sequence

I hope the debugger will stop *before* this unpacking happens!  It
does now:

  >>> import pdb
  >>> pdb.run("f(1, 2, 3)")
  > <string>(0)?()
  (Pdb) s
  > <string>(1)?()
  > <stdin>(1)f()
  TypeError: 'unpack non-sequence'
  > <stdin>(1)f()
  (Pdb) q

--Guido van Rossum (home page: http://www.python.org/~guido/)