Skip to content

_io.IncrementalNewlineDecoder doesn't inherit codecs.IncrementalDecoder #75903

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
serhiy-storchaka opened this issue Oct 7, 2017 · 3 comments
Labels
3.7 (EOL) end of life 3.8 (EOL) end of life stdlib Python modules in the Lib dir topic-IO type-bug An unexpected behavior, bug, or error

Comments

@serhiy-storchaka
Copy link
Member

BPO 31722
Nosy @benjaminp, @serhiy-storchaka, @zhangyangyu, @corona10
PRs
  • bpo-31722: Update codecs.IncrementalDecoder to use __subclasshook__ #16664
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = None
    created_at = <Date 2017-10-07.14:26:41.466>
    labels = ['3.7', '3.8', 'type-bug', 'library', 'expert-IO']
    title = "_io.IncrementalNewlineDecoder doesn't inherit codecs.IncrementalDecoder"
    updated_at = <Date 2019-10-08.18:46:56.963>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2019-10-08.18:46:56.963>
    actor = 'corona10'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Library (Lib)', 'IO']
    creation = <Date 2017-10-07.14:26:41.466>
    creator = 'serhiy.storchaka'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 31722
    keywords = ['patch']
    message_count = 3.0
    messages = ['303879', '303880', '328293']
    nosy_count = 5.0
    nosy_names = ['benjamin.peterson', 'stutzbach', 'serhiy.storchaka', 'xiang.zhang', 'corona10']
    pr_nums = ['16664']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue31722'
    versions = ['Python 2.7', 'Python 3.6', 'Python 3.7', 'Python 3.8']

    @serhiy-storchaka
    Copy link
    Member Author

    It is documented that io.IncrementalNewlineDecoder inherits codecs.IncrementalDecoder. And the Python implementation does. But the C implementation doesn't.

    >>> issubclass(_pyio.IncrementalNewlineDecoder, codecs.IncrementalDecoder)
    True
    >>> issubclass(_io.IncrementalNewlineDecoder, codecs.IncrementalDecoder)
    False
    >>> issubclass(io.IncrementalNewlineDecoder, codecs.IncrementalDecoder)
    False

    @serhiy-storchaka serhiy-storchaka added 3.7 (EOL) end of life stdlib Python modules in the Lib dir topic-IO type-bug An unexpected behavior, bug, or error labels Oct 7, 2017
    @serhiy-storchaka
    Copy link
    Member Author

    As a consequence, _io.IncrementalNewlineDecoder doesn't have the error attribute.

    @zhangyangyu
    Copy link
    Member

    Just find the same problem while investigating io.

    @zhangyangyu zhangyangyu added the 3.8 (EOL) end of life label Oct 23, 2018
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    tungol added a commit to tungol/typeshed that referenced this issue Dec 10, 2023
    …ecoder
    
    The documentation says that this cass "inherits codecs.IncrementalDecoder",
    but it's not true for the C implementation.
    
    The python implementation, _pyio.io.IncrementalNewlineDecoder, *does*
    inherit from codecs.IncrementalDecoder, but that's not the implementation
    that you get with `from io import IncrementalNewlineDecoder`.
    
    cpython has a ticket for this issue here: python/cpython#75903
    
    In the meantime, I think this is more correct.
    
    Related to python#3968
    tungol added a commit to tungol/typeshed that referenced this issue Dec 10, 2023
    …ecoder
    
    The documentation says that this cass "inherits codecs.IncrementalDecoder",
    but it's not true for the C implementation.
    
    The python implementation, _pyio.IncrementalNewlineDecoder, *does*
    inherit from codecs.IncrementalDecoder, but that's not the implementation
    that you get with `from io import IncrementalNewlineDecoder`.
    
    cpython has a ticket for this issue here: python/cpython#75903
    
    In the meantime, I think this is more correct.
    
    Related to python#3968
    tungol added a commit to tungol/typeshed that referenced this issue Dec 10, 2023
    …ecoder
    
    The documentation says that this class "inherits codecs.IncrementalDecoder",
    but it's not true for the C implementation.
    
    The python implementation, _pyio.IncrementalNewlineDecoder, *does*
    inherit from codecs.IncrementalDecoder, but that's not the implementation
    that you get with `from io import IncrementalNewlineDecoder`.
    
    cpython has a ticket for this issue here: python/cpython#75903
    
    In the meantime, I think this is more correct.
    
    Related to python#3968
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life 3.8 (EOL) end of life stdlib Python modules in the Lib dir topic-IO type-bug An unexpected behavior, bug, or error
    Projects
    Development

    No branches or pull requests

    2 participants