Hi,

On 05/12/2019 12:54 pm, Tal Einat wrote:
On Tue, Dec 3, 2019 at 6:23 PM Mark Shannon <m...@hotpy.org <mailto:m...@hotpy.org>> wrote:

    Hi Everyone,

    I am proposing a new PEP, still in draft form, to impose a limit of one
    million on various aspects of Python programs, such as the lines of
    code
    per module.

    Any thoughts or feedback?


My two cents:

I find the arguments for security (malicious code) and ease of implementation compelling. I find the point about efficiency, on the other hand, to be almost a red herring in this case. In other words, there are great reasons to consider this regardless of efficiency, and IMO those should guide this.

I do find the 1 million limit low, especially for bytecode instructions and lines of code. I think 1 billion / 2^32 / 2^31 (we can choose the bikeshed color later) would be much more reasonable, and the effect on efficiency compared to 2^20 should be negligible.

The effect of changing the bytecode size limit from 2^20 to 2^31 would be significant. Bytecode must incorporate jumps and a lower limit for bytecode size means that a fixed size encoding is possible. A fixed size encoding simplifies and localizes opcode decoding, which impacts the critical path of the interpreter.


I like the idea of making these configurable, e.g. adding a compilation option to increase the limit to 10^18 / 2^64 / 2^63.

While theoretically possible, it would be awkward to implement and very hard to test effectively.


Mark, I say go for it, write the draft PEP, and try to get a wider audience to tell whether they know of cases where these limits would have been hit.

- Tal Einat
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/KRPN3RXLUHWK6HKV5NIPZWJ626J23UMB/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to