Skip to content

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