Skip to content

Commit 1ec9475

Browse files
committed
Combine the two blocks for handling -p PID into one
1 parent 46fb219 commit 1ec9475

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

Lib/pdb.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3176,7 +3176,11 @@ def main():
31763176
if opts.pid:
31773177
# If attaching to a remote pid, unrecognized arguments are not allowed.
31783178
# This will raise an error if there are extra unrecognized arguments.
3179-
parser.parse_args()
3179+
opts = parser.parse_args()
3180+
if opts.module:
3181+
parser.error("argument -m: not allowed with argument --pid")
3182+
attach(opts.pid, opts.commands)
3183+
return
31803184
elif opts.module:
31813185
# If a module is being debugged, we consider the arguments after "-m module" to
31823186
# be potential arguments to the module itself. We need to parse the arguments
@@ -3196,12 +3200,6 @@ def main():
31963200
parser.error(f"unrecognized arguments: {' '.join(invalid_args)}")
31973201
sys.exit(2)
31983202

3199-
if opts.pid:
3200-
if opts.module:
3201-
parser.error("argument -m: not allowed with argument --pid")
3202-
attach(opts.pid, opts.commands)
3203-
return
3204-
32053203
if opts.module:
32063204
file = opts.module
32073205
target = _ModuleTarget(file)

0 commit comments

Comments
 (0)