Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Codec error handling callback should return newpos > start #96872

Open
Labels
@serhiy-storchaka

Description

@serhiy-storchaka

According toPEP 293, the codec error handling callback should either raise an exception or return a pair(replacement, newpos).newpos specifies a new position within object, where the encoder/decoder will continue encoding/decoding. Negative values fornewpos are treated as being relative to end of object. PEP 293 does not specify the bound ofnewpos, and this is a problem.

Ifnewpos == start, the codec will not advance. Ifreplacement is empty, it will just hang in an infinite loop, calling the callback again and again. Ifreplacement is not empty, it will additionally add it in an internal buffer, and finally, after long time, you will get a MemoryError. Ifnewpos < start, the behavior may be even more weird.

Before fixing other errors in#81000 it even caused a crash, but now it is only an infinite loop.

I propose to limit the returning value by range[start+1, len(object)].

@malemburg,@doerwalter,@vstinner

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp