(
*,
host,
port,
frame,
commands,
version,
signal_raising_thread,
colorize,
)
| 3414 | |
| 3415 | |
| 3416 | def _connect( |
| 3417 | *, |
| 3418 | host, |
| 3419 | port, |
| 3420 | frame, |
| 3421 | commands, |
| 3422 | version, |
| 3423 | signal_raising_thread, |
| 3424 | colorize, |
| 3425 | ): |
| 3426 | with closing(socket.create_connection((host, port))) as conn: |
| 3427 | sockfile = conn.makefile("rwb") |
| 3428 | |
| 3429 | # The client requests this thread on Windows but not on Unix. |
| 3430 | # Most tests don't request this thread, to keep them simpler. |
| 3431 | if signal_raising_thread: |
| 3432 | signal_server = (host, port) |
| 3433 | else: |
| 3434 | signal_server = None |
| 3435 | |
| 3436 | remote_pdb = _PdbServer( |
| 3437 | sockfile, |
| 3438 | signal_server=signal_server, |
| 3439 | colorize=colorize, |
| 3440 | ) |
| 3441 | weakref.finalize(remote_pdb, sockfile.close) |
| 3442 | |
| 3443 | if Pdb._last_pdb_instance is not None: |
| 3444 | remote_pdb.error("Another PDB instance is already attached.") |
| 3445 | elif version != remote_pdb.protocol_version(): |
| 3446 | target_ver = f"0x{remote_pdb.protocol_version():08X}" |
| 3447 | attach_ver = f"0x{version:08X}" |
| 3448 | remote_pdb.error( |
| 3449 | f"The target process is running a Python version that is" |
| 3450 | f" incompatible with this PDB module." |
| 3451 | f"\nTarget process pdb protocol version: {target_ver}" |
| 3452 | f"\nLocal pdb module's protocol version: {attach_ver}" |
| 3453 | ) |
| 3454 | else: |
| 3455 | remote_pdb.set_trace(frame=frame, commands=commands.splitlines()) |
| 3456 | |
| 3457 | |
| 3458 | def attach(pid, commands=()): |
nothing calls this directly
no test coverage detected
searching dependent graphs…