Skip to content

Commit d442daa

Browse files
authored
Remove the function module_new() (#1186)
1 parent 77980ce commit d442daa

File tree

3 files changed

+1
-14
lines changed

3 files changed

+1
-14
lines changed

include/nanobind/nb_lib.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -455,9 +455,6 @@ NB_CORE PyObject *module_import(const char *name);
455455
/// Try to import a Python extension module, raises an exception upon failure
456456
NB_CORE PyObject *module_import(PyObject *name);
457457

458-
/// Create a new extension module with the given name
459-
NB_CORE PyObject *module_new(const char *name, PyModuleDef *def) noexcept;
460-
461458
/// Create a submodule of an existing module
462459
NB_CORE PyObject *module_new_submodule(PyObject *base, const char *name,
463460
const char *doc) noexcept;

src/common.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -141,16 +141,6 @@ void cleanup_list::expand() noexcept {
141141

142142
// ========================================================================
143143

144-
PyObject *module_new(const char *name, PyModuleDef *def) noexcept {
145-
memset(def, 0, sizeof(PyModuleDef));
146-
def->m_name = name;
147-
def->m_size = -1;
148-
PyObject *m = PyModule_Create(def);
149-
150-
check(m, "nanobind::detail::module_new(): allocation failed!");
151-
return m;
152-
}
153-
154144
PyObject *module_import(const char *name) {
155145
PyObject *res = PyImport_ImportModule(name);
156146
if (!res)

src/nb_internals.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ NAMESPACE_BEGIN(detail)
4242
#endif
4343

4444
/// Nanobind function metadata (overloads, etc.)
45-
struct func_data : func_data_prelim<0> {
45+
struct func_data : func_data_prelim_base {
4646
arg_data *args;
4747
char *signature;
4848
};

0 commit comments

Comments
 (0)