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
Fix dynamic property put. #1641
Conversation
I would appreciate it to get some feedback about this pull request. If there is anything that is unclear or missing for merging this pull request I'm happy to update the pull request or provide additional information. I'm looking forward to get the issue fixed as it blocks us from upgrading to newer Python versions. |
Sorry for the delay, but this code is somewhat tricky and has changed lots over time. I need to find the time to work out what exactly changed in 224, and why, and how this impacts it. This change has no tests, so I've no idea what regressions it might cause. I'll try and find some time soon, and will do so before cutting a new release, but I've been very busy. The best thing you can do to move this forward is to do some of the above. |
Here is what I found out so far:
I also searched for existing tests and could only find this one: testDynamic.py. As far as I understand the code, it dynamically registers a python object as COM object and performs some tests on it. Unfortunately, this object does not behave the same as "real" COM objects as the I'm stuck here as I don't know enough about the code and COM to extend this test to cover the proposed fix. |
(Oops - I accidentally put this into #1427 instead of here, so re-pasting here!) Sorry for the delay - I've started looking at this and things are a bit of a mess around this code. I've added some comments about that and I'm slowly cleaning things up a little so I can re-understand how things work :) It might take me a bit longer to untangle and I've a few other commits queued up in that direction. Please let me know if you are able to help me test things when I get a little further along - thanks! |
Thanks for looking into it! For sure I will help testing. |
If you visit https://github.com/mhammond/pywin32/runs/2225136583 you should be able to find binaries of the most recent commit I made. What would be super helpful would be if you can adjust your patch, so that the condition you add is:
(ie, an additional check for Again, note that these changes will only work with a very recent binary. Thanks |
c7bb898
to
c15043c
Compare
I fetched the build from https://github.com/mhammond/pywin32/runs/2225136583, applied my patch with your extension (see rebased commit c15043c) and gave it a try (Python 3.6 x64). Please, let me know if you need additional information. |
Thanks for checking. I think I'll probably end up doing things slightly differently, but that's extremely helpful. Are you able to find the property definition in the type library for the property in question? When running the test suite (albeit without Office etc installed) I never hit that code with a VARDESC - it's always a FUNCDESC - even though the tests do have properties - so I'm finding that somewhat confusing and I'm still hoping to get a test case that covers your scenario |
The setter does not fail for a specific property or properties of a certain type but for all properties of a certain object. The peculiarity of that object might be that it is returned as a plain
Setting properties on descendants of this
I hope this information is of any help... |
Thanks - do you happen to have the typeinfo available for that |
This application uses OLE. |
I think I fixed this in af54b27, so I'm going to close this. |
I quickly verified the fix in our environment and it works as expected. |
Since version 224 of pywin32 the dynamic property put is broken. It seems that a fix for a regression broke it (see issues #1427 and #1199, and the corresponding change in commit 1350d43).
The severity of this issue increased recently as the last working version 223 is not available for the newest Python release 3.8 and 3.9.
The fix checks for the invoke type for property put and returns it accordingly. This prevents the exception reported in #1427 and successfully sets the property's value.