This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author lepaperwan
Recipients amaury.forgeotdarc, belopolsky, eryksun, lepaperwan, meador.inge, terry.reedy
Date 2016-08-29.15:55:21
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1472486122.38.0.0209891139917.issue27803@psf.upfronthosting.co.za>
In-reply-to
Content
I can confirm Eryk got what I meant. I didn't know if it was meant to work that way or if it was simply something that was overlooked so I thought I'd ask, I will look into the ctypes code to provide a patch sometime this week if I can.

Terry, for a working example take the following (on a MS Windows):
>>> from ctypes import *
>>> from ctypes.wintypes import *
>>>
>>> class CustomPHKEY(object):
...     def __init__(self, value):
...             self._as_parameter_ = HKEY(value)
...
>>>
>>> function = ctypes.windll.advapi32.RegOpenKeyExW
>>> function.argtypes = [HKEY, c_wchar_p, DWORD, DWORD, POINTER(HKEY)]
>>> function.restype = LONG
>>> result = CustomPHKEY(0)
>>> function(0x80000002, 'SOFTWARE', 0, 0x20019, result)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ctypes.ArgumentError: argument 5: <type 'exceptions.TypeError'>: expected LP_c_void_p instance instead of c_void_p
History
Date User Action Args
2016-08-29 15:55:22lepaperwansetrecipients: + lepaperwan, terry.reedy, amaury.forgeotdarc, belopolsky, meador.inge, eryksun
2016-08-29 15:55:22lepaperwansetmessageid: <1472486122.38.0.0209891139917.issue27803@psf.upfronthosting.co.za>
2016-08-29 15:55:22lepaperwanlinkissue27803 messages
2016-08-29 15:55:21lepaperwancreate