Skip to content

Split IUnknown definition from __init__.py - #562

Merged
junkmd merged 1 commit into
enthought:mainfrom
junkmd:split_unknwn
Jun 9, 2024
Merged

junkmd merged 1 commit into
enthought:mainfrom
junkmd:split_unknwn

Conversation

@junkmd

@junkmd junkmd commented Jun 9, 2024

Copy link
Copy Markdown
Collaborator

The reason is same as #559,

The __init__.py of this package is very large. I think this is a barrier for newcomers to the community trying to understand this package.

Considering that the responsibility of __init__.py is to "handle the initialization of the package", calling CoInitializeEx is indeed initialization, so it is necessary in __init__.py.

However, for example, if we define things like the BSTR in other private modules and import it into __init__.py (such as current GUID module), __init__.py will become lightweight.

The metaclasses and _shutdown are strongly tied to the implementation of IUnknown, so they are also being moved to a new module.

The registration to com_interface_registry by the metaclass and the hook of CoUninitialize by _shutdown have been confirmed by tests to not break even when the codebase is moved to a different file.

The following will be done in the same way as #559.

In order to keep the change history even if we squash & merge, I will divide it into several PRs.

junkmd added a commit to junkmd/pywinauto that referenced this pull request Jun 9, 2024
@junkmd
junkmd marked this pull request as draft June 9, 2024 05:21
junkmd added a commit to junkmd/adotypes that referenced this pull request Jun 9, 2024
junkmd added a commit that referenced this pull request Jun 9, 2024
- add `unknwn.py`
- rename to `___init__.py` from `__init__.py` temporarily
junkmd added a commit that referenced this pull request Jun 9, 2024
- from `comtypes\___init__.py` to `comtypes\__init__.py`
@junkmd
junkmd marked this pull request as ready for review June 9, 2024 08:21
@junkmd
junkmd merged commit 76c3542 into enthought:main Jun 9, 2024
@junkmd
junkmd deleted the split_unknwn branch June 9, 2024 08:22
junkmd added a commit to junkmd/pywinauto that referenced this pull request Jun 9, 2024
junkmd added a commit to junkmd/adotypes that referenced this pull request Jun 9, 2024
junkmd added a commit to junkmd/adotypes that referenced this pull request Jun 9, 2024
junkmd added a commit to junkmd/pywinauto that referenced this pull request Jun 9, 2024
junkmd added a commit to junkmd/pywinauto that referenced this pull request Jun 10, 2024
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.

1 participant