On 17 February 2010 04:06, Stefan Behnel <[email protected]> wrote: > Robert Bradshaw, 16.02.2010 22:24: >> On Feb 16, 2010, at 1:08 PM, Lisandro Dalcin wrote: >> >>> That file lost backward-compatibility with Py2.3 (because it uses >>> 'set' builtin). As Parsin.py is one of these few files that are >>> cythonized,... Can you see any problem on the obvious patch below??: >>> >>> >>> $ hg diff Cython/Compiler/Parsing.py >>> diff -r 6fc30b5dadc3 Cython/Compiler/Parsing.py >>> --- a/Cython/Compiler/Parsing.py Fri Feb 12 19:04:24 2010 +0100 >>> +++ b/Cython/Compiler/Parsing.py Tue Feb 16 18:06:03 2010 -0300 >>> @@ -10,6 +10,13 @@ >>> import os >>> import re >>> import sys >>> + >>> +try: >>> + set >>> +except NameError: >>> + # Python 2.3 >>> + from sets import Set as set >>> + >>> from Cython.Compiler.Scanning import PyrexScanner, >>> FileSourceDescriptor >>> import Nodes >>> import ExprNodes >> >> Looks fine to me. We do the same elsewhere. > > This shadows the 'set' builtin, though, so Cython can't optimise it. That > may not be important in this case, but given that Cython "implements" the > set type for 2.3 anyway, would it make sense to provide the 'set' builtin > in Shadow.py and reimport it from there instead? >
Stefan, I general I do not like the idea loosing a any optimization in ALL Python versions just for providing compat for the old Py2.3. Could you elaborate a bit more what should be done to make it work using Shadow.py ? I mean, adding 'set' to Shadow.py is trivial, but I do not get how to use it in Parsing.py... -- Lisandro Dalcin --------------- Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC) Instituto de Desarrollo Tecnológico para la Industria Química (INTEC) Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET) PTLC - Güemes 3450, (3000) Santa Fe, Argentina Tel/Fax: +54-(0)342-451.1594 _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
