Re: [Pyobjc-dev] Deprecation warnings turned into BadPrototypeError
Brought to you by:
ronaldoussoren
|
From: Ronald O. <ron...@ma...> - 2008-04-14 10:52:10
|
On Monday, April 14, 2008, at 10:31AM, "Luc Heinrich" <lu...@ho...> wrote: >Greetings, > >Revision 1993 of PyObjC trunk seems to change the "Not all Objective-C >arguments are present in the Python argument-list of foo" deprecation >warnings to hard BadPrototypeError exceptions, which makes my >application to fail on launch because of some decorated methods which >use variable arguments and/or keyword arguments. > >The problem was already discussed here and the diff in pyobjc-core/ >Modules/objc/libffi_support.m seems to show that work has been done to >better detect false positives. > >However, the following test in PyObjCFFI_MakeFunctionClosure... > >else if (stubUserdata->argCount == 0 && haveVarArgs && haveVarKwds) > >...should probably be... > >else if (stubUserdata->argCount == 0 && (haveVarArgs || haveVarKwds)) > >...right ? Maybe. The code is designed to trigger on definitions like this: def wrapper(*args, **kwds), which seems to be the most common way to define wrapping decorators. The intention is to avoid varargs declarations other than wrapping decorators. Do you use "def wrapper(*args):" instead? BTW. Lib/objc/test/test_method_prototypes.py contains the unittests that are most relevant for this discussion. Ronald P.S. I just noticed that vararg definitions shouldn't be completely forbidden, but should be allowed when other metadata says that the ObjC method is actually a varargs method with an interface that PyObjC can deal with. The trunk doesn't support this at the moment :-( |