pybind / pybind/pybind11-stubgen

TypeError: No Python class registered for C++ class

Open
#232 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
361
Forks
75
PR merge metrics
No merged PRs in 30d

Description

I'm trying pybind-stubgen on libtorrent, which apparently uses Boost::python.

$ pybind11-stubgen --ignore-all-errors libtorrent
Traceback (most recent call last):
  File "/home/lenard/git/torrent/venv/bin/pybind11-stubgen", line 8, in <module>
    sys.exit(main())
  File "/home/lenard/git/torrent/venv/lib/python3.10/site-packages/pybind11_stubgen/__init__.py", line 319, in main
    run(
  File "/home/lenard/git/torrent/venv/lib/python3.10/site-packages/pybind11_stubgen/__init__.py", line 357, in run
    module = parser.handle_module(
  File "/home/lenard/git/torrent/venv/lib/python3.10/site-packages/pybind11_stubgen/parser/mixins/error_handlers.py", line 45, in handle_module
    return super().handle_module(path, module)
  File "/home/lenard/git/torrent/venv/lib/python3.10/site-packages/pybind11_stubgen/parser/mixins/fix.py", line 207, in handle_module
    result = super().handle_module(path, module)
  File "/home/lenard/git/torrent/venv/lib/python3.10/site-packages/pybind11_stubgen/parser/mixins/fix.py", line 223, in handle_module
    result = super().handle_module(path, module)
  File "/home/lenard/git/torrent/venv/lib/python3.10/site-packages/pybind11_stubgen/parser/mixins/fix.py", line 128, in handle_module
    result = super().handle_module(path, module)
  File "/home/lenard/git/torrent/venv/lib/python3.10/site-packages/pybind11_stubgen/parser/mixins/fix.py", line 451, in handle_module
    result = super().handle_module(path, module)
  File "/home/lenard/git/torrent/venv/lib/python3.10/site-packages/pybind11_stubgen/parser/mixins/parse.py", line 90, in handle_module
    obj = self.handle_module_member(
  File "/home/lenard/git/torrent/venv/lib/python3.10/site-packages/pybind11_stubgen/parser/mixins/filter.py", line 119, in handle_module_member
    return super().handle_module_member(path, module, obj)
  File "/home/lenard/git/torrent/venv/lib/python3.10/site-packages/pybind11_stubgen/parser/mixins/filter.py", line 136, in handle_module_member
    result = super().handle_module_member(path, module, obj)
  File "/home/lenard/git/torrent/venv/lib/python3.10/site-packages/pybind11_stubgen/parser/mixins/parse.py", line 133, in handle_module_member
    return self.handle_class(path, member)
  File "/home/lenard/git/torrent/venv/lib/python3.10/site-packages/pybind11_stubgen/parser/mixins/error_handlers.py", line 49, in handle_class
    return super().handle_class(path, class_)
  File "/home/lenard/git/torrent/venv/lib/python3.10/site-packages/pybind11_stubgen/parser/mixins/fix.py", line 110, in handle_class
    result = super().handle_class(path, class_)
  File "/home/lenard/git/torrent/venv/lib/python3.10/site-packages/pybind11_stubgen/parser/mixins/parse.py", line 48, in handle_class
    for name, member in inspect.getmembers(class_):
  File "/usr/lib/python3.10/inspect.py", line 469, in getmembers
    value = getattr(object, key)
TypeError: No Python class registered for C++ class deprecate_visitor<int libtorrent::fingerprint::*>

version: 2.5.1
libtorrent version: 2.0.9

I would expect --ignore-all-errors to pass.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure with the reported pybind11-stubgen command and libtorrent versions. Start in pybind11_stubgen/parser/mixins/error_handlers.py, then trace the handle_class and handle_module paths shown in the traceback. Done means --ignore-all-errors handles this class-inspection error without terminating stub generation.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.