pyca/p3compat.h
static char *PyString_AsString(PyObject *o)
{
    static char *result = NULL;
    if (result) {
        free(result);
        result = NULL;
    }
    if (PyUnicode_Check(o)) {
        PyObject *temp_bytes = PyUnicode_AsEncodedString(o, "ASCII", "strict");
        if (temp_bytes != NULL) {
            result = PyBytes_AS_STRING(temp_bytes);
            result = strdup(result);
            Py_DECREF(temp_bytes);
            return result;
        } else {
            return NULL;
        }
    } else
        return NULL;
}
// This should suffice, as long as we don't call this twice and try to hold onto both!
This should suffice, as long as we don't call this twice and try to hold onto both!
This should suffice as long as we don ' t call this twice and try to hold onto both!
static char *PyString_AsString(PyObject *o)
{
    static char *result = NULL;
    if (result) {
        free(result);
        result = NULL;
    }
    if (PyUnicode_Check(o)) {
        PyObject *temp_bytes = PyUnicode_AsEncodedString(o, "ASCII", "strict");
        if (temp_bytes != NULL) {
            result = PyBytes_AS_STRING(temp_bytes);
            result = strdup(result);
            Py_DECREF(temp_bytes);
            return result;
        } else {
            return NULL;
        }
    } else
        return NULL;
}
static char * PyString_AsString ( PyObject * o ) { static char * result = NULL ; if ( result ) { free ( result ) ; result = NULL ; } if ( PyUnicode_Check ( o ) ) { PyObject * temp_bytes = PyUnicode_AsEncodedString ( o , " " , " " ) ; if ( temp_bytes != NULL ) { result = PyBytes_AS_STRING ( temp_bytes ) ; result = strdup ( result ) ; Py_DECREF ( temp_bytes ) ; return result ; } else { return NULL ; } } else return NULL ; }
This should suffice, as long as we don't call this twice and try to hold onto both!
This should suffice as long as we don ' t call this twice and try to hold onto both!