[FEA]: change function __qualname__ prefix
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 18k
- Forks
- 2.3k
- Avg merge
- 5d 17h
- Merged PRs (30d)
- 10
Description
Required prerequisites
- Make sure you've read the documentation. Your issue may be addressed there.
- Search the issue tracker and Discussions to verify that this hasn't already been reported. +1 or comment there if it has.
- Consider asking first in the Gitter chat room or in a Discussion.
What version (or hash if on master) of pybind11 are you using?
3.0.0
Problem description
When defining a function with pybind11 and inspecting the __qualname__ attribute in python it has a prefix that I was not expecting.
In Pybind11 2.13.6 __qualname__ was PyCapsule.function_name
In Pybind11 3.0.0 __qualname__ is pybind11_detail_function_record_v1_msvc_md_mscver19.function_name
Is this expected behaviour?
I was expecting this value to just be function_name
I noticed this when running pybind11 stubgen on the library built with the new version of pybind11 and it created an import like the following. This can probably be patched in pybind11 stubgen if this behaviour is intended.
from mod.pybind11_detail_function_record_v1_msvc_md_mscver19 import function_name
PEP 3155 defines __qualname__
Reproducible example code
#include <pybind11/pybind11.h>
PYBIND11_MODULE(mod, m)
{
m.def("function_name", [](){});
}
Is this a regression? Put the last known working version here if it is.
Not a regression
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the PYBIND11_MODULE example and m.def("function_name", {}) entry point, then compare the generated qualname in pybind11 2.13.6 and 3.0.0. Determine whether the prefix should be removed or documented as expected, and verify that the resulting value no longer causes pybind11 stubgen to import a module named pybind11_detail_function_record_v1_msvc_md_mscver19.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, python
- Domain
- backend-api-design
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100