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 — `xml.dom.domreg.getDOMImplementation`: fallback discovery masks genuine bugs, not just "not installed" · Issue #155944 · python/cpython

xml.dom.domreg.getDOMImplementation: fallback discovery masks genuine bugs, not just "not installed" #155944

New issue
Copy link
New issue
Copy link
Open
#157980
Open
xml.dom.domreg.getDOMImplementation: fallback discovery masks genuine bugs, not just "not installed"#155944
#157980
Copy link
Labels
pendingThe issue will be closed if no feedback is providedThe issue will be closed if no feedback is providedtestsTests in the Lib/test dirTests in the Lib/test dirtype-featureA feature request or enhancementA feature request or enhancement

Description

@tobiaspal
tobiaspal
opened on Aug 17, 2026
Issue body actions

Bug report

Bug description:

  • Location: Lib/xml/dom/domreg.py:73-76

cpython/Lib/xml/dom/domreg.py

Lines 72 to 78 in cbe3a7f

for creator in well_known_implementations.keys():
try:
dom = getDOMImplementation(name = creator)
except Exception: # typically ImportError, or AttributeError
continue
if _good_enough(dom, features):
return dom

  • Problem: When called with no explicit implementation name, tries each well-known implementation (minidom, 4DOM) in turn under except Exception: continue (comment: "typically ImportError, or AttributeError"). A genuine bug in a candidate's getDOMImplementation() factory (e.g. a real AttributeError from a typo) is caught identically to "this implementation isn't available" and silently skipped.
  • Reproducer (verified): registered a fake well-known implementation whose getDOMImplementation() deliberately raises AttributeError to simulate a real bug (not a missing-module ImportError); the fallback loop silently moved on to minidom with no trace of the failure.
  • Suggested fix: Catch (ImportError, AttributeError) specifically, matching what the comment already says is "typical."
  • Difficulty: Trivial. Note: low real-world impact since well_known_implementations is a tiny, fixed, mostly-dead-code dict — good for a first-time contributor precisely because it's low-stakes.

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

Linked PRs

  • gh-155944: Catch only expected errors in getDOMImplementation fallback #155948
  • gh-155944: narrow xml.dom fallback discovery to ImportError and AttributeError #157980

Activity

  1. tobiaspal
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    on Aug 17, 2026
  2. picnixz commented on Aug 17, 2026

    @picnixz
    picnixz
    on Aug 17, 2026
    Member
    More actions

    A genuine bug in a candidate's getDOMImplementation() factory (e.g. a real AttributeError from a typo) is caught identically to "this implementation isn't available" and silently skipped.

    I don't think we should use it then. A faulty implementation is not a good enough implementation.

    Reacted by Stan Ulbrych and Paul Tobias
  3. picnixz
    added
    pendingThe issue will be closed if no feedback is providedThe issue will be closed if no feedback is provided
    on Aug 17, 2026
  4. picnixz commented on Aug 17, 2026

    @picnixz
    picnixz
    on Aug 17, 2026
    Member
    More actions

    We should just hope that getDOMImplementation is not faulty there. In particular, with sufficient test coverage, it should be fine. As such, if there's not enough coverage, you can add tests instead.

  5. picnixz
    added
    testsTests in the Lib/test dirTests in the Lib/test dir
    type-featureA feature request or enhancementA feature request or enhancement
    pendingThe issue will be closed if no feedback is providedThe issue will be closed if no feedback is provided
    and removed
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    pendingThe issue will be closed if no feedback is providedThe issue will be closed if no feedback is provided
    on Aug 17, 2026
  6. shaneraphel
    added a commit that references this issue on Sep 24, 2026

    pythongh-155944: skip a failing DOM candidate without hiding a later …

    a2a7795
  7. kevinprimeraquecreo-stack
    added this to Project_VKon Oct 18, 2026
  8. github-project-automation
    moved this to In progress in Project_VKon Oct 18, 2026
  9. kevinprimeraquecreo-stack
    added this to Project_VKon Oct 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    pendingThe issue will be closed if no feedback is providedThe issue will be closed if no feedback is providedtestsTests in the Lib/test dirTests in the Lib/test dirtype-featureA feature request or enhancementA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — 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.