pybind / pybind/pybind11

[QUESTION] De-deprecation of direct call to module constructor

Open
#2,718 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
18k
Forks
2.3k
Avg merge
5d 17h
Merged PRs (30d)
10

Description

We explicitely use the module constructor instead of the macro in xeus-python, and got the deprecation warning:

warning: 'pybind11::module_::module_(const char*, const char*)' is deprecated: Use PYBIND11_MODULE or module_::create_extension_module instead [-Wdeprecated-declarations]

Replacing

py::module foobar_module("foobar");	

with

py::module foobar_module = py::module_::create_extension_module("foobar", nullptr, new py::module_::module_def);

fixes it, but we find it a bit too verbose. Why not allowing direct calls to the constructor?

Contributor guide

Open the contributing guide

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

Begin with pybind11::module_::module_ and module_::create_extension_module, comparing them with PYBIND11_MODULE. Determine whether direct constructor calls should remain supported without the deprecation warning, and document the decision or acceptance criteria; no files or tests are named in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, python
Domain
api, backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.