> On Sat, May 16, 2009 at 5:05 PM, Dag Sverre Seljebotn > <[email protected]> wrote: >>> def same_calling_convention_as(self, other): >>> callspec_words = ("__stdcall", "__cdecl", "__fastcall") >>> cs1 = >>> cs2 = other.calling_convention >>> if (cs1 in callspec_words or >>> cs2 in callspec_words): >>> return cs1 == cs2 >>> else: >>> return True >> >> Why is this function only considering those, and not user-defined >> callspecs as well? >> >> It would seem to me that simply >> >> self.calling_convention == other.calling_convention >> >> would seem natural here, if one cannot trust "no convention" to be the >> same as any others. >> > > Two reasons from my side: > > 1) If we are going to just push the decorator form, there is no way to > annotate external declarations until 'callspec("something")' is > introduced. > > 2) User-defined (and preprocessor macro controlled) calling > conventions should be seen as a power-user feature for solving corner > cases. Then I would like to be strict only with the "standard" calling > convention names. When a user has to start using things like > @cython.callspec("MY_CALL_SPEC"), I'm pretty sure that uses knows very > well why he has to do that, and also have managed to make sure > MY_CALL_SPEC is defined in the preprocessor... > > Let's go back to mpi4py. I have to use > @cython.callspec("PyMPI_API_CALL") in a few callback functions. If I > were forced to add such decoration (or annotation using the second > part of my patch) in the MPI calls declared on my pxd's then I would > likely generate trouble to all mpi4py users, and almost all of them > are not working on Windows... >
Note that I'll make the RC during the weekend, so please push as much as you can as early as possible. I.e. the @callspec should be able to go in before this is resolved, seems orthogonal. Dag Sverre _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
