Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
bob.learn.libsvm
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bob
bob.learn.libsvm
Commits
28f0cf7c
Commit
28f0cf7c
authored
Dec 03, 2015
by
Manuel Günther
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Corrected error cases in module creation
parent
ed4209f8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
17 deletions
+21
-17
bob/learn/libsvm/main.cpp
bob/learn/libsvm/main.cpp
+11
-9
bob/learn/libsvm/version.cpp
bob/learn/libsvm/version.cpp
+10
-8
No files found.
bob/learn/libsvm/main.cpp
View file @
28f0cf7c
...
...
@@ -47,22 +47,24 @@ static PyObject* create_module (void) {
if
(
PyType_Ready
(
&
PyBobLearnLibsvmTrainer_Type
)
<
0
)
return
0
;
# if PY_VERSION_HEX >= 0x03000000
PyObject
*
m
=
PyModule_Create
(
&
module_definition
);
PyObject
*
module
=
PyModule_Create
(
&
module_definition
);
auto
module_
=
make_xsafe
(
module
);
const
char
*
ret
=
"O"
;
# else
PyObject
*
m
=
Py_InitModule3
(
BOB_EXT_MODULE_NAME
,
module_methods
,
module_docstr
);
PyObject
*
module
=
Py_InitModule3
(
BOB_EXT_MODULE_NAME
,
module_methods
,
module_docstr
);
const
char
*
ret
=
"N"
;
# endif
if
(
!
m
)
return
0
;
auto
m_
=
make_safe
(
m
);
if
(
!
module
)
return
0
;
/* register the types to python */
Py_INCREF
(
&
PyBobLearnLibsvmFile_Type
);
if
(
PyModule_AddObject
(
m
,
"File"
,
(
PyObject
*
)
&
PyBobLearnLibsvmFile_Type
)
<
0
)
return
0
;
if
(
PyModule_AddObject
(
m
odule
,
"File"
,
(
PyObject
*
)
&
PyBobLearnLibsvmFile_Type
)
<
0
)
return
0
;
Py_INCREF
(
&
PyBobLearnLibsvmMachine_Type
);
if
(
PyModule_AddObject
(
m
,
"Machine"
,
(
PyObject
*
)
&
PyBobLearnLibsvmMachine_Type
)
<
0
)
return
0
;
if
(
PyModule_AddObject
(
m
odule
,
"Machine"
,
(
PyObject
*
)
&
PyBobLearnLibsvmMachine_Type
)
<
0
)
return
0
;
Py_INCREF
(
&
PyBobLearnLibsvmTrainer_Type
);
if
(
PyModule_AddObject
(
m
,
"Trainer"
,
(
PyObject
*
)
&
PyBobLearnLibsvmTrainer_Type
)
<
0
)
return
0
;
if
(
PyModule_AddObject
(
m
odule
,
"Trainer"
,
(
PyObject
*
)
&
PyBobLearnLibsvmTrainer_Type
)
<
0
)
return
0
;
static
void
*
PyBobLearnLibsvm_API
[
PyBobLearnLibsvm_API_pointers
];
...
...
@@ -129,14 +131,14 @@ static PyObject* create_module (void) {
#endif
if
(
c_api_object
)
PyModule_AddObject
(
m
,
"_C_API"
,
c_api_object
);
if
(
c_api_object
)
PyModule_AddObject
(
m
odule
,
"_C_API"
,
c_api_object
);
/* imports dependencies */
if
(
import_bob_blitz
()
<
0
)
return
0
;
if
(
import_bob_core_logging
()
<
0
)
return
0
;
if
(
import_bob_io_base
()
<
0
)
return
0
;
return
Py_BuildValue
(
"O"
,
m
);
return
Py_BuildValue
(
ret
,
module
);
}
PyMODINIT_FUNC
BOB_EXT_ENTRY_NAME
(
void
)
{
...
...
bob/learn/libsvm/version.cpp
View file @
28f0cf7c
...
...
@@ -55,25 +55,27 @@ static PyModuleDef module_definition = {
static
PyObject
*
create_module
(
void
)
{
# if PY_VERSION_HEX >= 0x03000000
PyObject
*
m
=
PyModule_Create
(
&
module_definition
);
PyObject
*
module
=
PyModule_Create
(
&
module_definition
);
auto
module_
=
make_xsafe
(
module
);
const
char
*
ret
=
"O"
;
# else
PyObject
*
m
=
Py_InitModule3
(
BOB_EXT_MODULE_NAME
,
module_methods
,
module_docstr
);
PyObject
*
module
=
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
if
(
!
module
)
return
0
;
/* register version numbers and constants */
if
(
PyModule_AddIntConstant
(
m
,
"api"
,
BOB_LEARN_LIBSVM_API_VERSION
)
<
0
)
return
0
;
if
(
PyModule_AddStringConstant
(
m
,
"module"
,
BOB_EXT_MODULE_VERSION
)
<
0
)
return
0
;
if
(
PyModule_AddIntConstant
(
m
odule
,
"api"
,
BOB_LEARN_LIBSVM_API_VERSION
)
<
0
)
return
0
;
if
(
PyModule_AddStringConstant
(
m
odule
,
"module"
,
BOB_EXT_MODULE_VERSION
)
<
0
)
return
0
;
PyObject
*
externals
=
build_version_dictionary
();
if
(
!
externals
)
return
0
;
if
(
PyModule_AddObject
(
m
,
"externals"
,
externals
)
<
0
)
return
0
;
if
(
PyModule_AddObject
(
m
odule
,
"externals"
,
externals
)
<
0
)
return
0
;
// call bob_learn_libsvm_version once to avoid compiler warnings
auto
_
=
make_safe
(
bob_learn_libsvm_version
());
return
Py_BuildValue
(
"O"
,
m
);
return
Py_BuildValue
(
ret
,
module
);
}
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