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

sys.set_asyncgen_hooks with invalid firstiter may partially set finalizer #118473

Closed
Labels
type-bugAn unexpected behavior, bug, or error
@youknowone

Description

@youknowone

Bug report

Bug description:

finalizer=lambda*a:Nonetry:sys.set_asyncgen_hooks(firstiter="invalid",finalizer=finalizer)exceptTypeError:# TypeError due to invalid `firstiter` typecur=sys.get_asyncgen_hooks()self.assertIsNone(cur.firstiter)# This is not setself.assertIsNone(cur.finalizer)# But this is set

PEP 525 doesn't imply or define partial initialization priority. Since inside ofset_asyncgen_hooks is blackbox to user, this is surprising and users are hard to know they have to back up current setup and recover it whenTypeError happens.

Inconsistency also cause user experience problem. Current ordersys.set_asyncgen_hooks(firstiter="invalid", finalizer=finalizer) causes partial set, butsys.set_asyncgen_hooks(firstiter=finalizer, finalizer="invalid") will not.

CPython versions tested on:

CPython main branch

Operating systems tested on:

macOS

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp