logo       

Null reference: msg#00148

programming.swig

Subject: Null reference

Hello all,

I ran into a problem, but not sure whether it is a SWIG or Python problem.

This is a simplest class with operator == defined:

// v.h
class v
{
public:
v(const int a) : data(a) {}
bool operator==(const v& u) const {return data == u.data;}
int data;
};

% python
Python 2.2.2 (#1, Feb 10 2003, 00:23:53)
[GCC 3.2 20020903 (Red Hat Linux 8.0 3.2-7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import mod
>>> None in (mod.v(1), None)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "mod.py", line 38, in __eq__
def __eq__(*args): return apply(_mod.v___eq__,args)
TypeError: null reference

This error does not occur if operator == is not defined. Why == is called here
anyway?

Could anyone help? Thanks.

Zhong





_______________________________________________
Swig maillist - Swig@xxxxxxxxxxxxxxx
http://mailman.cs.uchicago.edu/mailman/listinfo/swig



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise