Skip to content
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.

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

Enable "factory sets error and returns nullptr" #30064

Merged
merged 2 commits into from
Sep 12, 2023

Conversation

rwgk
Copy link
Contributor

@rwgk rwgk commented Sep 8, 2023

Description

This is a very simple change in support of the PyCLIF-pybind11 integration work:

Merely an extra if to pre-empt TypeError: pybind11::init(): factory function returned nullptr. This allows the factory function to set a custom Python error instead.

Manually written factory functions could throw error_already_set() directly, but in the context of PyCLIF that is very difficult (compared to this very simple PR), because the factory function can be completely unaware of pybind11.

Suggested changelog entry:

@rwgk rwgk merged commit f0fd911 into google:main Sep 12, 2023
149 checks passed
@rwgk rwgk deleted the factory_error_already_set_pywrapcc branch September 12, 2023 23:40
rwgk pushed a commit to rwgk/pybind11 that referenced this pull request Sep 12, 2023
This is a very simple change in support of the PyCLIF-pybind11 integration work:

Merely an extra `if` to pre-empt `TypeError: pybind11::init(): factory function returned nullptr`. This allows the factory function to set a custom Python error instead.

Manually written factory functions could `throw error_already_set()` directly, but in the context of PyCLIF that is very difficult (compared to this very simple PR), because the factory function can be completely unaware of pybind11.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants