We've noticed, while testing with a block-heavy API (i.e lots XPC usage), that errors can occur if the third-party API inspects (through
NSMethodSignature) the signature of a block. Signatures appear to translate every type encoding to
@ rather than the correct value.
PyObjCBlock_Create is called, it does not appear to ever call
block_signature to infer the actual signature. Rather, it seems to rely on what was created through parsing the metadata in
process_metadata_dict, which appears to make up a signature with a matching number of parameters (e.g. a regular block with a single parameter becomes
@@@). This means the following error appears when trying to use XPC (consuming):
[NSXPCConnection sendInvocation]: Return value of block argument must be 'void'.
This likely works for most cases where the values are indeed pointer-sized, but this breaks when inspection happens.