libdispatch.dispatch_queue_create() parameter handling errors

Issue #221 resolved
created an issue

I can only call the function as: libdispatch.dispatch_queue_create(None, None)

Trying to pass a value in either parameter results in an error:

libdispatch.dispatch_queue_create("myq", None)

Expecting byte string of length 1, got a 'str'

That is the only error text, a stack trace would help locate the above error in a larger script.


libdispatch.dispatch_queue_create(None, 0)

Illegal instruction: 4]

Comments (2)

  1. Ronald Oussoren repo owner

    The first error is expected, use b"myq" instead (that is, the first argument should be a byte string, not a regular string).

    The crash on the second argument is also expected (sadly enough): the argument should be an attribute object, for example:

    dispatch_queue = libdispatch.dispatch_queue_create(b"hello", libdispatch.DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL)

    The hard crash is not nice, but also not something I can easily avoid: Apple's frameworks sometimes crash hard when you pass an object of the wrong class.

  2. Log in to comment