From: Christian Heller Date: Sat, 31 May 2025 05:11:06 +0000 (+0200) Subject: Prevent recursion with __cmd_prompt_enter potentially calling itself. X-Git-Url: https://plomlompom.com/repos/pick_tasks?a=commitdiff_plain;h=e4bb6fc39b27929d58841d1c2ceb481a032dea4b;p=ircplom Prevent recursion with __cmd_prompt_enter potentially calling itself. --- 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)