Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bob
bob.core
Commits
94c8bc48
Commit
94c8bc48
authored
Dec 02, 2015
by
Manuel Günther
Browse files
Corrected error cases in module creation
parent
b45d959f
Changes
3
Hide whitespace changes
Inline
Side-by-side
bob/core/logging.cpp
View file @
94c8bc48
...
...
@@ -469,11 +469,13 @@ static PyObject* create_module (void) {
# if PY_VERSION_HEX >= 0x03000000
PyObject
*
m
=
PyModule_Create
(
&
module_definition
);
auto
m_
=
make_xsafe
(
m
);
const
char
*
ret
=
"O"
;
# else
PyObject
*
m
=
Py_InitModule3
(
BOB_EXT_MODULE_NAME
,
module_methods
,
module_docstr
);
const
char
*
ret
=
"N"
;
# endif
if
(
!
m
)
return
0
;
auto
m_
=
make_safe
(
m
);
static
void
*
PyBobCoreLogging_API
[
PyBobCoreLogging_API_pointers
];
...
...
@@ -510,7 +512,7 @@ static PyObject* create_module (void) {
/* imports dependencies */
if
(
import_bob_blitz
()
<
0
)
return
0
;
return
Py_BuildValue
(
"O"
,
m
);
return
Py_BuildValue
(
ret
,
m
);
}
PyMODINIT_FUNC
BOB_EXT_ENTRY_NAME
(
void
)
{
...
...
bob/core/random/main.cpp
View file @
94c8bc48
...
...
@@ -59,11 +59,13 @@ static PyObject* create_module (void) {
# if PY_VERSION_HEX >= 0x03000000
PyObject
*
m
=
PyModule_Create
(
&
module_definition
);
auto
m_
=
make_xsafe
(
m
);
const
char
*
ret
=
"O"
;
# else
PyObject
*
m
=
Py_InitModule3
(
BOB_EXT_MODULE_NAME
,
module_methods
,
module_docstr
);
const
char
*
ret
=
"N"
;
# endif
if
(
!
m
)
return
0
;
auto
m_
=
make_safe
(
m
);
/* register the types to python */
if
(
!
init_BoostMt19937
(
m
))
return
0
;
...
...
@@ -161,7 +163,7 @@ static PyObject* create_module (void) {
/* imports dependencies */
if
(
import_bob_blitz
()
<
0
)
return
0
;
return
Py_BuildValue
(
"O"
,
m
);
return
Py_BuildValue
(
ret
,
m
);
}
PyMODINIT_FUNC
BOB_EXT_ENTRY_NAME
(
void
)
{
...
...
bob/core/version.cpp
View file @
94c8bc48
...
...
@@ -50,11 +50,13 @@ static PyObject* create_module (void) {
# if PY_VERSION_HEX >= 0x03000000
PyObject
*
m
=
PyModule_Create
(
&
module_definition
);
auto
m_
=
make_xsafe
(
m
);
const
char
*
ret
=
"O"
;
# else
PyObject
*
m
=
Py_InitModule3
(
BOB_EXT_MODULE_NAME
,
module_methods
,
module_docstr
);
const
char
*
ret
=
"N"
;
# endif
if
(
!
m
)
return
0
;
auto
m_
=
make_safe
(
m
);
///< protects against early returns
/* register version numbers and constants */
if
(
PyModule_AddStringConstant
(
m
,
"module"
,
BOB_EXT_MODULE_VERSION
)
<
0
)
return
0
;
...
...
@@ -64,7 +66,7 @@ static PyObject* create_module (void) {
if
(
!
externals
)
return
0
;
if
(
PyModule_AddObject
(
m
,
"externals"
,
externals
)
<
0
)
return
0
;
return
Py_BuildValue
(
"O"
,
m
);
return
Py_BuildValue
(
ret
,
m
);
}
PyMODINIT_FUNC
BOB_EXT_ENTRY_NAME
(
void
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment