Skip to content

Commit f5dc8b7

Browse files
committed
Use PyString_Size rather than strlen for Python 2
1 parent f6d66a7 commit f5dc8b7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

extension/maxminddb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ static int ip_converter(PyObject *obj, struct sockaddr_storage *ip_address)
184184
// Although this should work on Python 3, we will hopefully delete
185185
// this soon and the Python 3 version is cleaner.
186186
const char *ipstr = PyString_AsString(obj);
187-
Py_ssize_t len = strlen(ipstr);
187+
Py_ssize_t len = PyString_Size(obj);
188188
#endif
189189
if (!ipstr) {
190190
PyErr_SetString(PyExc_TypeError,

0 commit comments

Comments
 (0)