varkind and invoke_type#1199
Closed
GitBadSanta wants to merge 1 commit intomhammond:masterfrom
Closed
Conversation
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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Regarding this commit
Previous implementation was :
def _GetDescInvokeType(entry, default_invoke_type): if not entry or not entry.desc: return default_invoke_type return entry.desc[4] # apparently varkindSo this was always returning
varkindwhenentry.descwas defined. The function name is consistent : we try to retrieveinvoke_typefromdescand returndefault_invoke_typeotherwise.Regarding new implementation :
def _GetDescInvokeType(entry, invoke_type): # determine the wFlags argument passed as input to IDispatch::Invoke if not entry or not entry.desc: return invoke_type varkind = entry.desc[4] # from VARDESC struct returned by ITypeComp::Bind if varkind == pythoncom.VAR_DISPATCH and invoke_type == pythoncom.INVOKE_PROPERTYGET: return pythoncom.INVOKE_FUNC | invoke_type # DISPATCH_METHOD & DISPATCH_PROPERTYGET can be combined in IDispatch::Invoke else: return invoke_typeThe logic is totally different, we check
varkindto possibly amendinvoke_type, but we never returnvarkind.In the related issue of this pull request, we found out that when setting
AdminQueueInfomember of anMSMQ.MSMQMessage, we call_GetDescInvokeTypewith an entry verifyingentry.desc[4] = 8and aninvoke_type = INVOKE_PROPERTYPUT.We should get a
INVOKE_PROPERTYPUTREF (8), corresponding toentry.desc[4]but new function returnsINVOKE_PROPERTYPUTand makesinvokecrash.The pull request is proposing a mix between two implementations, but I'm still really confused, especially with
entry.desc[4]which apparently should correspond tovarkind. Looking to documentationvarkindvalues can only be 0,1,2,3.So what is really
entry.desc[4]?