Arrange structure to match the common access patterns.
#18113: avoid segfault if Py_XDECREF triggers code that calls set_panel_userptr again

Problem noted & original patch by Serhiy Storchaka; I tweaked the patch a bit.
transplant test_stat from default to 2.7 in order to make sure it works on all supported platforms
backout 5accb0ac8bfb; needs more discussion on python-dev