We have a function in pandas/_libs/tslibs/util.pxd called get_c_string_buf_and_size . I think this served a purpose when we had Python 2/3 compat but at the moment it just wraps the standard PyUnicode_AsUTF8AndSize function, so it adds an unnecessary layer