MAINT: use PyOS_snprintf instead of snprintf

PyOS_snprintf is portable and more secure than snprintf.
Merge pull request #3418 from cgohlke/patch-4

MAINT: use PyOS_snprintf instead of snprintf