PG Bug reporting form <noreply(at)postgresql(dot)org> writes:
> CREATE OR REPLACE FUNCTION f() RETURNS text AS $$
> import ctypes
> postgres = ctypes.CDLL(None)
> pchomp = postgres['pchomp']
> # pchomp.restype = ctypes.c_char_p
> return ctypes.cast(pchomp("error\n"), ctypes.c_char_p).value
> $$ LANGUAGE plpython3u;
This is not a Postgres bug, it's an incorrect plpython function.
Type text is not equivalent to "char *".
regards, tom lane