GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — bpo-31844: Remove _markupbase.ParserBase.error() by berkerpeksag · Pull Request #8562 · python/cpython

bpo-31844: Remove _markupbase.ParserBase.error() #8562

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Sign up for GitHub

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
berkerpeksag merged 2 commits into python:master from berkerpeksag:31844-remove-error
Jul 16, 2020

Uh oh!

There was an error while loading. Please reload this page.

Merged

bpo-31844: Remove _markupbase.ParserBase.error() #8562

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
2 commits
Select commit Hold shift + click to select a range
2b4ac00
bpo-31844: Remove _markupbase.ParserBase.error()
berkerpeksag Jul 30, 2018
9747749
Merge branch 'master' into 31844-remove-error
berkerpeksag Jul 16, 2020
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view

There are no files selected for viewing

5 changes: 5 additions & 0 deletions 5 Doc/whatsnew/3.9.rst
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -887,6 +887,11 @@ Removed
:func:`asyncio.current_task` and :func:`asyncio.all_tasks` instead.
(Contributed by Rémi Lapeyre in :issue:`40967`)

* The ``ParserBase.error()`` method from the private and undocumented ``_markupbase``
module has been removed. :class:`html.parser.HTMLParser` is the only subclass of
``ParserBase`` and its ``error()`` implementation has already been removed in
Python 3.5.
(Contributed by Berker Peksag in :issue:`31844`.)

Porting to Python 3.9
=====================
Expand Down
35 changes: 18 additions & 17 deletions 35 Lib/_markupbase.py
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ def __init__(self):
raise RuntimeError(
"_markupbase.ParserBase must be subclassed")

def error(self, message):
raise NotImplementedError(
"subclasses of ParserBase must override error()")

def reset(self):
self.lineno = 1
self.offset = 0
Expand Down Expand Up @@ -131,12 +127,11 @@ def parse_declaration(self, i):
# also in data attribute specifications of attlist declaration
# also link type declaration subsets in linktype declarations
# also link attribute specification lists in link declarations
self.error("unsupported '[' char in %s declaration" % decltype)
raise AssertionError("unsupported '[' char in %s declaration" % decltype)
else:
self.error("unexpected '[' char in declaration")
raise AssertionError("unexpected '[' char in declaration")
else:
self.error(
"unexpected %r char in declaration" % rawdata[j])
raise AssertionError("unexpected %r char in declaration" % rawdata[j])
if j < 0:
return j
return -1 # incomplete
Expand All @@ -156,7 +151,9 @@ def parse_marked_section(self, i, report=1):
# look for MS Office ]> ending
match= _msmarkedsectionclose.search(rawdata, i+3)
else:
self.error('unknown status keyword %r in marked section' % rawdata[i+3:j])
raise AssertionError(
'unknown status keyword %r in marked section' % rawdata[i+3:j]
)
if not match:
return -1
if report:
Expand All @@ -168,7 +165,7 @@ def parse_marked_section(self, i, report=1):
def parse_comment(self, i, report=1):
rawdata = self.rawdata
if rawdata[i:i+4] != '<!--':
self.error('unexpected call to parse_comment()')
raise AssertionError('unexpected call to parse_comment()')
match = _commentclose.search(rawdata, i+4)
if not match:
return -1
Expand All @@ -192,7 +189,9 @@ def _parse_doctype_subset(self, i, declstartpos):
return -1
if s != "<!":
self.updatepos(declstartpos, j + 1)
self.error("unexpected char in internal subset (in %r)" % s)
raise AssertionError(
"unexpected char in internal subset (in %r)" % s
)
if (j + 2) == n:
# end of buffer; incomplete
return -1
Expand All @@ -209,8 +208,9 @@ def _parse_doctype_subset(self, i, declstartpos):
return -1
if name not in {"attlist", "element", "entity", "notation"}:
self.updatepos(declstartpos, j + 2)
self.error(
"unknown declaration %r in internal subset" % name)
raise AssertionError(
"unknown declaration %r in internal subset" % name
)
# handle the individual names
meth = getattr(self, "_parse_doctype_" + name)
j = meth(j, declstartpos)
Expand All @@ -234,14 +234,14 @@ def _parse_doctype_subset(self, i, declstartpos):
if rawdata[j] == ">":
return j
self.updatepos(declstartpos, j)
self.error("unexpected char after internal subset")
raise AssertionError("unexpected char after internal subset")
else:
return -1
elif c.isspace():
j = j + 1
else:
self.updatepos(declstartpos, j)
self.error("unexpected char %r in internal subset" % c)
raise AssertionError("unexpected char %r in internal subset" % c)
# end of buffer reached
return -1

Expand Down Expand Up @@ -387,8 +387,9 @@ def _scan_name(self, i, declstartpos):
return name.lower(), m.end()
else:
self.updatepos(declstartpos, i)
self.error("expected name token at %r"
% rawdata[declstartpos:declstartpos+20])
raise AssertionError(
"expected name token at %r" % rawdata[declstartpos:declstartpos+20]
)

# To be overridden -- handlers for unknown objects
def unknown_decl(self, data):
Expand Down
4 changes: 4 additions & 0 deletions 4 Misc/NEWS.d/next/Library/2018-07-30-12-48-17.bpo-31844.0_GKsD.rst
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Remove ``ParserBase.error()`` method from the private and undocumented
``_markupbase`` module. :class:`html.parser.HTMLParser` is the only
subclass of ``ParserBase`` and its ``error()`` implementation was deprecated
in Python 3.4 and removed in Python 3.5.
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.