Skip to content

Commit

Permalink
apply review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
jonschz committed Jan 6, 2024
1 parent 5d3a194 commit 788df7c
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions comtypes/_memberspec.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ def prepare_parameter(v):
if name is not None:
kw[name] = v
else:
raise Exception("Unnamed inout parameters cannot be omitted")
raise TypeError("Unnamed inout parameters cannot be omitted")
outargs[outnum] = v
if dir_out:
outnum += 1
Expand All @@ -240,7 +240,7 @@ def prepare_parameter(v):
# If there is only a single output value, then do not expect it to
# be iterable.

# My interpretation of this code:
# Our interpretation of this code (jonschz, junkmd, see https://github.com/enthought/comtypes/pull/473):
# - 'outnum' counts the total number of 'out' and 'inout' arguments.
# - Confusingly, 'outargs' is a dict consisting of the supplied _inout_ arguments.
# - The call to func() returns the 'out' and 'inout' arguments.
Expand All @@ -250,20 +250,18 @@ def prepare_parameter(v):
# by those in 'outargs', and call __ctypes_from_outparam__() on them.
#
# - What I don't understand is: Why is the behaviour different for outnum==1?
# From the above interpretation I would have expected
# From the above interpretation I would have expected line 264 to be
#
# rescode = outargs[0].__ctypes_from_outparam__()
#
# instead of
#
# rescode = rescode.__ctypes_from_outparam__()
#
#

if outnum == 1: # rescode is not iterable
if len(outargs) == 1:
rescode = rescode.__ctypes_from_outparam__()
# rescode = outargs[0].__ctypes_from_outparam__()
return rescode
rescode = list(rescode)
for outnum, o in outargs.items():
Expand Down

0 comments on commit 788df7c

Please sign in to comment.