[merge][1.8][#277481] set -DWIN32 when compiling all pyrex extensions
John Arbash Meinel
john at arbash-meinel.com
Wed Oct 8 13:38:18 BST 2008
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Martin Pool wrote:
> On Wed, Oct 8, 2008 at 3:59 PM, Andrew Bennetts
> <andrew.bennetts at canonical.com> wrote:
>> Mutating a default argument is likely to cause bugs. If nothing else it means
>> define_macros will have ('WIN32', None) appended to it several times. It's
>> probably harmless with the current setup.py, but I wouldn't bet on this always
>> being the case.
>
> Nice catch.
>
>> Why does add_pyrex_extension even allow callers to adjust define_macros? We
>> don't seem to use that capability with this patch.
>
> I added it for compatibility with things that were already passing it
> through kwargs. However, it's probably only used inside this file,
> and we can see all the callers don't do that. So how about this
> instead?
>
>
This is okay, and I think we can merge it as is. However, I think *I*
would prefer:
def add_pyrex_extension(module_name, **kwargs):
if sys.platform == 'win32':
define_macros = kwargs.setdefault('define_macros', [])
define_macros.append(('WIN32', None))
The biggest reason is because it makes it obvious that
add_pyrex_extension is mostly just a proxy.
However, either way is fine.
BB:tweak
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkjsqboACgkQJdeBCYSNAAMyaACfWXTiMhFWKF4RNGyuNsxwuoOR
0XEAn1mgHA1fLj90IaZ3gF08P9F4pced
=fBZn
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list