# Bug report ### Bug description: ```python finalizer = lambda *a: None try: sys.set_asyncgen_hooks(firstiter="invalid", finalizer=finalizer) except TypeError: # TypeError due to invalid `firstiter` type cur = sys.get_asyncgen_hooks() self.assertIsNone(cur.firstiter) # This is not set self.assertIsNone(cur.finalizer) # But this is set ``` [PEP 525](https://peps.python.org/pep-0525/) doesn't imply or define partial initialization priority. Since inside of `set_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 when `TypeError` happens. Inconsistency also cause user experience problem. Current order `sys.set_asyncgen_hooks(firstiter="invalid", finalizer=finalizer)` causes partial set, but `sys.set_asyncgen_hooks(firstiter=finalizer, finalizer="invalid")` will not. ### CPython versions tested on: CPython main branch ### Operating systems tested on: macOS <!-- gh-linked-prs --> ### Linked PRs * gh-118474 <!-- /gh-linked-prs -->