Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
bob.ap
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.ap
Commits
80fef65f
Commit
80fef65f
authored
Mar 23, 2014
by
André Anjos
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid premature GC
parent
98e07d1d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
1 deletion
+20
-1
xbob/ap/version.cpp
xbob/ap/version.cpp
+20
-1
No files found.
xbob/ap/version.cpp
View file @
80fef65f
...
...
@@ -22,6 +22,15 @@
#include <xbob.blitz/capi.h>
#include <xbob.blitz/cleanup.h>
static
int
dict_set
(
PyObject
*
d
,
const
char
*
key
,
const
char
*
value
)
{
PyObject
*
v
=
Py_BuildValue
(
"s"
,
value
);
if
(
!
v
)
return
0
;
int
retval
=
PyDict_SetItemString
(
d
,
key
,
v
);
Py_DECREF
(
v
);
if
(
retval
==
0
)
return
1
;
//all good
return
0
;
//a problem occurred
}
static
int
dict_steal
(
PyObject
*
d
,
const
char
*
key
,
PyObject
*
value
)
{
if
(
!
value
)
return
0
;
int
retval
=
PyDict_SetItemString
(
d
,
key
,
value
);
...
...
@@ -86,18 +95,28 @@ static PyObject* numpy_version() {
"api"
,
BOOST_PP_STRINGIZE
(
NPY_API_VERSION
));
}
/**
* Xbob.Blitz c/c++ api version
*/
static
PyObject
*
xbob_blitz_version
()
{
return
Py_BuildValue
(
"{ss}"
,
"api"
,
BOOST_PP_STRINGIZE
(
XBOB_BLITZ_API_VERSION
));
}
static
PyObject
*
build_version_dictionary
()
{
PyObject
*
retval
=
PyDict_New
();
if
(
!
retval
)
return
0
;
auto
retval_
=
make_safe
(
retval
);
if
(
!
dict_set
(
retval
,
"Blitz++"
,
BZ_VERSION
))
return
0
;
if
(
!
dict_steal
(
retval
,
"Boost"
,
boost_version
()))
return
0
;
if
(
!
dict_steal
(
retval
,
"Compiler"
,
compiler_version
()))
return
0
;
if
(
!
dict_steal
(
retval
,
"Python"
,
python_version
()))
return
0
;
if
(
!
dict_steal
(
retval
,
"Bob"
,
bob_version
()))
return
0
;
if
(
!
dict_steal
(
retval
,
"NumPy"
,
numpy_version
()))
return
0
;
if
(
!
dict_steal
(
retval
,
"Xbob.Blitz"
,
xbob_blitz_version
()))
return
0
;
if
(
!
dict_steal
(
retval
,
"Bob"
,
bob_version
()))
return
0
;
Py_INCREF
(
retval
);
return
retval
;
}
...
...
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