MAINT: use PyOS_snprintf instead of snprintf

PyOS_snprintf is portable and more secure than snprintf.