Skip to content

Improve debugging of Expat handlers return value #146563

@picnixz

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

Metadata

Metadata

Assignees

Labels

extension-modulesC modules in the Modules dirtype-featureA feature request or enhancement

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions