81{
82 if ( inputCmd.empty() ) {
83 return;
84 }
85
86
89
90
91
92
94 (char*)"s",
95 inputCmd.c_str());
98 std::string
error =
"problem while parsing command [" + inputCmd +
"]";
99 throw std::runtime_error (error);
100 }
101
102 if (!PyTuple_Check (
res)) {
104 std::string
error =
"expected a python tuple";
105 throw std::runtime_error (error);
106 }
107
108 if (PyTuple_GET_SIZE (
res) != 3) {
110 std::string
error =
"expected a python tuple of size 3";
111 throw std::runtime_error (error);
112 }
113
116 if (!
sc || !PyLong_Check (
sc)) {
119 std::string
error =
"corrupted return code";
120 throw std::runtime_error (error);
121 }
122
123 Py_ssize_t
status = PyLong_AsSsize_t (
sc);
124 if (status != 0) {
127 std::string
error =
"failed to parse command ["+inputCmd+
"]";
128 throw std::runtime_error (error);
129 }
131
133 Py_XINCREF (parents);
134 if (!parents) {
135
137 std::string
error =
"corrupted parents' list";
138 throw std::runtime_error (error);
139 }
140
142 Py_XINCREF (children);
143 if (!children) {
144 Py_DECREF (parents);
146 std::string
error =
"corrupted children' list";
147 throw std::runtime_error (error);
148 }
150
151 if (parents==Py_None && children==Py_None) {
152
153
154 Py_DECREF (parents);
155 Py_DECREF (children);
156 return;
157 }
158
160 Py_DECREF (parents);
161 Py_DECREF (children);
162 std::string
error =
"could not translate parents' list";
163 throw std::runtime_error (error);
164 }
165
167 Py_DECREF (parents);
168 Py_DECREF (children);
169 std::string
error =
"could not translate children' list";
170 throw std::runtime_error (error);
171 }
172
173 return;
174}
std::pair< std::vector< unsigned int >, bool > res
parents
print ("==> buf:",buf)