Skip to content

Commit 4cbc2b1

Browse files
pschafhalterrobertnishihara
authored andcommitted
Clean up UT datastructures in Python extension (#1227)
1 parent 9a2e37a commit 4cbc2b1

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/common/lib/python/common_extension.cc

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
#include "common.h"
66
#include "common_extension.h"
77
#include "task.h"
8-
#include "utarray.h"
9-
#include "utstring.h"
8+
9+
#include <string>
1010

1111
PyObject *CommonError;
1212

@@ -193,11 +193,8 @@ static long PyObjectID_hash(PyObjectID *self) {
193193
static PyObject *PyObjectID_repr(PyObjectID *self) {
194194
char hex_id[ID_STRING_SIZE];
195195
ObjectID_to_string(self->object_id, hex_id, ID_STRING_SIZE);
196-
UT_string *repr;
197-
utstring_new(repr);
198-
utstring_printf(repr, "ObjectID(%s)", hex_id);
199-
PyObject *result = PyUnicode_FromString(utstring_body(repr));
200-
utstring_free(repr);
196+
std::string repr = "ObjectID(" + std::string(hex_id) + ")";
197+
PyObject *result = PyUnicode_FromString(repr.c_str());
201198
return result;
202199
}
203200

0 commit comments

Comments
 (0)