Skip to content

Modernize _compointer_base.value to the @property style. - #1023

Open
jeanluyac-sketch wants to merge 2 commits into
enthought:mainfrom
jeanluyac-sketch:modernize-compointer-value
Open

jeanluyac-sketch wants to merge 2 commits into
enthought:mainfrom
jeanluyac-sketch:modernize-compointer-value

Conversation

@jeanluyac-sketch

Copy link
Copy Markdown
Contributor

Closes #377

Replaces the old property(__get_value, doc=...) style of _compointer_base.value with a @property and a docstring, as proposed in the issue. The hints.Self return annotation was already in place. No behaviour change.

Checked: ruff format --check passes and pyright --pythonplatform Windows reports the same errors in this file before and after (6, all pre-existing). I did not run the unittest suite on Windows for this change.

AI assistance: drafted with Claude; I reviewed the diff myself.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0137jz1XbSeuomn8S7nSE9k6
@codecov-commenter

codecov-commenter commented Dec 1, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.64%. Comparing base (4d68bfa) to head (a0955ed).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1023      +/-   ##
==========================================
+ Coverage   92.62%   92.64%   +0.01%     
==========================================
  Files         154      154              
  Lines       16870    16884      +14     
==========================================
+ Hits        15626    15642      +16     
+ Misses       1244     1242       -2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@junkmd junkmd 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.

I understand the production code change itself looks good, though I'm a bit concerned that return self isn't covered by tests. Could you add a quick test for it?

@jeanluyac-sketch

Copy link
Copy Markdown
Contributor Author

Thanks for the review. I added Test_compointer_value.test_value_returns_self in comtypes/test/test_comobject.py, which checks that .value on a COM pointer returns the pointer itself. Pushed as a new commit. I could only lint it on Linux, so please let CI run it on Windows.

@junkmd junkmd 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.

I suspect overriding .value serves a purpose internally.

While the unit tests cover the direct behavior well, it seems important to the package's internals that .value returns self instead of an integer pointer—possibly due to duck typing expecting .value to exist.

Do you think we can test that code path through integration or E2E tests without calling .value directly?

@junkmd junkmd added tests enhance or fix tests coding style Topics related to style, formatters, linters, and delinting. labels Dec 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

coding style Topics related to style, formatters, linters, and delinting. tests enhance or fix tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

modernize and add annotation to _compointer_base.value

4 participants