From e4bb6fc39b27929d58841d1c2ceb481a032dea4b Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Sat, 31 May 2025 07:11:06 +0200 Subject: [PATCH] Prevent recursion with __cmd_prompt_enter potentially calling itself. --- ircplom.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ircplom.py b/ircplom.py index 68b5109..ce447d7 100755 --- a/ircplom.py +++ b/ircplom.py @@ -2,7 +2,7 @@ 'Attempt at an IRC client.' from contextlib import contextmanager -from inspect import _empty as inspect_empty, signature +from inspect import _empty as inspect_empty, signature, stack from queue import SimpleQueue, Empty as QueueEmpty from signal import SIGWINCH, signal from socket import socket @@ -494,7 +494,8 @@ class TuiLoop(Loop): if len(self._prompt) > 1 and self._prompt[0] == '/': toks = self._prompt[1:].split(maxsplit=1) method_name = f'_cmd__{toks[0]}' - if hasattr(self, method_name): + if hasattr(self, method_name)\ + and method_name != stack()[0].function: method = getattr(self, method_name) params = signature(method).parameters n_args_max = len(params) -- 2.30.2