public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Thomas Schwinge <tschwinge@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r12-4993] Fix 'contrib/update-copyright.py': 'TypeError: exceptions must derive from BaseException'
Date: Mon,  8 Nov 2021 10:51:18 +0000 (GMT)	[thread overview]
Message-ID: <20211108105118.6966C3858406@sourceware.org> (raw)

https://gcc.gnu.org/g:eb4a3e6a9a894238580a8209f59008d375809b2b

commit r12-4993-geb4a3e6a9a894238580a8209f59008d375809b2b
Author: Thomas Schwinge <thomas@codesourcery.com>
Date:   Fri Oct 22 15:54:42 2021 +0200

    Fix 'contrib/update-copyright.py': 'TypeError: exceptions must derive from BaseException'
    
    Running 'contrib/update-copyright.py' currently fails:
    
        [...]
        Traceback (most recent call last):
          File "contrib/update-copyright.py", line 365, in update_copyright
            canon_form = self.canonicalise_years (dir, filename, filter, years)
          File "contrib/update-copyright.py", line 270, in canonicalise_years
            (min_year, max_year) = self.year_range (years)
          File "contrib/update-copyright.py", line 253, in year_range
            year_list = [self.parse_year (year)
          File "contrib/update-copyright.py", line 253, in <listcomp>
            year_list = [self.parse_year (year)
          File "contrib/update-copyright.py", line 250, in parse_year
            raise self.BadYear (string)
        TypeError: exceptions must derive from BaseException
    
        During handling of the above exception, another exception occurred:
    
        Traceback (most recent call last):
          File "contrib/update-copyright.py", line 796, in <module>
            GCCCmdLine().main()
          File "contrib/update-copyright.py", line 527, in main
            self.copyright.process_tree (dir, filter)
          File "contrib/update-copyright.py", line 458, in process_tree
            self.process_file (dir, filename, filter)
          File "contrib/update-copyright.py", line 421, in process_file
            res = self.update_copyright (dir, filename, filter,
          File "contrib/update-copyright.py", line 366, in update_copyright
            except self.BadYear as e:
        TypeError: catching classes that do not inherit from BaseException is not allowed
    
    Fix up for commit 3b25e83536bcd1b2977659a2c6d9f0f9bf2a3152
    "Port update-copyright.py to Python3".
    
            contrib/
            * update-copyright.py (class BadYear): Derive from 'Exception'.

Diff:
---
 contrib/update-copyright.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/contrib/update-copyright.py b/contrib/update-copyright.py
index 2b2bb11d2e6..d13b963a147 100755
--- a/contrib/update-copyright.py
+++ b/contrib/update-copyright.py
@@ -1,6 +1,6 @@
 #!/usr/bin/env python3
 #
-# Copyright (C) 2013-2020 Free Software Foundation, Inc.
+# Copyright (C) 2013-2021 Free Software Foundation, Inc.
 #
 # This script is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -233,7 +233,7 @@ class Copyright:
     def add_external_author (self, holder):
         self.holders[holder] = None
 
-    class BadYear():
+    class BadYear (Exception):
         def __init__ (self, year):
             self.year = year


                 reply	other threads:[~2021-11-08 10:51 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211108105118.6966C3858406@sourceware.org \
    --to=tschwinge@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).