aboutsummaryrefslogtreecommitdiff
Restores compatibility with Python >=3.9,
which removed the custom .error() method in
https://github.com/python/cpython/commit/e34bbfd61f405eef89e8aa50672b0b25022de320

Despite the big diff, only a try…except clause is added.

--- source/sgmllib.py	2023-03-18 08:57:58.726240606 +0100
+++ source/sgmllib.py	2023-03-18 09:02:01.667568916 +0100
@@ -101,113 +101,116 @@
         """Handle the remaining data."""
         self.goahead(1)
 
-    def error(self, message):
-        raise SGMLParseError(message)
-
     # Internal -- handle data as far as reasonable.  May leave state
     # and data to be processed by a subsequent call.  If 'end' is
     # true, force handling all data as if followed by EOF marker.
     def goahead(self, end):
-        rawdata = self.rawdata
-        i = 0
-        n = len(rawdata)
-        while i < n:
-            if self.nomoretags:
-                self.handle_data(rawdata[i:n])
-                i = n
-                break
-            match = interesting.search(rawdata, i)
-            if match: j = match.start()
-            else: j = n
-            if i < j:
-                self.handle_data(rawdata[i:j])
-            i = j
-            if i == n: break
-            if rawdata[i] == '<':
-                if starttagopen.match(rawdata, i):
+        try:
+            rawdata = self.rawdata
+            i = 0
+            n = len(rawdata)
+            while i < n:
+                if self.nomoretags:
+                    self.handle_data(rawdata[i:n])
+                    i = n
+                    break
+                match = interesting.search(rawdata, i)
+                if match: j = match.start()
+                else: j = n
+                if i < j:
+                    self.handle_data(rawdata[i:j])
+                i = j
+                if i == n: break
+                if rawdata[i] == '<':
+                    if starttagopen.match(rawdata, i):
+                        if self.literal:
+                            self.handle_data(rawdata[i])
+                            i = i+1
+                            continue
+                        k = self.parse_starttag(i)
+                        if k < 0: break
+                        i = k
+                        continue
+                    if rawdata.startswith("</", i):
+                        k = self.parse_endtag(i)
+                        if k < 0: break
+                        i = k
+                        self.literal = 0
+                        continue
+                    if self.literal:
+                        if n > (i + 1):
+                            self.handle_data("<")
+                            i = i+1
+                        else:
+                            # incomplete
+                            break
+                        continue
+                    if rawdata.startswith("<!--", i):
+                            # Strictly speaking, a comment is --.*--
+                            # within a declaration tag <!...>.
+                            # This should be removed,
+                            # and comments handled only in parse_declaration.
+                        k = self.parse_comment(i)
+                        if k < 0: break
+                        i = k
+                        continue
+                    if rawdata.startswith("<?", i):
+                        k = self.parse_pi(i)
+                        if k < 0: break
+                        i = i+k
+                        continue
+                    if rawdata.startswith("<!", i):
+                        # This is some sort of declaration; in "HTML as
+                        # deployed," this should only be the document type
+                        # declaration ("<!DOCTYPE html...>").
+                        k = self.parse_declaration(i)
+                        if k < 0: break
+                        i = k
+                        continue
+                elif rawdata[i] == '&':
                     if self.literal:
                         self.handle_data(rawdata[i])
                         i = i+1
                         continue
-                    k = self.parse_starttag(i)
-                    if k < 0: break
-                    i = k
-                    continue
-                if rawdata.startswith("</", i):
-                    k = self.parse_endtag(i)
-                    if k < 0: break
-                    i = k
-                    self.literal = 0
-                    continue
-                if self.literal:
-                    if n > (i + 1):
-                        self.handle_data("<")
-                        i = i+1
-                    else:
-                        # incomplete
-                        break
-                    continue
-                if rawdata.startswith("<!--", i):
-                        # Strictly speaking, a comment is --.*--
-                        # within a declaration tag <!...>.
-                        # This should be removed,
-                        # and comments handled only in parse_declaration.
-                    k = self.parse_comment(i)
-                    if k < 0: break
-                    i = k
-                    continue
-                if rawdata.startswith("<?", i):
-                    k = self.parse_pi(i)
-                    if k < 0: break
-                    i = i+k
-                    continue
-                if rawdata.startswith("<!", i):
-                    # This is some sort of declaration; in "HTML as
-                    # deployed," this should only be the document type
-                    # declaration ("<!DOCTYPE html...>").
-                    k = self.parse_declaration(i)
-                    if k < 0: break
-                    i = k
-                    continue
-            elif rawdata[i] == '&':
-                if self.literal:
+                    match = charref.match(rawdata, i)
+                    if match:
+                        name = match.group(1)
+                        self.handle_charref(name)
+                        i = match.end(0)
+                        if rawdata[i-1] != ';': i = i-1
+                        continue
+                    match = entityref.match(rawdata, i)
+                    if match:
+                        name = match.group(1)
+                        self.handle_entityref(name)
+                        i = match.end(0)
+                        if rawdata[i-1] != ';': i = i-1
+                        continue
+                else:
+                    self.error('neither < nor & ??')
+                # We get here only if incomplete matches but
+                # nothing else
+                match = incomplete.match(rawdata, i)
+                if not match:
                     self.handle_data(rawdata[i])
                     i = i+1
                     continue
-                match = charref.match(rawdata, i)
-                if match:
-                    name = match.group(1)
-                    self.handle_charref(name)
-                    i = match.end(0)
-                    if rawdata[i-1] != ';': i = i-1
-                    continue
-                match = entityref.match(rawdata, i)
-                if match:
-                    name = match.group(1)
-                    self.handle_entityref(name)
-                    i = match.end(0)
-                    if rawdata[i-1] != ';': i = i-1
-                    continue
-            else:
-                self.error('neither < nor & ??')
-            # We get here only if incomplete matches but
-            # nothing else
-            match = incomplete.match(rawdata, i)
-            if not match:
-                self.handle_data(rawdata[i])
-                i = i+1
-                continue
-            j = match.end(0)
-            if j == n:
-                break # Really incomplete
-            self.handle_data(rawdata[i:j])
-            i = j
-        # end while
-        if end and i < n:
-            self.handle_data(rawdata[i:n])
-            i = n
-        self.rawdata = rawdata[i:]
-        # XXX if end: check for empty stack
+                j = match.end(0)
+                if j == n:
+                    break # Really incomplete
+                self.handle_data(rawdata[i:j])
+                i = j
+            # end while
+            if end and i < n:
+                self.handle_data(rawdata[i:n])
+                i = n
+            self.rawdata = rawdata[i:]
+            # XXX if end: check for empty stack
+        except AssertionError as e:
+            # The .error() method, which threw the custom SGMLParseError was removed
+            # by https://github.com/python/cpython/issues/76025. So we have to catch
+            # _markupbase’s AssertionError and translate it into the old one.
+            raise SGMLParseError (e.args[0]) from e
 
     # Extensions for the DOCTYPE scanner:
     _decl_otherchars = '='
ckages/shells.scm?id=7683be2e3f2ec2b5b325cadc8d720917305af8de'>gnu: dash: Update to 0.5.11.2....* gnu/packages/shells.scm (dash): Update to 0.5.11.2. Tobias Geerinckx-Rice 2020-08-13gnu: xonsh: Update to 0.9.19....* gnu/packages/shells.scm (xonsh): Update to 0.9.19. Tobias Geerinckx-Rice 2020-07-12gnu: Remove ".git" from "https://github/…/….git"....Until now, 'lookup-origin' and thus 'lookup-origin-revision' in (guix swh) would sometimes return #f for these because the ".git" URLs are redirects to the non-".git" URLs. Consequently, 'guix lint -c archival' would keep saying "scheduled Software Heritage archival"; likewise, the fallback download code would fail. * gnu/packages/ada.scm, gnu/packages/admin.scm, gnu/packages/aidc.scm, gnu/packages/algebra.scm, gnu/packages/android.scm, gnu/packages/animation.scm, gnu/packages/arcan.scm, gnu/packages/assembly.scm, gnu/packages/audio.scm, gnu/packages/authentication.scm, gnu/packages/avr.scm, gnu/packages/axoloti.scm, gnu/packages/backup.scm, gnu/packages/bash.scm, gnu/packages/benchmark.scm, gnu/packages/bioconductor.scm, gnu/packages/bioinformatics.scm, gnu/packages/bittorrent.scm, gnu/packages/boost.scm, gnu/packages/build-tools.scm, gnu/packages/c.scm, gnu/packages/calendar.scm, gnu/packages/cdrom.scm, gnu/packages/check.scm, gnu/packages/chemistry.scm, gnu/packages/chez.scm, gnu/packages/clojure.scm, gnu/packages/code.scm, gnu/packages/compression.scm, gnu/packages/compton.scm, gnu/packages/coq.scm, gnu/packages/cpp.scm, gnu/packages/cran.scm, gnu/packages/crypto.scm, gnu/packages/curl.scm, gnu/packages/databases.scm, gnu/packages/datastructures.scm, gnu/packages/debug.scm, gnu/packages/disk.scm, gnu/packages/distributed.scm, gnu/packages/django.scm, gnu/packages/dlang.scm, gnu/packages/dns.scm, gnu/packages/docker.scm, gnu/packages/education.scm, gnu/packages/efi.scm, gnu/packages/elixir.scm, gnu/packages/emacs-xyz.scm, gnu/packages/embedded.scm, gnu/packages/emulators.scm, gnu/packages/engineering.scm, gnu/packages/erlang.scm, gnu/packages/fabric-management.scm, gnu/packages/file-systems.scm, gnu/packages/finance.scm, gnu/packages/firmware.scm, gnu/packages/flashing-tools.scm, gnu/packages/fonts.scm, gnu/packages/fontutils.scm, gnu/packages/fpga.scm, gnu/packages/game-development.scm, gnu/packages/games.scm, gnu/packages/genealogy.scm, gnu/packages/genimage.scm, gnu/packages/geo.scm, gnu/packages/gimp.scm, gnu/packages/gl.scm, gnu/packages/gnome-xyz.scm, gnu/packages/gnome.scm, gnu/packages/gnuzilla.scm, gnu/packages/golang.scm, gnu/packages/gpodder.scm, gnu/packages/graph.scm, gnu/packages/graphics.scm, gnu/packages/graphviz.scm, gnu/packages/groff.scm, gnu/packages/groovy.scm, gnu/packages/gtk.scm, gnu/packages/guile-xyz.scm, gnu/packages/guile.scm, gnu/packages/hardware.scm, gnu/packages/haskell-apps.scm, gnu/packages/haskell-xyz.scm, gnu/packages/hexedit.scm, gnu/packages/i2p.scm, gnu/packages/ibus.scm, gnu/packages/image-processing.scm, gnu/packages/image-viewers.scm, gnu/packages/image.scm, gnu/packages/ipfs.scm, gnu/packages/java-graphics.scm, gnu/packages/java-maths.scm, gnu/packages/java.scm, gnu/packages/javascript.scm, gnu/packages/jrnl.scm, gnu/packages/julia.scm, gnu/packages/jupyter.scm, gnu/packages/kodi.scm, gnu/packages/language.scm, gnu/packages/lego.scm, gnu/packages/less.scm, gnu/packages/libusb.scm, gnu/packages/linux.scm, gnu/packages/lirc.scm, gnu/packages/lisp-xyz.scm, gnu/packages/llvm.scm, gnu/packages/logging.scm, gnu/packages/lolcode.scm, gnu/packages/lua.scm, gnu/packages/lxde.scm, gnu/packages/lxqt.scm, gnu/packages/machine-learning.scm, gnu/packages/mail.scm, gnu/packages/markup.scm, gnu/packages/maths.scm, gnu/packages/maven.scm, gnu/packages/mes.scm, gnu/packages/messaging.scm, gnu/packages/monitoring.scm, gnu/packages/mpd.scm, gnu/packages/music.scm, gnu/packages/networking.scm, gnu/packages/node-xyz.scm, gnu/packages/ocaml.scm, gnu/packages/ocr.scm, gnu/packages/onc-rpc.scm, gnu/packages/opencl.scm, gnu/packages/opencog.scm, gnu/packages/pantheon.scm, gnu/packages/password-utils.scm, gnu/packages/patchutils.scm, gnu/packages/pdf.scm, gnu/packages/perl6.scm, gnu/packages/phabricator.scm, gnu/packages/popt.scm, gnu/packages/printers.scm, gnu/packages/prolog.scm, gnu/packages/protobuf.scm, gnu/packages/pulseaudio.scm, gnu/packages/python-crypto.scm, gnu/packages/python-web.scm, gnu/packages/python-xyz.scm, gnu/packages/qt.scm, gnu/packages/radio.scm, gnu/packages/rails.scm, gnu/packages/rdf.scm, gnu/packages/rednotebook.scm, gnu/packages/rpc.scm, gnu/packages/rsync.scm, gnu/packages/ruby.scm, gnu/packages/rust.scm, gnu/packages/scheme.scm, gnu/packages/screen.scm, gnu/packages/security-token.scm, gnu/packages/selinux.scm, gnu/packages/serialization.scm, gnu/packages/shells.scm, gnu/packages/shellutils.scm, gnu/packages/simh.scm, gnu/packages/sml.scm, gnu/packages/ssh.scm, gnu/packages/statistics.scm, gnu/packages/stenography.scm, gnu/packages/sync.scm, gnu/packages/syncthing.scm, gnu/packages/synergy.scm, gnu/packages/telephony.scm, gnu/packages/terminals.scm, gnu/packages/tex.scm, gnu/packages/texinfo.scm, gnu/packages/text-editors.scm, gnu/packages/textutils.scm, gnu/packages/time.scm, gnu/packages/tmux.scm, gnu/packages/tor.scm, gnu/packages/toys.scm, gnu/packages/version-control.scm, gnu/packages/video.scm, gnu/packages/vim.scm, gnu/packages/virtualization.scm, gnu/packages/vlang.scm, gnu/packages/vnc.scm, gnu/packages/vpn.scm, gnu/packages/web-browsers.scm, gnu/packages/web.scm, gnu/packages/wireservice.scm, gnu/packages/wm.scm, gnu/packages/wxwidgets.scm, gnu/packages/xdisorg.scm, gnu/packages/xml.scm, gnu/packages/xorg.scm, tests/lint.scm: Remove trailing ".git" from 'git-reference' URL. Ludovic Courtès 2020-07-12gnu: fish: Remove bundled code....* gnu/packages/shells.scm (fish)[source]: Add snippet to remove bundled pcre2 source. Efraim Flashner 2020-07-12gnu: fish: Update to 3.1.2....* gnu/packages/shells.scm (fish): Update to 3.1.2. [arguments] Set HOME to a writable folder. Remove a failing test file. Signed-off-by: Efraim Flashner <efraim@flashner.co.il> Tanguy Le Carrour 2020-07-09gnu: dash: Update to 0.5.11.1....* gnu/packages/shells.scm (dash): Update to 0.5.11.1. Tobias Geerinckx-Rice 2020-07-02gnu: gash, gash-utils: Build with Guile 3.0....* gnu/packages/shells.scm (gash)[source]: Add 'modules' and 'snippet'. [inputs]: Change GUILE-2.2 to GUILE-3.0. (gash-utils)[source]: Add 'modules' and 'snippet'. [inputs]: Change GUILE-2.2 to GUILE-3.0. * gnu/packages/commencement.scm (gash-utils-boot)[source]: Remove unneeded 'modules' field, and add 'snippet'. (gash-utils-boot)[source]: New field. * gnu/packages/patches/gash-utils-ls-test.patch: New file. * gnu/local.mk (dist_patch_DATA): Add it. Ludovic Courtès 2020-06-19gnu: oil: Update to 0.8.pre6....* gnu/packages/shells.scm (oil): Update to 0.8.pre6. Signed-off-by: Nicolas Goaziou <mail@nicolasgoaziou.fr> Ryan Prior via Guix-patches via 2020-06-14gnu: zsh: Set default '$fpath'....* gnu/packages/shells.scm (zsh)[arguments]: Add configure-flags 'disable-site-dir' and 'enable-additional-fpath'. Brice Waegeneire 2020-06-02gnu: linenoise: Fix cross-compilation....* gnu/packages/shells.scm (linenoise)[arguments]: Use CC-FOR-TARGET. Tobias Geerinckx-Rice 2020-06-01gnu: dash: Update to 0.5.11....* gnu/packages/shells.scm (dash): Update to 0.5.11. Tobias Geerinckx-Rice 2020-05-29gnu: oil: Update to 0.8.pre5....* gnu/packages/shells.scm (oil): Update to 0.8.pre5. [arguments]: Perform ‘patch-compiler-invocation’ phase as part of 'configure. Remove ‘make-destination’ phase. Run a basic smoke test. [synopsis, description]: Update. Signed-off-by: Tobias Geerinckx-Rice <me@tobias.gr> Ryan Prior via Guix-patches via 2020-05-20gnu: xonsh: Update to 0.9.18....* gnu/packages/shells.scm (xonsh): Update to 0.9.18. [snippet]: Adapt to more aggressive bundling. Tobias Geerinckx-Rice 2020-05-15gnu: oil-shell: Rename to "oil"....* gnu/packages/shells.scm (oil): Rename variable from… (oil-shell): …this. Redefine using DEPRECATED-PACKAGE. Signed-off-by: Tobias Geerinckx-Rice <me@tobias.gr> Ryan Prior 2020-05-13mailmap: Update entries for Nikita....* .mailmap: change email and name for Nikita. * Makefile.am, doc/guix.texi, etc/completion/fish/guix.fish, gnu/packages/accessibility.scm, gnu/packages/admin.scm, gnu/packages/audio.scm, gnu/packages/autotools.scm, gnu/packages/cdrom.scm, gnu/packages/check.scm, gnu/packages/cinnamon.scm, gnu/packages/compression.scm, gnu/packages/crypto.scm, gnu/packages/databases.scm, gnu/packages/django.scm, gnu/packages/dns.scm, gnu/packages/elixir.scm, gnu/packages/emacs-xyz.scm, gnu/packages/emacs.scm, gnu/packages/enlightenment.scm, gnu/packages/erlang.scm, gnu/packages/fonts.scm, gnu/packages/fontutils.scm, gnu/packages/forth.scm, gnu/packages/fvwm.scm, gnu/packages/games.scm, gnu/packages/gl.scm, gnu/packages/gnome.scm, gnu/packages/gnunet.scm, gnu/packages/gnupg.scm, gnu/packages/gtk.scm, gnu/packages/guile-wm.scm, gnu/packages/guile-xyz.scm, gnu/packages/haskell-apps.scm, gnu/packages/haskell-check.scm, gnu/packages/haskell-crypto.scm, gnu/packages/haskell-xyz.scm, gnu/packages/haskell.scm, gnu/packages/image-viewers.scm, gnu/packages/image.scm, gnu/packages/irc.scm, gnu/packages/language.scm, gnu/packages/libcanberra.scm, gnu/packages/linux.scm, gnu/packages/lisp-xyz.scm, gnu/packages/lisp.scm, gnu/packages/lolcode.scm, gnu/packages/lxde.scm, gnu/packages/lxqt.scm, gnu/packages/mail.scm, gnu/packages/markup.scm, gnu/packages/mate.scm, gnu/packages/maths.scm, gnu/packages/mc.scm, gnu/packages/messaging.scm, gnu/packages/music.scm, gnu/packages/ncurses.scm, gnu/packages/networking.scm, gnu/packages/nickle.scm, gnu/packages/openbox.scm, gnu/packages/pdf.scm, gnu/packages/perl-check.scm, gnu/packages/perl.scm, gnu/packages/python-compression.scm, gnu/packages/python-crypto.scm, gnu/packages/python-web.scm, gnu/packages/python-xyz.scm, gnu/packages/python.scm, gnu/packages/qt.scm, gnu/packages/ruby.scm, gnu/packages/rust.scm, gnu/packages/scheme.scm, gnu/packages/serialization.scm, gnu/packages/shells.scm, gnu/packages/ssh.scm, gnu/packages/suckless.scm, gnu/packages/tbb.scm, gnu/packages/telephony.scm, gnu/packages/text-editors.scm, gnu/packages/textutils.scm, gnu/packages/time.scm, gnu/packages/tls.scm, gnu/packages/tor.scm, gnu/packages/version-control.scm, gnu/packages/video.scm, gnu/packages/vim.scm, gnu/packages/web.scm, gnu/packages/wm.scm, gnu/packages/xdisorg.scm, gnu/packages/xfce.scm, gnu/packages/xml.scm, gnu/packages/xorg.scm, gnu/services/certbot.scm, gnu/services/desktop.scm, gnu/services/version-control.scm, gnu/services/web.scm, guix/import/hackage.scm, guix/licenses.scm: Likewise. Signed-off-by: Efraim Flashner <efraim@flashner.co.il> nikita 2020-05-08Merge branch 'core-updates'Marius Bakke 2020-05-08gnu: fish: Upgrade to 3.1.0....* gnu/packages/shells (fish):[version] Update to 3.1.0. [arguments] Enable tests, patch test files, and avoid patches that no longer apply. [inputs] Make groff a native-input. Signed-off-by: Ludovic Courtès <ludo@gnu.org> John Soo 2020-04-15Merge branch 'master' into core-updatesMarius Bakke 2020-04-14gnu: mksh: Update to 58....* gnu/packages/shells.scm (mksh): Update to 58. Tobias Geerinckx-Rice