[ros-bugs] [Bug 2795] New: Python miss first 120 bytes from script.
ReactOS.Bugzilla at www.reactos.org
ReactOS.Bugzilla at www.reactos.org
Mon Nov 5 01:49:52 CET 2007
http://www.reactos.org/bugzilla/show_bug.cgi?id=2795
Summary: Python miss first 120 bytes from script.
Product: ReactOS
Version: TRUNK
Platform: QEmu
OS/Version: ReactOS
Status: NEW
Severity: normal
Priority: P3
Component: Sound
AssignedTo: ros-bugs at reactos.org
ReportedBy: jeanmichel.123 at free.Fr
QAContact: ros-bugs at reactos.org
When python basicly works in interpreter mode (without assertions and floating
points), it does not work with script files.
Facts:
NB: this bug does not occurs with Wine, but occurs with reactos.
After installing python 2.3.5
when trying to run python.exe with a script as argument:
..\python.exe some_script.py
the first 120 bytes from some_script.py are not seen by the interpreter.
As a consequence, python start reading the file at offset 120, very possibly in
the middle of a line.
Then python reports an error with the text at offset 120 and line number 1.
Interpretation:
In python 2.3.6 source code (I do not have 2.3.5source), some work seems to be
possible before reading the file.
Python (in fact python23.dll) open script file with fopen.
then some fgetc fungetc might (not) be called.
If I well understood the source reading is done by python parsetok function,
which call some ...gets... which is a gets with possible codec conversion.
I did not have any tool to recompile python from windows/reactos.
I did not have any tool spy/debug python dll calls to fopen getc gets.
Python function which are related to this behaviour seems to be:
./Modules/main.c:124:Py_Main(int argc, char **argv)
./Modules/main.c:291:if ((fp = fopen(filename, "r")) == NULL) {
./Modules/main.c:415: sts = PyRun_AnyFileExFlags(
./Python/pythonrun.c:647:PyRun_AnyFileExFlags(FILE *fp, const char *filename,
int closeit,
./Python/pythonrun.c:828:PyRun_SimpleFileExFlags(FILE *fp, const char
*filename, int closeit,
./Python/pythonrun.c:1238:PyRun_FileExFlags(FILE *fp, const char *filename, int
start, PyObject *globals,
./Python/pythonrun.c:1343:PyParser_SimpleParseFileFlags(FILE *fp, const char
*filename, int start, int flags)
./Parser/parsetok.c:71:PyParser_ParseFileFlags(FILE *fp, const char *filename,
grammar *g, int start,
./Parser/parsetok.c:102:parsetok(struct tok_state *tok, grammar *g, int start,
perrdetail *err_ret,
./Parser/tokenizer.c:1412:PyTokenizer_Get(struct tok_state *tok, char
**p_start, char **p_end)
./Parser/tokenizer.c:998:tok_get(register struct tok_state *tok, char
**p_start, char **p_end)
./Parser/tokenizer.c:657:tok_nextc(register struct tok_state *tok)
then, there are two functions with same name:
142:decoding_fgets(char *s, int size, struct tok_state *tok)
425:decoding_fgets(char *s, int size, struct tok_state *tok)
The first one calls fgets.
The second one makes more complex stuff calling python for decoding input
encoding.
I didnot try to understand the second one.
But it is clear that there is a bug in Reactos which make Python not working
with simple script.
--
Configure bugmail: http://www.reactos.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
More information about the Ros-bugs
mailing list