Skip to content
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

Replace type alias with compatible symbols that can be imported from ctypes.wintypes. #662

Closed
junkmd opened this issue Nov 10, 2024 · 0 comments · Fixed by #694
Closed
Labels
good first issue Good for newcomers
Milestone

Comments

@junkmd
Copy link
Collaborator

junkmd commented Nov 10, 2024

The line in __init__.py defining DWORD as an alias for c_ulong has been present since the project’s earliest commit, 938fbd5.

DWORD = c_ulong

On the other hand, in commit 56908fd, which added shelllink.py two years later, DWORD was imported from ctypes.wintypes.

from ctypes.wintypes import DWORD, WIN32_FIND_DATAA, WIN32_FIND_DATAW, MAX_PATH

The originator of ctypes and comtypes is the same person, and these libraries have historically evolved together, which has led to differences in symbol definitions like this.

Now, however, defining these aliases independently holds little value, so we could replace them where possible.

-DWORD = c_ulong
+from ctypes.wintypes import DWORD
  • We welcome keeping changes as small as possible per pull request, as it makes it easier for reviewers to check the changes.

  • If your PR addresses multiple rules or files, reviewers might consider it a large change and suggest splitting it into multiple PRs.

@junkmd junkmd added the good first issue Good for newcomers label Nov 10, 2024
@junkmd junkmd linked a pull request Dec 8, 2024 that will close this issue
@junkmd junkmd added this to the 1.4.9 milestone Dec 8, 2024
junkmd pushed a commit that referenced this issue Dec 9, 2024
* Replace alias definitions with ctypes.wintypes
imports

* Fix formatting in GUID.py and git.py

* Add noqa to DWORD import in __init__.py
Linter check disabled on import statement,
no direct use of import in module but tests depend
on DWORD import in __init__.py

* Fix formatting in __init__.py

* Fix space formatting in __init__.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant