+ scripts-show_delta-add-__main__-judgement-before-main-code.patch added to mm-nonmm-unstable branch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     Subject: scripts/show_delta: add __main__ judgement before main code
has been added to the -mm mm-nonmm-unstable branch.  Its filename is
     scripts-show_delta-add-__main__-judgement-before-main-code.patch

This patch will shortly appear at
     https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/scripts-show_delta-add-__main__-judgement-before-main-code.patch

This patch will later appear in the mm-nonmm-unstable branch at
    git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next via the mm-everything
branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there every 2-3 working days

------------------------------------------------------
From: Hu Haowen <2023002089@xxxxxxxxxxxxxxxx>
Subject: scripts/show_delta: add __main__ judgement before main code
Date: Fri, 13 Oct 2023 21:28:32 +0800

When doing Python programming it is a nice convention to insert the if
statement `if __name__ == "__main__":` before any main code that does
actual functionalities to ensure the code will be executed only as a
script rather than as an imported module.  Hence attach the missing
judgement to show_delta.

Link: https://lkml.kernel.org/r/20231013132832.165768-1-2023002089@xxxxxxxxxxxxxxxx
Signed-off-by: Hu Haowen <2023002089@xxxxxxxxxxxxxxxx>
Reviewed-by: Nick Desaulniers <ndesaulniers@xxxxxxxxxx>
Reviewed-by: Miguel Ojeda <ojeda@xxxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
Cc: Masahiro Yamada <masahiroy@xxxxxxxxxx>
Cc: Nicolas Schier <n.schier@xxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 scripts/show_delta |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/scripts/show_delta~scripts-show_delta-add-__main__-judgement-before-main-code
+++ a/scripts/show_delta
@@ -125,4 +125,5 @@ def main():
 	for line in lines:
 		print (convert_line(line, base_time),)
 
-main()
+if __name__ == "__main__":
+	main()
_

Patches currently in -mm which might be from 2023002089@xxxxxxxxxxxxxxxx are

scripts-show_delta-add-__main__-judgement-before-main-code.patch




[Index of Archives]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux