the following (random) code crashes my interpreter
(python 2.4.3/winxp):
from types import CodeType as code
exec code(0, 5, 8, 0, "hello moshe", (), (), (), "", "", 0, "")
i would expect the interpreter to do some verifying, at least for
sanity (valid opcodes, correct stack size, etc.) before executing
artbitrary code... after all, it was the BDFL who said """I'm not
saying it's uncrashable. I'm saying that if you crash it, it's a
bug unless proven harebrained."""
-tomer 6 1167
tomer:
It is my opinion that you would loose performance if the Python
interpreter had the additional task of verifying byte code. It might be
more appropriate to have a preprocessor that did the verifying as it
compiled the byte code.
Sam Schulenburg
gangesmaster wrote: the following (random) code crashes my interpreter (python 2.4.3/winxp):
from types import CodeType as code exec code(0, 5, 8, 0, "hello moshe", (), (), (), "", "", 0, "")
i would expect the interpreter to do some verifying, at least for sanity (valid opcodes, correct stack size, etc.) before executing artbitrary code... after all, it was the BDFL who said """I'm not saying it's uncrashable. I'm saying that if you crash it, it's a bug unless proven harebrained."""
-tomer
sam <sa******@pacbell.net> wrote: tomer:
It is my opinion that you would loose performance if the Python interpreter had the additional task of verifying byte code. It might be more appropriate to have a preprocessor that did the verifying as it compiled the byte code.
But in this case, there is no "compiled" -- just the code type's
constructor: from types import CodeType as code exec code(0, 5, 8, 0, "hello moshe", (), (), (), "", "", 0, "")
Yes, code() itself could do some sanity checking. But so could 'exec'
-- it's never a particularly fast operation anyway... and most
definitely NOT on the critical path of normal operations. I'd rather
have "defense in depth", in this case.
Alex
sam wrote: tomer:
It is my opinion that you would loose performance if the Python interpreter had the additional task of verifying byte code. It might be more appropriate to have a preprocessor that did the verifying as it compiled the byte code.
Possibly. A good book on the topic is Douglas Hofstadter's
_Goedel, Escher, Bach: an Eternal Golden Braid_.
Particularly starting from the chapter "Contracrostipunctus".
Cheers, Mel.
Sam Schulenburg
gangesmaster wrote: the following (random) code crashes my interpreter (python 2.4.3/winxp):
from types import CodeType as code exec code(0, 5, 8, 0, "hello moshe", (), (), (), "", "", 0, "")
i would expect the interpreter to do some verifying, at least for sanity (valid opcodes, correct stack size, etc.) before executing artbitrary code... after all, it was the BDFL who said """I'm not saying it's uncrashable. I'm saying that if you crash it, it's a bug unless proven harebrained."""
-tomer
Mel:
Wow that book brings back memories. I scanned my copy to review the
subject covered, and came to the conclusion that mind reading
algorithms are the answer.
Sam Schulenburg
Mel Wilson wrote: sam wrote: tomer:
It is my opinion that you would loose performance if the Python interpreter had the additional task of verifying byte code. It might be more appropriate to have a preprocessor that did the verifying as it compiled the byte code.
Possibly. A good book on the topic is Douglas Hofstadter's _Goedel, Escher, Bach: an Eternal Golden Braid_.
Particularly starting from the chapter "Contracrostipunctus".
Cheers, Mel. Sam Schulenburg
gangesmaster wrote: the following (random) code crashes my interpreter (python 2.4.3/winxp):
from types import CodeType as code exec code(0, 5, 8, 0, "hello moshe", (), (), (), "", "", 0, "")
i would expect the interpreter to do some verifying, at least for sanity (valid opcodes, correct stack size, etc.) before executing artbitrary code... after all, it was the BDFL who said """I'm not saying it's uncrashable. I'm saying that if you crash it, it's a bug unless proven harebrained."""
-tomer
sam wrote: Mel: Wow that book brings back memories. I scanned my copy to review the subject covered, and came to the conclusion that mind reading algorithms are the answer.
I gathered from somewhere (but not the index to Andrew
Hodges' biography) that Turing was toying with an idea for
"oracles", where a computation would be allowed to call out
sometimes to a non-computational process to obtain some
required result. Used maybe by interactive debugging programs.
Cheers, Mel.
Mel Wilson wrote:
[ ... ] Douglas Hofstadter's _Goedel, Escher, Bach: an Eternal Golden Braid_.
[ ... ] "Contracrostipunctus".
In article <11**********************@h76g2000cwa.googlegroups .com>,
gangesmaster <to*********@gmail.com> wrote: the following (random) code crashes my interpreter (python 2.4.3/winxp):
from types import CodeType as code exec code(0, 5, 8, 0, "hello moshe", (), (), (), "", "", 0, "")
i would expect the interpreter to do some verifying, at least for sanity (valid opcodes, correct stack size, etc.) before executing artbitrary code... after all, it was the BDFL who said """I'm not saying it's uncrashable. I'm saying that if you crash it, it's a bug unless proven harebrained."""
IIRC, this has been discussed before and deemed harebrained. Check SF to
see whether this specific case has been submitted previously and submit
it if not. Then post to python-dev if it's a new bug and ask for a
ruling on whether it's harebrained.
--
Aahz (aa**@pythoncraft.com) <*> http://www.pythoncraft.com/
"I saw `cout' being shifted "Hello world" times to the left and stopped
right there." --Steve Gonedes This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Christian Seberino |
last post by:
I know IPython is another interpreter for Python and was wondering
what people liked about it and if I should switch to it.
If it is so good then why is it not part of the standard Python...
|
by: Garett |
last post by:
Hello, I would like to be able to save source typed into the interpreter
to a file. Kind of like marshal, but I would like to have the file contain
the source so I can edit it later. Something like...
|
by: BaBS |
last post by:
I've a problem whith my python script,
i chmod'ed it to +x, addes the line :
#!/usr/bin/python2.3
and i verified that /usr/bin/python2.3 exists
but i've something like
: bad interpreter: No such...
|
by: Tim N. van der Leeuw |
last post by:
Hi,
When trying to use win32com functionality with Python2.4, the
interpreter often crashes!
I don't know if it's a known problem already that will be fixed in an
upcoming Python2.4.1...
|
by: Rex Eastbourne |
last post by:
Hi,
I'm interested in running a Python interpreter in Emacs. I have Python
extensions for Emacs, and my python menu lists "C-c !" as the command
to run the interpreter. Yet when I run it I get...
|
by: Leo |
last post by:
Why is it not possible to get the frame from the interpreter using the
inspect library? IOW, why does this code:
>>> from inspect import *
>>> stack()
produce:
|
by: Jim Michaels |
last post by:
C:\prj\quiz\withusers>php tareports.php
PHP Parse error: syntax error, unexpected T_ELSE in
C:\prj\quiz\withusers\tareports.php on line 205
this is the section of code.
if (isset($row4)) {...
|
by: Robin Becker |
last post by:
As part of some django usage I need to get some ReportLab C extensions into a
state where they can be safely used with mod_python.
Unfortunately we have C code that seems incompatible with...
|
by: Sullivan WxPyQtKinter |
last post by:
I have a huge log file which contains 3,453,299,000 lines with
different lengths. It is not possible to calculate the absolute
position of the beginning of the one billionth line. Are there...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |