ticket #508 check using hasattr if object has either __globals__ or func_globals attribute