Hi,
I am seeing an issue in pdb while printing from args when multiple args are passed to a function.
lets say we pass three arguments then args[0] should display the first one, in pdb it displays entire tuple instead of first argument.
consider the following sample program,
def my_function(*args):
breakpoint()
first_arg = args[0] if args else None # Safe access to the first argument
print("First argument:", first_arg)
my_function(10, 20, 30) # Output: First argument: 10
my_function() # Output: First argument: None
it’s output,
$ python3 test_arg.py
> /home/python/test_arg.py(3)my_function()
-> first_arg = args[0] if args else None # Safe access to the first argument
(Pdb) n
> /home/python/test_arg.py(4)my_function()
-> print("First argument:", first_arg)
(Pdb) first_arg
10
(Pdb) args[1]
args = (10, 20, 30)
(Pdb) c
First argument: 10
> /home/python/test_arg.py(3)my_function()
-> first_arg = args[0] if args else None # Safe access to the first argument
(Pdb) c
First argument: None
this seems to happen for linux and windows as well. shouldn’t args[0] even in pdb print 10?
if this is a legitimate issue please let me know where I can raise it.
regards,