Skip to content

Commit 7f64ed3

Browse files
committed
Fix allocation failure error message
1 parent 01a53c7 commit 7f64ed3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

include/pybind11/pybind11.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -899,8 +899,8 @@ class module_ : public object {
899899
#else
900900
m_ptr = PyModule_New(name);
901901
#endif
902-
if (m_ptr == nullptr)
903-
pybind11_fail("Internal error in module_::module_()");
902+
if (!m_ptr)
903+
pybind11_fail("Could not allocate module object!");
904904
if (doc && options::show_user_defined_docstrings()) {
905905
#if PY_MAJOR_VERSION >= 3 && !defined(PYPY_VERSION)
906906
if (PyModule_SetDocString(m_ptr, doc) != 0)

0 commit comments

Comments
 (0)