fix possible double free in TextIOWrapper.__init__ (closes #22849)
merge 3.4 (#22849)
add space