From 449ab22c87eab0d483a524182f22b313fbf94615 Mon Sep 17 00:00:00 2001 From: Truffle Date: Sun, 31 May 2026 09:07:58 +0000 Subject: [PATCH] Fix Python 3.11 SyntaxError in AmneziaPeer.py Python 3.11 raises 'f-string expression part cannot include a backslash' on line 91, where strip('\n') sits inside an f-string {...}. PEP 701 lifted this restriction in 3.12. Bind the decoded output to a local so the strip call happens outside the f-string, which also removes the duplicate decode+strip already performed on the preceding length check. Closes #1289 Signed-off-by: Truffle --- src/modules/AmneziaPeer.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/modules/AmneziaPeer.py b/src/modules/AmneziaPeer.py index 392f009d..558575ac 100644 --- a/src/modules/AmneziaPeer.py +++ b/src/modules/AmneziaPeer.py @@ -87,8 +87,9 @@ class AmneziaPeer(Peer): if psk_exist: os.remove(uid) - if len(updateAllowedIp.decode().strip("\n")) != 0: - current_app.logger.error(f"Update peer failed when updating Allowed IPs.\nInput: {newAllowedIPs}\nOutput: {updateAllowedIp.decode().strip('\n')}") + output = updateAllowedIp.decode().strip("\n") + if len(output) != 0: + current_app.logger.error(f"Update peer failed when updating Allowed IPs.\nInput: {newAllowedIPs}\nOutput: {output}") return False, "Internal server error" command = [f"{self.configuration.Protocol}-quick", "save", self.configuration.Name]