Skip to content

Commit 9f94e52

Browse files
authored
bpo-38730: Remove usage of stpncpy as it's not supported on MSVC 2008. (GH-17081)
1 parent f32bcf8 commit 9f94e52

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Objects/structseq.c

+6-1
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,12 @@ structseq_repr(PyStructSequence *obj)
252252
}
253253

254254
/* "typename(", limited to TYPE_MAXSIZE */
255-
pbuf=stpncpy(pbuf, typ->tp_name, TYPE_MAXSIZE);
255+
len=strlen(typ->tp_name);
256+
if (len>TYPE_MAXSIZE) {
257+
len=TYPE_MAXSIZE;
258+
}
259+
pbuf=memcpy(pbuf, typ->tp_name, len);
260+
pbuf+=len;
256261
*pbuf++='(';
257262

258263
for (i=0; i<VISIBLE_SIZE(obj); i++) {

0 commit comments

Comments
 (0)
close