Skip to content

ast: Improve behavior for user-defined classes #117486

@JelleZijlstra

Description

@JelleZijlstra

From @encukou:

          Thanks for the fix. Since it's a blocker I merged it, even though I'd have one more review comment:

It would be good to add this to the new test, and improve the behaviour (the error is quite opaque):

        class MoreFieldsThanTypes(ast.AST):
            _fields = ('a', 'b')
            _field_types = {'a': int | None}
            a: int | None = None
            b: int | None = None

Originally posted by @encukou in #117266 (comment)

Based on robotframework/robotframework#5091 (comment), we should also document _field_types.

Linked PRs

Activity

self-assigned this
on Apr 2, 2024
added a commit that references this issue on Apr 24, 2024
added a commit that references this issue on May 6, 2024
e042219
added a commit that references this issue on May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    ast: Improve behavior for user-defined classes · Issue #117486 · python/cpython