fix a memory corruption in attrs.

add the attrs api to py