bpo-38730: Remove usage of stpncpy as it's not supported on MSVC 2008. (GH-17081)

This commit is contained in:
Benjamin Peterson 2019-11-07 07:27:03 -08:00 committed by GitHub
parent f32bcf8c27
commit 9f94e52e8d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -252,7 +252,12 @@ structseq_repr(PyStructSequence *obj)
}
/* "typename(", limited to TYPE_MAXSIZE */
pbuf = stpncpy(pbuf, typ->tp_name, TYPE_MAXSIZE);
len = strlen(typ->tp_name);
if (len > TYPE_MAXSIZE) {
len = TYPE_MAXSIZE;
}
pbuf = memcpy(pbuf, typ->tp_name, len);
pbuf += len;
*pbuf++ = '(';
for (i=0; i < VISIBLE_SIZE(obj); i++) {