Fix a leak where the "refcount" of a thing was always incremented even when no wrapper was created around it

(also some assorted tiny changes)
Merge pull request #118 from pitrou/dtor_leak

Fix a leak where the "refcount" of a thing was always incremented even w...