[Cython] [cython-users] cimport numpy fails with Python 3 semantics
robertwb at gmail.com
Wed May 2 09:15:21 CEST 2012
On Sun, Apr 29, 2012 at 11:48 PM, Stefan Behnel <stefan_ml at behnel.de> wrote:
> mark florisson, 28.04.2012 21:57:
>> On 28 April 2012 19:50, Stefan Behnel wrote:
>>> mark florisson, 28.04.2012 20:33:
>>>> I think each module should have its own language level, so I think
>>>> that's a bug. I think the rules should be:
>>>> - if passed as command line argument, use that for all cimported
>>>> modules, unless they define their only language level through the
>>>> - if set as a directive, the language level will apply only to that module
>>> That's how it works. We don't run the tests with language level 3 in
>>> Jenkins because the majority of the tests is not meant to be run with Py3
>>> semantics. Maybe it's time to add a numpy_cy3 test.
>>> If there are more problems than just this (which was a bug in numpy.pxd),
>>> we may consider setting language level 2 explicitly in numpy.pxd.
>> Ah, great. Do we have any documentation for that?
> We do now. ;)
> However, I'm not sure cimported .pxd files should always inherit the
> language_level setting. It's somewhat of a grey area because user provided
> .pxd files would benefit from it since they likely all use the same
> language level as the main module, whereas the Cython shipped (and
> otherwise globally installed) .pxd files wouldn't gain anything and could
> potentially break.
> I think we may want to keep the current behaviour and set the language
> level explicitly in the few shipped .pxd files that are not language level
> agnostic (i.e. those that actually contain code).
+1, I'm not worried about breaking the ones that ship with Cython, as
we can manually specify the language level on those if necessary. This
does have implications for automatically cimporting on import when a
.pxd is found though, especially if one pulls in .pxd files from
More information about the cython-devel