Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Stack Of Tasks
dynamic-graph-python
Commits
9a27fc49
Commit
9a27fc49
authored
Dec 05, 2019
by
Guilhem Saurel
Browse files
[Python 2] put dgpyError as global back
to fix #39 also in Python2
parent
ccbcc4a0
Changes
6
Hide whitespace changes
Inline
Side-by-side
include/dynamic-graph/python/dynamic-graph-py.hh
View file @
9a27fc49
...
...
@@ -183,7 +183,7 @@ __attribute__((unused)) static struct PyModuleDef dynamicGraphModuleDef = {
#else
__attribute__
((
unused
))
static
struct
module_state
_state
;
#define GETSTATE(m) (&dynamicgraph::python::_state)
#define DGPYERROR(m) dynamicgraph::python::
_state.
dgpyError
#define DGPYERROR(m) dynamicgraph::python::dgpyError
#define INITERROR return
#endif
...
...
src/dynamic_graph/debug-py.cc
View file @
9a27fc49
...
...
@@ -21,6 +21,10 @@ typedef boost::shared_ptr<std::ofstream> ofstreamShrPtr;
namespace
dynamicgraph
{
namespace
python
{
#if PY_MAJOR_VERSION == 2
extern
PyObject
*
dgpyError
;
# endif
namespace
debug
{
std
::
map
<
std
::
string
,
ofstreamShrPtr
>
mapOfFiles_
;
...
...
src/dynamic_graph/dynamic-graph-py.cc
View file @
9a27fc49
...
...
@@ -14,6 +14,10 @@
namespace
dynamicgraph
{
namespace
python
{
#if PY_MAJOR_VERSION == 2
PyObject
*
dgpyError
;
# endif
/**
\brief plug a signal into another one.
*/
...
...
@@ -114,8 +118,7 @@ PyObject* error_out(
PyObject
*
,
PyObject
*
#endif
)
{
struct
module_state
*
st
=
GETSTATE
(
m
);
PyErr_SetString
(
st
->
dgpyError
,
"something bad happened"
);
PyErr_SetString
(
DGPYERROR
(
m
),
"something bad happened"
);
return
NULL
;
}
...
...
@@ -133,30 +136,29 @@ void initwrap(void)
#endif
{
#if PY_MAJOR_VERSION >= 3
PyObject
*
m
odule
=
PyModule_Create
(
&
dynamicgraph
::
python
::
dynamicGraphModuleDef
);
PyObject
*
m
=
PyModule_Create
(
&
dynamicgraph
::
python
::
dynamicGraphModuleDef
);
#else
PyObject
*
m
odule
=
Py_InitModule
(
"wrap"
,
dynamicgraph
::
python
::
dynamicGraphMethods
);
PyObject
*
m
=
Py_InitModule
(
"wrap"
,
dynamicgraph
::
python
::
dynamicGraphMethods
);
#endif
if
(
module
==
NULL
)
INITERROR
;
struct
dynamicgraph
::
python
::
module_state
*
st
=
GETSTATE
(
module
);
if
(
m
==
NULL
)
INITERROR
;
st
->
dgpyError
=
PyErr_NewException
(
const_cast
<
char
*>
(
"dynamic_graph.dgpyError"
),
NULL
,
NULL
);
if
(
st
->
dgpyError
==
NULL
)
{
Py_DECREF
(
m
odule
);
DGPYERROR
(
m
)
=
PyErr_NewException
(
const_cast
<
char
*>
(
"dynamic_graph.dgpyError"
),
NULL
,
NULL
);
if
(
DGPYERROR
(
m
)
==
NULL
)
{
Py_DECREF
(
m
);
INITERROR
;
}
Py_XINCREF
(
st
->
dgpyError
);
if
(
PyModule_AddObject
(
m
odule
,
"dgpyError"
,
st
->
dgpyError
)
<
0
)
{
Py_XDECREF
(
st
->
dgpyError
);
Py_CLEAR
(
st
->
dgpyError
);
Py_DECREF
(
m
odule
);
Py_XINCREF
(
DGPYERROR
(
m
)
);
if
(
PyModule_AddObject
(
m
,
"dgpyError"
,
DGPYERROR
(
m
)
)
<
0
)
{
Py_XDECREF
(
DGPYERROR
(
m
)
);
Py_CLEAR
(
DGPYERROR
(
m
)
);
Py_DECREF
(
m
);
INITERROR
;
}
#if PY_MAJOR_VERSION >= 3
return
m
odule
;
return
m
;
#endif
}
...
...
src/dynamic_graph/entity-py.cc
View file @
9a27fc49
...
...
@@ -32,6 +32,10 @@ namespace python {
using
namespace
convert
;
#if PY_MAJOR_VERSION == 2
extern
PyObject
*
dgpyError
;
# endif
namespace
entity
{
/**
...
...
src/dynamic_graph/pool-py.cc
View file @
9a27fc49
...
...
@@ -10,6 +10,10 @@
namespace
dynamicgraph
{
namespace
python
{
#if PY_MAJOR_VERSION == 2
extern
PyObject
*
dgpyError
;
# endif
namespace
pool
{
PyObject
*
writeGraph
(
...
...
src/dynamic_graph/signal-base-py.cc
View file @
9a27fc49
...
...
@@ -21,6 +21,10 @@ using dynamicgraph::SignalBase;
namespace
dynamicgraph
{
namespace
python
{
#if PY_MAJOR_VERSION == 2
extern
PyObject
*
dgpyError
;
# endif
using
namespace
convert
;
namespace
signalBase
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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