Skip to content

Support additinal attributes in callback protocols#14084

Merged
ilevkivskyi merged 2 commits intopython:masterfrom
ilevkivskyi:callback-proto-extra
Nov 13, 2022
Merged

Support additinal attributes in callback protocols#14084
ilevkivskyi merged 2 commits intopython:masterfrom
ilevkivskyi:callback-proto-extra

Conversation

@ilevkivskyi
Copy link
Copy Markdown
Member

Fixes #10976
Fixes #10403

This is quite straightforward. Note that we will not allow arbitrary attributes on functions, only those that are defined in types.FunctionType (or more precisely builtins.function that is identical). We have a separate issue for arbitrary attributes #2087

@github-actions

This comment has been minimized.

@github-actions
Copy link
Copy Markdown
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

psycopg (https://github.com/psycopg/psycopg)
+ tests/test_server_cursor_async.py:23: error: Unused "type: ignore" comment
+ tests/test_server_cursor.py:20: error: Unused "type: ignore" comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Callback protocol with other attributes Structural subtyping: unawareness of special attributes of user-defined functions.

2 participants