clear BufferedRWPair weakrefs on deallocation (closes #22517)
prevent overflow in unicode_repr (closes #22520)