Skip to content

Commit

Permalink
Testing for #456 found some metadata that cannot be parsed by the bridge
Browse files Browse the repository at this point in the history
* Add constants for the 'A' and 'j' characters in type encoding
* Basic implementation for 'A' in objc_support

The implemtation is not entirely correct, the prefix denotes
an atomic varialble and should be read/written using atomic
instructions. The prefix is currently ignored, that should be
good enough for now.

The 'j' prefix is not supported by the bridge, and is not
used in public APIs.
  • Loading branch information
ronaldoussoren committed Mar 11, 2022
1 parent 1bb51d5 commit f5e8dad
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions pyobjc-core/Modules/objc/objc-runtime-compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ struct PyObjC_method {
#define _C_BYCOPY 'O'
#define _C_BYREF 'R'

/* From the clang sources...
* Both are a prefix for a basic type
*/
#define _C_ATOMIC 'A'
#define _C_COMPLEX 'j' /* XXX: Requires more work to support */

/* These don't actually exist in the Objective-C runtime, but are used
* by the bridge to simplify code.
*/
Expand Down
2 changes: 1 addition & 1 deletion pyobjc-core/Modules/objc/objc_support.m
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ - (PyObject* _Nullable)__pyobjc_PythonTransient__:(int*)cookie
{
while (*type == _C_CONST || *type == _C_IN || *type == _C_INOUT || *type == _C_OUT
|| *type == _C_BYCOPY || *type == _C_BYREF || *type == _C_ONEWAY
|| *type == 'O') {
|| *type == 'O' || *type == _C_ATOMIC) {
type++;
}
while (*type && isdigit(*type)) { // LCOV_BR_EXCL_LINE
Expand Down

0 comments on commit f5e8dad

Please sign in to comment.