[Python-Dev] Changing the Division Operator -- PEP 238, rev 1.12
Guido van Rossum
Fri, 10 Aug 2001 10:19:58 -0400
> > My bigger worry about this interface is that the flags accepted should
> > be carefully checked to be from the small set related to future
> > statements. It would be harmful if the user could set flags like
> > CO_OPTIMIZED, CO_GENERATOR, or CO_VARARGS this way!
> Wrong set of flags!
> There are two complementary sets of flags here:
> (1) The PyCF_* ones, defined in Include/pythonrun.h
> (2) The CO_* ones defined in Include/compile.h
> The proposed fourth argument to compile() should be a combination of
> the former set.
> I only use the latter to tell whether a __future__ statement was used
> in the text compiled (which is a bit horrible, but no better way
> springs to mind).
> There might be value in checking the flags passed to compile() anyway,
> but I can't see it being dangerous.
Ah, good. Makes sense. (I think I may have been confused by your
original patch, which AFAICR *did* manipulate the co_flags field of
the code object, which contains the CO_* flags.
--Guido van Rossum (home page: http://www.python.org/~guido/)