Skip to content

Improve debugging of Expat handlers return value #146563

Closed

Description

@picnixz

Feature or enhancement

Proposal:

While working on #146169, I forgot to add a return value to my ExternalEntityRef handler which caused me to get some weird error like:

    parser.Parse(data, True)
    ~~~~~~~~~~~~^^^^^^^^^^^^
TypeError: 'NoneType' object cannot be interpreted as an integer

The problem is in the RC_HANDLER macro which tries to convert the return value of the handler using some generic constructs. If that conversion, we just reraise, but this is annoying because we don't really know which handler raised. A simple fix is to add an exception note so that we can indicate which handler failed.

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

Linked PRs

Activity

  1. self-assigned this
    on Mar 28, 2026
  2. added
    type-feature
    extension-modules
    on Mar 28, 2026
  3. added a commit that references this issue on Mar 28, 2026
  4. added a commit that references this issue on Apr 14, 2026
  5. added a commit that references this issue on Apr 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

extension-modulestype-feature

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions