Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Bad argument to internal function when calling method

Reply
Thread Tools

Bad argument to internal function when calling method

 
 
SkyRanger
Guest
Posts: n/a
 
      01-05-2006
Hi!
I make class extension from Delphi, but i have problem. Here my code:


//================================================== ==================
{pyClassMethod}

function pyClassMethod( self, args : PPyObject ) : PPyObject; cdecl;
var
Strs : PChar;
begin
if PyArg_ParseTuple(args, 's',[@Strs])=-1 then
Result:=nil
else
begin
ShowMessage(Strs);
end;
Py_INCREF(Py_None);
Result:=Py_None
end;

var
Classname, Claass : PPyObject;
MyFunc,MyMeth PyObject;


Classname:= PyString_FromString('class_test');
Claass:= PyClass_New(nil, Python.PyScript.GetPyDict, Classname);
PyDict_SetItemString(Python.PyScript.GetPyDict, 'class_test',
Claass);
MyMethod.ml_name:='test';
MyMethod.ml_meth:=pyClassMethod;
MyMethod.ml_flags:=METH_CLASS;
MyMethod.ml_doc:='DOC';

MyFunc:=PyCFunction_New(@MyMethod, nil);
MyMeth:=PyMethod_New(MyFunc, nil, Claass);
PyDict_SetItemString(Python.PyScript.GetPyDict, 'test', MyMeth);

Python.PyScript.GetPyDict - just return exists dictionary


Here python code:

class testcl1(sky3d.class_test):
def fun(self):
print "Hello"
tst=testcl1()
tst.fun()
tst.test("123")

When i run it i get error:

tst.test("123")
SystemError
:
C:\sf\python\dist23\src\Objects\methodobject.c:112 : bad argument to
internal function

So error raise in this string:
tst.test("123")

How to remove this error and make this work???

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Variable argument function as a parameter of a variable argument function AikidoGuy C Programming 11 11-21-2011 10:43 PM
function argument dependent on another function argument? Reckoner Python 11 01-19-2009 03:31 AM
SystemError: ... cellobject.c:22: bad argument to internal ? robert Python 2 05-16-2006 08:48 PM
Dynamically add class method causes "SystemError: ... bad argument to internal function" Newgene Python 1 01-13-2005 02:54 AM
Function pointers, variable argument functions calling other variable-argument functions (sort of) S?ren Gammelmark C Programming 1 01-07-2005 09:41 PM



Advertisments