Comments (2)
This issue is still present, and seems to fail unconditionally now instead of only intermittently (BigSur, M1).
I suspect that this is a bug in how PyObjC builds formal protocols.
from pyobjc.
The weird thing is that the "fake" implementation for protocol_getMethodDescription()
calls protocol_copyMethodDescriptionList()
to get information from the ObjC runtime and never seems to fail. This is the same runtime information that the real protocol_getMethodDescription()
is supposed to use.
Some more checking: Added sanity check with protocol_getMethodDescription()
both before and after objc_registerProtocol()
(which finishes protocol creation). This sanity check always succeeds before the call to objc_registerProtocol()
and sometimes fails after that call.
Registering all protocol selectors twice seems to fix the issue, but then those selectors end up twice in the protocol which causes other test failures.
This seems to be an ObjC runtime bug, although I haven't been able yet to reproduce it outside of PyObjC...
#import <objc/runtime.h>
#include <stdio.h>
int main(void)
{
SEL sel1 = sel_registerName("protoMethod:");
const char* sig1 = "I@:";
SEL sel2 = sel_registerName("anotherProto:with:");
const char* sig2 = "v@:ii";
Protocol* p = objc_allocateProtocol("MyProtocol");
struct objc_method_description descr;
if (p == NULL) {
printf("cannot create protocol\n");
return 1;
}
protocol_addMethodDescription(p, sel1, sig1, YES, YES);
descr = protocol_getMethodDescription(p, sel1, YES, YES);
if (descr.name == NULL) {
printf("added selector 1 not found protocol (build phase)\n");
return 1;
}
protocol_addMethodDescription(p, sel2, sig2, YES, YES);
descr = protocol_getMethodDescription(p, sel2, YES, YES);
if (descr.name == NULL) {
printf("added selector 2 not found protocol (build phase)\n");
return 1;
}
objc_registerProtocol(p);
descr = protocol_getMethodDescription(p, sel1, YES, YES);
if (descr.name == NULL) {
printf("added selector 1 not found protocol (registered phase)\n");
return 1;
}
descr = protocol_getMethodDescription(p, sel2, YES, YES);
if (descr.name == NULL) {
printf("added selector 2 not found protocol (registered phase)\n");
return 1;
}
return 0;
}
That's it for now, although I might return to this issue later on.
from pyobjc.
Related Issues (20)
- metadata issue with AVCaptureStillImageOutput.captureStillImageAsynchronouslyFromConnection:completionHandler: HOT 7
- o/Opaque pointer warnings - metadata casing fix? HOT 6
- Add Speech Synthesis? HOT 5
- Add tests for CF types in signatures
- Xcode: command line tools only version detection prevents pip install HOT 2
- Consider dropping setuptools
- Remove usage of PyObjCUnsupportedMethod_IMP from framework bindings
- Add tests for ObjC category edge cases
- How to be able to access change objects' states already created within my XIB file HOT 1
- HomeKit support HOT 4
- Support for compiled methods HOT 31
- Warnings when running "python setup.py develop" in pyobjc-core HOT 1
- pyObjC PDFKit (Quartz) textMarkupString() returns different results compared to JXA ObjC bindings HOT 1
- Static buffer argument for PyObjCRT_SimplifySignature is too large and too small HOT 1
- PySlice_GetIndicesEx is deprecated HOT 1
- AttributeError: module 'objc' has no attribute 'initFrameworkWrapper' HOT 8
- How can I use instance methods off of my IBOutlet buttons, sliders, etc. HOT 1
- AVCaptionRenderer fails with "unrecognized selector sent to instance" HOT 2
- OS-level captions using AVCaption are not rendered HOT 1
- Problem with webView_runJavaScriptConfirmPanelWithMessage_initiatedByFrame_completionHandler metadata HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyobjc.