make get_primitive_structure return a copy
Automatic Py3k merge for testing