[1.5.x] Fixed #20212 - __reduce__ should only be defined for Py3+.