Skip to content

[FEATURE REQUEST]: Improve error logging with new inc_ref() feature #4426

@EthanSteinberg

Description

@EthanSteinberg

Required prerequisites

What version (or hash if on master) of pybind11 are you using?

2.10.2

Problem description

In 2.10.2, @rwgk added a really neat feature to detect undefined behavior by double checking the GIL on reference counter calls.

Unfortunately (as experienced by our users, scipy/scipy#17644), the error messages here are really bad, especially on Windows.

We need a better error message strategy here to avoid user confusion.

This is tricky because this feels like a regression to our users when we really want to better inform them about UB in their code.

Reproducible example code

https://github.com/tylerjereddy/pybind_repro is a really nice Windows example that has terrible error messaging.

Is this a regression? Put the last known working version here if it is.

2.10.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    triageNew bug, unverified

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions