Thanks to visit codestin.com
Credit goes to github.com

Skip to content

_CField as a generic descriptor protocol #10595

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

Merged
merged 5 commits into from
Sep 1, 2023

Conversation

junkmd
Copy link
Contributor

@junkmd junkmd commented Aug 17, 2023

Please see #10567

@github-actions

This comment has been minimized.

@junkmd
Copy link
Contributor Author

junkmd commented Aug 17, 2023

Should I consider adding workarounds for the error that raises when combining stubs/pyserial/serial/win32.pyi with Pyright?

For example, using something like _CField[Any, Any, Any].

error: Expected type arguments for generic class "_CField"
(reportMissingTypeArgument)
see python#10595
@github-actions

This comment has been minimized.

@junkmd
Copy link
Contributor Author

junkmd commented Aug 30, 2023

Should I consider adding workarounds for the error that raises when combining stubs/pyserial/serial/win32.pyi with Pyright?

For example, using something like _CField[Any, Any, Any].

I added workarounds.

@srittau
Copy link
Collaborator

srittau commented Sep 1, 2023

Thanks! I assume many of the _CField[Any, Any, Any] annotations could be improved in the future? In that case, please use Incomplete (from _typeshed) instead of Any to mark that fact.

@github-actions
Copy link
Contributor

github-actions bot commented Sep 1, 2023

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

AutoSplit (https://github.com/Toufool/AutoSplit)
+ src/utils.py:104:26: error: Redundant cast to "int"  [redundant-cast]
+ src/utils.py:105:25: error: Redundant cast to "int"  [redundant-cast]
+ src/utils.py:106:20: error: Redundant cast to "int"  [redundant-cast]
+ src/utils.py:107:21: error: Redundant cast to "int"  [redundant-cast]

@junkmd
Copy link
Contributor Author

junkmd commented Sep 1, 2023

@srittau

It's good catch. Thank you.

please use Incomplete (from _typeshed) instead of Any to mark

I did that.

Copy link
Collaborator

@srittau srittau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My ctypes knowledge is limited, but this looks like an improvement to me and primer output also looks good.

@srittau srittau merged commit 4009efa into python:main Sep 1, 2023
@junkmd junkmd deleted the c_field_as_descriptor branch September 1, 2023 14:29
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.

2 participants