Marco Ricci commited on 2025-12-27 17:33:06
Zeige 1 geänderte Dateien mit 3 Einfügungen und 4 Löschungen.
Instead of iterating over all test keys and testing whether the agent is not isolated and the key is a successfully loaded key, first check whether the agent is isolated or not, *then* iterate over the successfully loaded key names and extract the relevant test key from the test key table. The efficiency per operation is similar, but the previous setup always iterated the whole test key table unconditionally, whereas the new setup only iterates the successfully loaded key name set (fewer entries than the test key table), and only conditionally.
| ... | ... |
@@ -1022,10 +1022,9 @@ def ssh_agent_client_with_test_keys_loaded( |
| 1022 | 1022 |
) |
| 1023 | 1023 |
yield client |
| 1024 | 1024 |
finally: |
| 1025 |
- for key_type, key_struct in data.ALL_KEYS.items(): |
|
| 1026 |
- if not isolated and ( |
|
| 1027 |
- key_type in successfully_loaded_keys |
|
| 1028 |
- ): # pragma: no cover [external] |
|
| 1025 |
+ if not isolated: # pragma: no cover [external] |
|
| 1026 |
+ for key_type in successfully_loaded_keys: |
|
| 1027 |
+ key_struct = data.ALL_KEYS[key_type] |
|
| 1029 | 1028 |
# The public key blob is the base64-encoded part in |
| 1030 | 1029 |
# the "public key line". |
| 1031 | 1030 |
public_key = base64.standard_b64decode( |
| 1032 | 1031 |