From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <3Jp9qXgoKCwklkrn1rwpn0pxxpun.lxvpmk-yj2lqn11x30ln5j0n.x0p@flex--cbiesinger.bounces.google.com> Received: from mail-pg1-x549.google.com (mail-pg1-x549.google.com [IPv6:2607:f8b0:4864:20::549]) by sourceware.org (Postfix) with ESMTPS id 9150C387701C for ; Thu, 12 Mar 2020 20:44:23 +0000 (GMT) Received: by mail-pg1-x549.google.com with SMTP id b10so4304844pgi.16 for ; Thu, 12 Mar 2020 13:44:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=3ItGgfPOUKW2p+SgowfT0dfH3RGCSMi7uoVOhrxhnoY=; b=RIOB5/3k+pN5WZBYpe3SjJ4uuM93k4i+xI0Zzgtchvii+BMLj00BI9VtT5HcyRF3qQ UdC+xQlHX9oxrVbKFU5uwOiDb64Qjq21GWSePtTrZ+kIo3P4tLxnjQ2y/P/JiGdV0r5n 4yVT9EEDca+Iy4nI9mCmwehw7HLjal9bWe14fIVBN0Zng3gQk6243YGjsfvgP7uDqRWy kgsNKJvrcNgu2sE1ZMDJdcsNzWq5hgSoWljJwuZyHqhLPeC2c3XouxNpxIZxg2AY6lQI 3CfiJEknFAJvEGPWH5XJ5zFn9sA5vL7BbVYfo7GSYA004D9qPFMkWd4FRaLIivSPR8+C zlLg== X-Gm-Message-State: ANhLgQ3uh2d/SWEcU1pgpzjlv1ztyPdBZYb+PU1Qh9+twHj7pc+YZDSL ceVxIVP25NweVTa9S8iPVB9x6GpV+Y+XwfvquBZ7zd3T2S5XAJvmzH6/ldoWC5MX/VONvZbumZD fkQpbpvwVdVRFI1RliCHkqh5sSEiTYbnhTVg4u79ZO4fdMS41Lr+d7xLKbIGZO3yzinsfJoLtv4 3A2Q== X-Google-Smtp-Source: ADFU+vu6wL8zo3B3bGmI1uz4gyX5WPG+T8I9+kr3DZRDH7jK9G6fhJkTQPW7NyUEj4bBgbskrG9DA+0s6d2ZbcaF X-Received: by 2002:a17:90a:cb07:: with SMTP id z7mr5999763pjt.138.1584045862472; Thu, 12 Mar 2020 13:44:22 -0700 (PDT) Date: Thu, 12 Mar 2020 15:44:19 -0500 Message-Id: <20200312204419.188271-1-cbiesinger@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.25.1.481.gfbce0eb801-goog Subject: [PATCH] Clarify when dont_repeat should be called From: Christian Biesinger To: gdb-patches@sourceware.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-34.6 required=5.0 tests=BAYES_00, DKIMWL_WL_MED, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Mar 2020 20:44:24 -0000 It is not immediately obvious that Command.dont_repeat should be called in invoke(), not in __init__. Make this obvious in the documentation. gdb/doc/ChangeLog: 2020-03-12 Christian Biesinger * python.texi (Commands In Python): Clarify when Command.dont_repeat should be called. --- gdb/doc/python.texi | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gdb/doc/python.texi b/gdb/doc/python.texi index 76cdf7f541..e2bc824357 100644 --- a/gdb/doc/python.texi +++ b/gdb/doc/python.texi @@ -3655,8 +3655,11 @@ not documented.'' is used. @defun Command.dont_repeat () By default, a @value{GDBN} command is repeated when the user enters a blank line at the command prompt. A command can suppress this -behavior by invoking the @code{dont_repeat} method. This is similar -to the user command @code{dont-repeat}, see @ref{Define, dont-repeat}. +behavior by invoking the @code{dont_repeat} method. Because a command +can dynamically determine whether it wants to be repeatable, this needs +to be called inside the command's @code{invoke} method, not in +@code{__init__}. This is similar to the user command @code{dont-repeat}, +see @ref{Define, dont-repeat}. @end defun @defun Command.invoke (argument, from_tty) -- 2.25.1.481.gfbce0eb801-goog