Skip to content
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

asynchat's handle_error inconsistency #48527

Closed
giampaolo opened this issue Nov 7, 2008 · 5 comments
Closed

asynchat's handle_error inconsistency #48527

giampaolo opened this issue Nov 7, 2008 · 5 comments
Assignees
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@giampaolo
Copy link
Contributor

BPO 4277
Nosy @nirs, @vstinner, @giampaolo, @intgr, @iritkatriel
Files
  • asynchat.patch
  • 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 = 'https://github.com/giampaolo'
    closed_at = <Date 2021-06-15.18:50:50.942>
    created_at = <Date 2008-11-07.12:14:52.567>
    labels = ['type-bug', 'library']
    title = "asynchat's handle_error inconsistency"
    updated_at = <Date 2021-06-15.18:50:50.941>
    user = 'https://github.com/giampaolo'

    bugs.python.org fields:

    activity = <Date 2021-06-15.18:50:50.941>
    actor = 'iritkatriel'
    assignee = 'giampaolo.rodola'
    closed = True
    closed_date = <Date 2021-06-15.18:50:50.942>
    closer = 'iritkatriel'
    components = ['Library (Lib)']
    creation = <Date 2008-11-07.12:14:52.567>
    creator = 'giampaolo.rodola'
    dependencies = []
    files = ['11959']
    hgrepos = []
    issue_num = 4277
    keywords = ['patch']
    message_count = 5.0
    messages = ['75601', '140534', '225996', '226090', '395893']
    nosy_count = 5.0
    nosy_names = ['nirs', 'vstinner', 'giampaolo.rodola', 'intgr', 'iritkatriel']
    pr_nums = []
    priority = 'normal'
    resolution = 'out of date'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue4277'
    versions = ['Python 2.7', 'Python 3.4', 'Python 3.5']

    @giampaolo
    Copy link
    Contributor Author

    Suppose you have tow sockets handled by two asynchat.async_chat class
    instances and from class1 you want to send some data through class2:

    class1(asynchat.async_chat):

    ...

    def mymethod(self):
    class2_instance.push_with_producer(producer)

    Since push_with_producer automatically calls initiate_send() if an error
    occurs while class2 reads the first chunk of data from the producer,
    class1's handle_error gets called.
    If the error occurs when reading the next chunks of data class2's
    handle_error will be called instead.
    This is an inconsistency that should be fixed so that always class2's
    handle_error gets called.

    The patch in attachment does that.

    @giampaolo giampaolo added stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Nov 7, 2008
    @giampaolo giampaolo self-assigned this Jul 10, 2010
    @nirs
    Copy link
    Mannequin

    nirs mannequin commented Jul 17, 2011

    The idea is good, but seems that error handling should be inlined into initiate_send.

    Also those 3 special exceptions should be defined once in the module instead of repeating them.

    @vstinner
    Copy link
    Member

    This issue is 6 years old. I don't understand the bug and the patch has no unit test. I suggest to close the issue as out of date. The asynchat module is now deprecated in favor of the new shiny asyncio module.

    @BreamoreBoy
    Copy link
    Mannequin

    BreamoreBoy mannequin commented Aug 29, 2014

    bpo-6550 and bpo-11267 have been closed as out of date as asynchat and asyncore are effectively deprecated in favour of asyncio so can't this go the same way?

    @iritkatriel
    Copy link
    Member

    asynchat has been deprecated for a long time, it's unlikely we will do anything with it now.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants