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) {
136 std::string
error =
"corrupted parents' list";
137 throw std::runtime_error (error);
138 }
139
141 Py_XINCREF (children);
142 if (!children) {
143 Py_DECREF (parents);
145 std::string
error =
"corrupted children' list";
146 throw std::runtime_error (error);
147 }
149
150 if (parents==Py_None && children==Py_None) {
151
152
153 Py_DECREF (parents);
154 Py_DECREF (children);
155 return;
156 }
157
159 Py_DECREF (parents);
160 Py_DECREF (children);
161 std::string
error =
"could not translate parents' list";
162 throw std::runtime_error (error);
163 }
164
166 Py_DECREF (parents);
167 Py_DECREF (children);
168 std::string
error =
"could not translate children' list";
169 throw std::runtime_error (error);
170 }
171
172 return;
173}
std::pair< std::vector< unsigned int >, bool > res
parents
print ("==> buf:",buf)