[Ironpython-users] IronPython, Daily Digest 1/2/2014

CodePlex no_reply at codeplex.com
Fri Jan 3 09:25:38 CET 2014


Hi ironpython,

Here's your Daily Digest of new issues for project "IronPython".

In today's digest:ISSUES

1. [New issue] multiple calls to ctype.windll.kernel32.CreateEvent fails

----------------------------------------------

ISSUES

1. [New issue] multiple calls to ctype.windll.kernel32.CreateEvent fails
http://ironpython.codeplex.com/workitem/34839
User paweljasinski has proposed the issue:

"When definition of the structure used as a parameter is recreated before the call, second and following call fail. Test:
import ctypes
def create_interrupt_event():
    class SECURITY_ATTRIBUTES(ctypes.Structure):
        _fields_ = [ ("nLength", ctypes.c_int),
            ("lpSecurityDescriptor", ctypes.c_void_p),
            ("bInheritHandle", ctypes.c_int) ]

    sa = SECURITY_ATTRIBUTES()
    sa_p = ctypes.pointer(sa)
    sa.nLength = ctypes.sizeof(SECURITY_ATTRIBUTES)
    sa.lpSecurityDescriptor = 0
    sa.bInheritHandle = 1

    return ctypes.windll.kernel32.CreateEventA(
        sa_p,  # lpEventAttributes
        False, # bManualReset
        False, # bInitialState
        '')    # lpName
print "firs call with success"
print create_interrupt_event()
print "second call fails"
print create_interrupt_event()

output:
firs call with success
884
second call fails
Traceback (most recent call last):
  File "create-event.py", line 22, in <module>
  File "create-event.py", line 14, in create_interrupt_event
_ctypes.ArgumentError: expected LP_SECURITY_ATTRIBUTES, got LP_SECURITY_ATTRIBUTES

Workaround, move definition of the parameter structure to the module scope"
----------------------------------------------



----------------------------------------------
You are receiving this email because you subscribed to notifications on CodePlex.

To report a bug, request a feature, or add a comment, visit IronPython Issue Tracker. You can unsubscribe or change your issue notification settings on CodePlex.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20140103/ea5fa619/attachment.html>


More information about the Ironpython-users mailing list