FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

`_CField` as a generic descriptor protocol by junkmd · Pull Request #10595 · python/typeshed · GitHub

Repository navigation

_CField as a generic descriptor protocol - #10595

Merged
srittau merged 5 commits into
python:mainfrom
junkmd:c_field_as_descriptor
Sep 1, 2023
Merged

srittau merged 5 commits into
python:mainfrom
junkmd:c_field_as_descriptor

Conversation

junkmd commented Aug 17, 2023

Copy link
Copy Markdown
Contributor

Please see #10567

This comment has been minimized.

junkmd commented Aug 17, 2023

Copy link
Copy Markdown
Contributor Author

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

This comment has been minimized.

junkmd commented Aug 30, 2023

Copy link
Copy Markdown
Contributor Author

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 commented Sep 1, 2023

Copy link
Copy Markdown
Collaborator

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 Bot commented Sep 1, 2023

Copy link
Copy Markdown
Contributor

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 commented Sep 1, 2023

Copy link
Copy Markdown
Contributor Author

@srittau

It's good catch. Thank you.

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

I did that.

srittau left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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

srittau merged commit 4009efa into python:main Sep 1, 2023
junkmd deleted the c_field_as_descriptor branch September 1, 2023 14:29
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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


Back | FazBrowse Home | New Git URL