MsEmiNeko / python4delphi

Automatically exported from code.google.com/p/python4delphi
0 stars 0 forks source link

Bug: TypeError produced not immediately, but with a next func call #29

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I have module with e.g. such func

function xy_pos(Self, Args: PPyObject): PPyObject; cdecl;
var
  X, Y, N: Integer;
begin
  with GetPythonEngine do
  begin
    if PyArg_ParseTuple(Args, 'ii:xy_pos', @X, @Y) <> 0 then
    begin
      N:= X + Y;
      Result:= PyInt_FromLong(N);
    end;
  end;
end;

now i call it from my "console": I enter line into edit, and call 
"PythonEngine.ExecString(Str)".
i call: "print(xy_pos('test'))"

expected: TypeError after this call.

seen: this call does NOT give error, but next same call gives TypeError.
I see TypeError each two calls, but now after each signle call.

Delphi7 IDE doesn't give exception TypeError.

Original issue reported on code.google.com by ato...@gmail.com on 19 Dec 2013 at 3:33

GoogleCodeExporter commented 9 years ago
example log:

Delphi 7
Python 3.2.5 (default, May 15 2013, 23:06:03) [MSC v.1500 32 bit (Intel)]
>>> xy_pos(1)
>>> xy_pos(1)
TypeError: xy_pos() takes exactly 2 arguments (1 given)
>>> xy_pos('test')
>>> xy_pos('test')
TypeError: xy_pos() takes exactly 2 arguments (1 given)
>>> xy_pos('test', 3, 4)
>>> xy_pos('test', 3, 4)
TypeError: xy_pos() takes exactly 2 arguments (3 given)

Original comment by ato...@gmail.com on 19 Dec 2013 at 3:36

GoogleCodeExporter commented 9 years ago
If i call command with "print(xy_pos(.....))" then TypeError exists each call. 
If i call command w/o print: "r = xy_pos(.....)", then issue here.

Original comment by ato...@gmail.com on 19 Dec 2013 at 3:58