Skip to content

[BUG]: Potential null pointer dereference after update to pybind11 3.0 #5755

@yamedvedya

Description

@yamedvedya

Required prerequisites

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

3.0.0

Problem description

Hi, after update from 2.13.6 to 3.0.0 for python >=3.11 I started to get :

      inlined from 'void pybind11::cpp_function::initialize_generic(unique_function_record&&, const char*, const std::type_info* const*, pybind11::size_t)' at /home/matveyev/miniforge3/envs/tangodev_13/lib/python3.13/site-packages/pybind11/include/pybind11/pybind11.h:605:30:
  /home/matveyev/miniforge3/envs/tangodev_13/include/python3.13/cpython/methodobject.h:48:16: error: potential null pointer dereference [-Werror=null-dereference]
     48 |         return _Py_NULL;
        |                ^~~~~~~~
  cc1plus: all warnings being treated as errors

However, somehow it is not 100% obvious for me, what was changed in 3.0 wrt 2.13, that this appeared. Any hints?

Reproducible example code


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

2.13.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    triageNew bug, unverified

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions