[llvm] r367320 - Fix `git llvm` script when no arguments are supplied on Python 3

Mehdi Amini via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 30 08:25:11 PDT 2019


Author: mehdi_amini
Date: Tue Jul 30 08:25:11 2019
New Revision: 367320

URL: http://llvm.org/viewvc/llvm-project?rev=367320&view=rev
Log:
Fix `git llvm` script when no arguments are supplied on Python 3

Instead of displaying a help message, it was issuing an error message:

  AttributeError: 'Namespace' object has no attribute 'func'

https://bugs.python.org/issue16308 has more information on the bug.

Modified:
    llvm/trunk/utils/git-svn/git-llvm

Modified: llvm/trunk/utils/git-svn/git-llvm
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/git-svn/git-llvm?rev=367320&r1=367319&r2=367320&view=diff
==============================================================================
--- llvm/trunk/utils/git-svn/git-llvm (original)
+++ llvm/trunk/utils/git-svn/git-llvm Tue Jul 30 08:25:11 2019
@@ -617,5 +617,14 @@ if __name__ == '__main__':
     VERBOSE = args.verbose
     QUIET = args.quiet
 
+    # Python3 workaround, for when not arguments are provided.
+    # See https://bugs.python.org/issue16308
+    try:
+        func = args.func
+    except AttributeError:
+        # No arguments or subcommands were given.
+        parser.print_help()
+        parser.exit()
+
     # Dispatch to the right subcommand
     args.func(args)




More information about the llvm-commits mailing list