bpo-29802: Fix reference counting in module-level struct functions (#1213)

when pass arguments of wrong type.
4 files changed