Skip to content

Commit 33d219c

Browse files
committed
gh-153569: Reuse the incremental decoder factory helper
1 parent ffb781d commit 33d219c

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

‎Parser/tokenizer/decoder.c‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -429,12 +429,8 @@ _PyTok_StartDecoder(struct tok_state *tok, const char *errors)
429429

430430
PyObject *codec = _PyCodec_LookupTextEncoding(reader->encoding, NULL);
431431
if (codec != NULL) {
432-
PyObject *factory = PyObject_GetAttrString(codec, "incrementaldecoder");
432+
reader->decoder = _PyCodecInfo_GetIncrementalDecoder(codec, errors);
433433
Py_DECREF(codec);
434-
if (factory != NULL) {
435-
reader->decoder = PyObject_CallFunction(factory, "s", errors);
436-
Py_DECREF(factory);
437-
}
438434
}
439435
if (reader->decoder == NULL) {
440436
tok->done = PyErr_ExceptionMatches(PyExc_MemoryError)

0 commit comments

Comments
 (0)