Flimm
Flimm

Reputation: 150643

How can I step into a function when its call is over multiple lines?

Let's say I have this code sample:

function1(
    'arg1',
    'arg2',
    function2(
        'arg3.1',
        'arg3.2',
    ),
)

According to pdb's documentation, I can step into a function by typing s. Pressing s at the first line does not have the desired effect however, it merely passes control to the subsequent line.

How can I step into function1, without stepping into function2?

Upvotes: 1

Views: 457

Answers (1)

Martijn Pieters
Martijn Pieters

Reputation: 1121894

Each line is presented as a separate expression, pdb will step into a function right after evaluating the last expression before the closing parenthesis.

You cannot prevent stepping into function2; step in, straight out with r, then use s to step into function1 when function2 has returned. If you were to step over function2 instead (when the line with arg3.2 is presented) you'd step over both function2 and function1 in one go instead.

Upvotes: 2

Related Questions