File:  [CENS] / python / pyGiNaC / wrappers / ex.py
Revision 1.7: download - view: text, annotated - select for diffs - revision graph
Thu Apr 19 16:43:16 2001 UTC (16 years, 7 months ago) by pearu
Branches: MAIN
CVS tags: HEAD
Fixed memory leak. Starting the 3rd way.

# This file is part of the PyGiNaC package.
# http://cens.ioc.ee/projects/pyginac/
#
# $Revision: 1.7 $
# $Id: ex.py,v 1.7 2001-04-19 16:43:16 pearu Exp $
#
# Copyright 2001 Pearu Peterson all rights reserved,
# Pearu Peterson <pearu@cens.ioc.ee>
# Permission to use, modify, and distribute this software is given under the
# terms of the LGPL.  See http://www.fsf.org
#
# NO WARRANTY IS EXPRESSED OR IMPLIED.  USE AT YOUR OWN RISK.
#
# TODO:
# Finish docs.

depends = []

uses = ['basic','tinfo']

#STARTPROTO
class ex:
    """Lightweight wrapper for GiNaC's symbolic objects.
    Basically all it does is to hold a pointer to the other objects,
    manage the reference counting and provide methods for manipulation
    of these objects. (Some people call such a thing a proxy class.)
    """
    def __init__(self,*args):
        """
    
        """
    def swap(self,other):
        pass
    def info(self, inf):
        pass
    def nops(self):
        pass
    def expand(self,options=0):
        pass
    def has(self,other):
        pass
    def degree(self,s):
        pass
    def ldegree(self,s):
        pass
    def coeff(self,s,n=1):
        pass
    def lcoeff(self,s):
        pass
    def tcoeff(self,s):
        pass
    def numer(self):
        pass
    def denom(self):
        pass
    def unit(self,s):
        pass
    def content(self,x):
        pass
    def integer_content(self):
        pass
    def primpart(self,x, cont=None):
        pass
    def normal(self,level=0):
        pass
    def smod(self,xi):
        pass
    def max_coefficient(self):
        pass
    def collect(self,s):
        pass
    def eval(self,level=0):
        pass
    def evalf(self,level=0):
        pass
    def diff(self,s,nth=1):
        pass
    def series(self,rel,order,options):
        pass
    def subs(self,e_ls,lr=None):
        pass
    def get_free_indices(self):
        pass
    def simplify_indexed(self,sp=None):
        pass
    def simplify_ncmul(self,v):
        pass
    def op(self,i):
        pass
    def lhs(self):
        pass
    def rhs(self):
        pass
    def is_equal(self,other):
        pass
    def is_zero(self):
        pass
    def return_type(self):
        pass
    def return_type_tinfo(self):
        pass
    def get_hash(self):
        pass
    def tinfo(self):
        pass
    def __coerce__(self,other):
        pass
    
def nops(e):
    pass
def has(e,s):
    pass
def expand(e, options = 0):
    pass
def degree(e,s):
    pass
def ldegree(e,s):
    pass
def coeff(e,s,n=1):
    pass
def numer(e):
    pass
def denom(e):
    pass
def normal(e,level=0):
    pass
def to_rational(e, repl_lst):
    pass
def collect(e,s):
    pass
def eval(e, level=0):
    pass
def evalf(e, level=0):
    pass
def diff(e,s,nth=1):
    pass
def series(e,rel,order, options=0):
    pass
def subs(e,e_ls,lr=None):
    pass
def op(e,i):
    pass
def lhs(e):
    pass
def rhs(e):
    pass
def is_zero(e):
    pass
#ENDPROTO

wrapperclass = '''

class ex_w : public GiNaC::ex {
  PyObject * self;
public:
  ex_w(): GiNaC::ex() {
    DEBUG_C("ex_w::ex_w(raw)");
  }
  ex_w(const GiNaC::ex & other): GiNaC::ex(other) {
    DEBUG_C("ex_w::ex_w(raw:GiNaC::ex)");
  }
  ex_w(const GiNaC::basic & other): GiNaC::ex(other) {
    DEBUG_C("ex_w::ex_w(raw:GiNaC::basic)");
  }
  ex_w(python::ref other);

  ex_w(PyObject * self_): GiNaC::ex(), self(self_) {
    DEBUG_C("ex_w::ex_w()");
  }
  ex_w(PyObject * self_, const GiNaC::ex & other): GiNaC::ex(other), self(self_) {
    DEBUG_C("ex_w::ex_w(GiNaC::ex)");
  }
  ex_w(PyObject * self_, const GiNaC::basic & other): GiNaC::ex(other), self(self_) {
    DEBUG_C("ex_w::ex_w(GiNaC::basic)");
  }
  ex_w(PyObject * self_, python::ref other): GiNaC::ex(ex_w(other)), self(self_) {
    DEBUG_C("ex_w::ex_w(ref)");
  }
#ifdef PYGINAC_lst
  ex_w(PyObject * self_, const std::string & s, const GiNaC::lst & l)
  : GiNaC::ex(s,l), self(self_) {
    DEBUG_C("ex_w::ex_w(string, ref)");
  }
  ex_w(PyObject * self_, const std::string & s, python::ref other)
  : GiNaC::ex(s,as_lst_w(other)), self(self_) {
    DEBUG_C("ex_w::ex_w(string, ref)");
  }
#endif
  ~ex_w() {
    DEBUG_C("ex_w::~ex_w()");
  }
  std::string python_str(void) const {
    std::ostrstream os;
    GiNaC::python_str(os, GiNaC::ex(*this));
    os << std::ends;
    return os.str();
  }
  std::string python_repr(void) const {
    std::ostrstream os;
    os << "ex(";
    GiNaC::python_repr(os, GiNaC::ex(*this));
    os << ")" << std::ends;
    return os.str();
  }

  static UNEX_RET power_w(const GiNaC::ex & b, python::ref e, python::ref m) {
    DEBUG_M("power(ex,ref,ref)");
    return UNEX(GiNaC::ex(GiNaC::power(b, ex_w(e))));
  }
  unsigned nops_w(void) const {
    unsigned n = this->nops();
    if (n==0) return n;
#ifdef PYGINAC_pyfunc
    if (is_ex_exactly_of_type(*this, function) && is_ex_exactly_of_type(this->op(n-1), pyfunc))
      return n-1;
#endif
    return n;
  }
  UNEX_RET op_w(int i) const {
    DEBUG_M("ex.op(int)");
    if ((i>=(int)this->nops_w()) || (i<0)) {
      PyErr_SetString(PyExc_IndexError, "ex.op index out of range");
      throw python::error_already_set();
    }
    return UNEX(this->op(i));
  }
  bool has_w(python::ref other) const { return this->has(ex_w(other)); }
   void swap_w(GiNaC::ex other) { this->swap(other); }
   UNEX_RET eval0_w(void) const { return UNEX(this->eval()); }
   UNEX_RET eval1_w(int level) const { return UNEX(this->eval(level)); }
   UNEX_RET evalf0_w(void) const { return UNEX(this->evalf()); }
   UNEX_RET evalf1_w(int level) const { return UNEX(this->evalf(level)); }
   UNEX_RET expand0_w(void) const { return UNEX(this->expand()); }
   UNEX_RET expand1_w(unsigned options) const { return UNEX(this->expand(options)); }
   int degree_w(python::ref o) const { return this->degree(ex_w(o)); }
   int ldegree_w(python::ref o) const { return this->ldegree(ex_w(o)); }
   UNEX_RET coeff1_w(python::ref o) const { return UNEX(this->coeff(ex_w(o))); }
   UNEX_RET coeff2_w(python::ref o, int n) const { return UNEX(this->coeff(ex_w(o), n)); }
   UNEX_RET lcoeff_w(python::ref o) const { return UNEX(this->lcoeff(ex_w(o))); }
   UNEX_RET tcoeff_w(python::ref o) const { return UNEX(this->tcoeff(ex_w(o))); }
#ifdef PYGINAC_symbol
   UNEX_RET unit_w(python::ref o) const { return UNEX(this->unit(as_symbol_w(o))); }
   UNEX_RET content_w(python::ref o) const { return UNEX(this->content(as_symbol_w(o))); }
   UNEX_RET primpart1_w(python::ref o) const { return UNEX(this->primpart(as_symbol_w(o))); }
   UNEX_RET primpart2_w(python::ref o, python::ref cont) const { return UNEX(this->primpart(as_symbol_w(o), ex_w(cont))); }
   UNEX_RET diff1_w(python::ref s) const { return UNEX(this->diff(as_symbol_w(s))); }
   UNEX_RET diff_w(python::ref s,unsigned nth) const { return UNEX(this->diff(as_symbol_w(s),nth)); }
#endif
   UNEX_RET normal0_w(void) const { return UNEX(this->normal()); }
   UNEX_RET normal1_w(int level) const { return UNEX(this->normal(level)); }
#ifdef PYGINAC_lst
   UNEX_RET to_rational_w(python::ref o) {
    GiNaC::lst l = as_lst_w(o);
    return UNEX(this->to_rational(l)); }
#endif
#ifdef PYGINAC_numeric
   UNEX_RET smod_w(python::ref o) const { return UNEX(this->smod(as_numeric_w(o))); }
#endif
   UNEX_RET subs1_w(const GiNaC::ex & r) const { return UNEX(this->subs(r)); }
#ifdef PYGINAC_lst
   UNEX_RET subs1g_w(python::ref s) const { return UNEX(this->subs(as_lst_w(s))); }
   UNEX_RET subs2_w(python::ref s1,python::ref s2) const { return UNEX(this->subs(as_lst_w(s1),as_lst_w(s2))); }
#endif
#ifdef PYGINAC_relational
   UNEX_RET series2_w(python::ref rel,int order) { return UNEX(this->series(as_relational_w(rel),order)); }
   UNEX_RET series3_w(python::ref rel,int order,unsigned opt) { return UNEX(this->series(as_relational_w(rel),order,opt)); }
#endif
   UNEX_RET collect_w(python::ref s) const { return UNEX(this->collect(ex_w(s))); }
   bool is_equal_w(python::ref s) const { return this->is_equal(ex_w(s)); }
   UNEX_RET simplify_indexed0_w(void) const { return UNEX(this->simplify_indexed()); }
#ifdef PYGINAC_scalar_products
   UNEX_RET simplify_indexed1_w(python::ref o) const { return UNEX(this->simplify_indexed(as_scalar_products_w(o))); }
#endif
#ifdef PYGINAC_exvector
   UNEX_RET simplify_ncmul_w(python::ref o) const { return UNEX(this->simplify_ncmul(as_exvector_w(o))); }
#endif
   unsigned tinfo_w(void) const {return this->bp->tinfo(); }

  python::ref unex(void) const {
    switch (this->bp->tinfo()) {
'''
for c in ['symbol','numeric','add','mul','power','function','constant',
          'relational','matrix','ncmul','pseries','lst','indexed',
          'idx','varidx','color','clifford']:
    wrapperclass += '''
#ifdef PYGINAC_#class#
    case GiNaC::TINFO_#class#: return BOOST_PYTHON_CONVERSION::to_python((const GiNaC::#class# &)(*(this->bp)));
#endif
'''.replace('#class#',c)

wrapperclass += '''
  }
    return BOOST_PYTHON_CONVERSION::to_python((const GiNaC::ex &)(*this));
  }
  static python::tuple coerce(const GiNaC::ex & left, python::ref right) {
    if (0) ;
#ifdef PYGINAC_numeric
    else if (is_ex_exactly_of_type(left, numeric))
      return numeric_coerce(ex_to_numeric(left), right);
#endif
#ifdef PYGINAC_matrix
    else if (is_ex_exactly_of_type(left, matrix))
      return matrix_coerce(ex_to_matrix(left), right);
#endif
    return python::tuple(left,(const GiNaC::ex &)ex_w(right));
  }
   UNEX_RET op_pos(void) const {return UNEX(+(*this)); }
   UNEX_RET op_neg(void) const {return UNEX(-(*this)); }
   UNEX_RET op_add(python::ref other) const { return UNEX((*this)+ex_w(other)); }
   UNEX_RET op_sub(python::ref other) const { return UNEX((*this)-ex_w(other)); }
   UNEX_RET op_mul(python::ref other) const { return UNEX((*this)*ex_w(other)); }
   UNEX_RET op_div(python::ref other) const { return UNEX((*this)/ex_w(other)); }
   UNEX_RET op_pow(python::ref other, python::ref m) const { return UNEX(GiNaC::ex(GiNaC::power(*this,ex_w(other)))); }
/*
  //inline UNEX_RET op_rpow(python::ref other, python::ref m) const { return UNEX(GiNaC::ex(GiNaC::power((const GiNaC::ex &)ex_w(other),*this))); }
   UNEX_RET op_radd(python::ref other) const { return UNEX(ex_w(other)+(*this)); }
   UNEX_RET op_rsub(python::ref other) const { return UNEX(ex_w(other)-(*this)); }
   UNEX_RET op_rmul(python::ref other) const { return UNEX(ex_w(other)*(*this)); }
   UNEX_RET op_rdiv(python::ref other) const { return UNEX(ex_w(other)/(*this)); }
*/
};



'''

protos = '''
'''

builder = '''
python::class_builder<ex_w> ex_w_class(this_module, "_ex_w");
python::class_builder<GiNaC::ex, ex_w> ex_class(this_module, "ex");
ex_py_class = python::as_object(ex_class.get_extension_class());
ex_class.declare_base(ex_w_class);
'''

constructors = '''
ex_class.def(python::constructor<>());
ex_class.def(python::constructor<const ex_w &>());
ex_class.def(python::constructor<const basic_w &>());
ex_class.def(python::constructor<python::ref>());
#ifdef PYGINAC_lst
ex_class.def(python::constructor<const std::string &, const GiNaC::lst &>());
ex_class.def(python::constructor<const std::string &, python::ref>());
#endif
'''

defs = '''
ex_class.def(&ex_w::python_str, "__str__");
ex_class.def(&ex_w::python_repr, "__repr__");
//ex_class.def(&ex_w::power_w, "__pow__");
ex_class.def(&ex_w::coerce, "__coerce__");
ex_class.def(&ex_w::op_pos, "__pos__");
ex_class.def(&ex_w::op_neg, "__neg__");
ex_class.def(&ex_w::op_add, "__add__");
ex_class.def(&ex_w::op_sub, "__sub__");
ex_class.def(&ex_w::op_mul, "__mul__");
ex_class.def(&ex_w::op_div, "__div__");
ex_class.def(&ex_w::op_pow, "__pow__");
/*
ex_class.def(&ex_w::op_radd, "__radd__");
ex_class.def(&ex_w::op_rsub, "__rsub__");
ex_class.def(&ex_w::op_rmul, "__rmul__");
ex_class.def(&ex_w::op_rdiv, "__rdiv__");
//ex_class.def(&ex_w::op_rpow, "__rpow__");
*/

//ex_class.def(&ex_lt, "__lt__"); // not yet supported by boost.python
//ex_class.def(python::operators<(python::op_sub | python::op_add | python::op_mul | python::op_div | python::op_neg | python::op_pos)>());

ex_class.def(&ex_w::swap_w, "swap");
ex_class.def(&ex_w::info, "info");
ex_class.def(&ex_w::nops_w, "nops");
ex_class.def(&ex_w::expand0_w, "expand");
ex_class.def(&ex_w::expand1_w, "expand");
ex_class.def(&ex_w::has_w, "has");
ex_class.def(&ex_w::degree_w, "degree");
ex_class.def(&ex_w::ldegree_w, "ldegree");
ex_class.def(&ex_w::coeff1_w, "coeff");
ex_class.def(&ex_w::coeff2_w, "coeff");
ex_class.def(&ex_w::lcoeff_w, "lcoeff");
ex_class.def(&ex_w::numer, "numer");
ex_class.def(&ex_w::denom, "denom");
#ifdef PYGINAC_symbol
ex_class.def(&ex_w::unit_w, "unit");
ex_class.def(&ex_w::content_w, "content");
#endif
#ifdef PYGINAC_numeric
ex_class.def(&ex_w::integer_content, "integer_content");
#endif
#ifdef PYGINAC_symbol
ex_class.def(&ex_w::primpart1_w, "primpart");
ex_class.def(&ex_w::primpart2_w, "primpart");
#endif
ex_class.def(&ex_w::normal0_w, "normal");
ex_class.def(&ex_w::normal1_w, "normal");
//ex_class.def(&ex_w::to_rational, "to_rational");
#ifdef PYGINAC_numeric
ex_class.def(&ex_w::smod_w, "smod");
ex_class.def(&ex_w::max_coefficient, "max_coefficient");
#endif
ex_class.def(&ex_w::collect_w, "collect");
ex_class.def(&ex_w::eval0_w, "eval");
ex_class.def(&ex_w::eval1_w, "eval");
ex_class.def(&ex_w::evalf0_w, "evalf");
ex_class.def(&ex_w::evalf1_w, "evalf");
#ifdef PYGINAC_symbol
ex_class.def(&ex_w::diff1_w, "diff");
ex_class.def(&ex_w::diff_w, "diff");
#endif
#ifdef PYGINAC_relational
ex_class.def(&ex_w::series2_w, "series");
ex_class.def(&ex_w::series3_w, "series");
#endif
#ifdef PYGINAC_lst
ex_class.def(&ex_w::subs1g_w, "subs");
ex_class.def(&ex_w::subs2_w, "subs");
#endif
#ifdef PYGINAC_exvector
ex_class.def(&ex_w::get_free_indices, "get_free_indices");
#endif
ex_class.def(&ex_w::simplify_indexed0_w, "simplify_indexed");
#ifdef PYGINAC_scalar_product
ex_class.def(&ex_w::simplify_indexed1_w, "simplify_indexed");
#endif
#ifdef PYGINAC_exvector
ex_class.def(&ex_w::simplify_ncmul, "simplify_ncmul");
#endif
ex_class.def(&ex_w::op_w, "op");
//ex_class.def(&ex_w::let_op_w, "let_op");
ex_class.def(&ex_w::lhs, "lhs");
ex_class.def(&ex_w::rhs, "rhs");
//ex_class.def(&ex_w::compare, "compare"); // for GiNaC internal use only
ex_class.def(&ex_w::is_equal_w, "is_equal");
ex_class.def(&ex_w::is_zero, "is_zero");
ex_class.def(&ex_w::return_type, "return_type");
ex_class.def(&ex_w::return_type_tinfo, "return_type_tinfo");
ex_class.def(&ex_w::gethash, "get_hash");
//ex_class.def(&ex_w::exadd, "exadd");
//ex_class.def(&ex_w::exmul, "exmul");
//ex_class.def(&ex_w::exncmul, "exncmul");
ex_class.def(&ex_w::tinfo_w, "tinfo");
'''

wrapperclass += '''
 unsigned nops_w(python::ref e) { return ex_w(e).nops_w(); }
 bool has_w(python::ref e, python::ref other) { return ex_w(e).has_w(other); }
 UNEX_RET expand0_w(python::ref e) { return UNEX(ex_w(e).expand()); }
 UNEX_RET expand1_w(python::ref e,unsigned options) { return UNEX(ex_w(e).expand(options)); }
 int degree_w(python::ref e, python::ref o) { return ex_w(e).degree_w(o); }
 int ldegree_w(python::ref e, python::ref o) { return ex_w(e).ldegree_w(o); }
 UNEX_RET coeff1_w(python::ref e, python::ref o) { return ex_w(e).coeff1_w(o); }
 UNEX_RET coeff2_w(python::ref e, python::ref o, int n) { return ex_w(e).coeff2_w(o,n); }
 UNEX_RET numer_w(python::ref e) { return UNEX(ex_w(e).numer()); }
 UNEX_RET denom_w(python::ref e) { return UNEX(ex_w(e).denom()); }
 UNEX_RET normal0_w(python::ref e) { return UNEX(ex_w(e).normal()); }
 UNEX_RET normal1_w(python::ref e, int level) { return UNEX(ex_w(e).normal(level)); }
#ifdef PYGINAC_lst
 UNEX_RET to_rational_w(python::ref e,python::ref o) {
  GiNaC::lst l = as_lst_w(o);
  return UNEX(ex_w(e).to_rational(l)); }
#endif
 UNEX_RET collect_w(python::ref e, python::ref s) { return UNEX(ex_w(e).collect(ex_w(s))); }
 UNEX_RET eval0_w(python::ref e) { return UNEX(ex_w(e).eval()); }
 UNEX_RET eval1_w(python::ref e, int level) { return UNEX(ex_w(e).eval(level)); }
 UNEX_RET evalf0_w(python::ref e) { return UNEX(ex_w(e).evalf()); }
 UNEX_RET evalf1_w(python::ref e, int level) { return UNEX(ex_w(e).evalf(level)); }
#ifdef PYGINAC_symbol
 UNEX_RET diff1_w(python::ref e, python::ref s) { return ex_w(e).diff1_w(s); }
 UNEX_RET diff_w(python::ref e, python::ref s,unsigned nth) { return ex_w(e).diff_w(s,nth); }
#endif
#ifdef PYGINAC_relational
 UNEX_RET series2_w(python::ref e, python::ref rel, int order) { return ex_w(e).series2_w(rel,order); }
 UNEX_RET series3_w(python::ref e, python::ref rel, int order, unsigned opt) { return ex_w(e).series3_w(rel,order,opt); }
#endif
 UNEX_RET subs1_w(python::ref e, const GiNaC::ex & s) { return ex_w(e).subs1_w(s); }
#ifdef PYGINAC_lst
 UNEX_RET subs1g_w(python::ref e, python::ref s) { return ex_w(e).subs1g_w(s); }
 UNEX_RET subs2_w(python::ref e, python::ref s1,python::ref s2) { return ex_w(e).subs2_w(s1,s2); }
#endif
 UNEX_RET op_w(python::ref e, int i) { return ex_w(e).op_w(i); }
#ifdef PYGINAC_relational
 UNEX_RET lhs_w(python::ref e) { return UNEX(as_relational_w(e).lhs()); }
 UNEX_RET rhs_w(python::ref e) { return UNEX(as_relational_w(e).rhs()); }
#endif
 bool is_zero_w(python::ref e) { return ex_w(e).is_zero(); }

'''

defs += '''
this_module.def(nops_w, "nops");
this_module.def(has_w, "has");
this_module.def(expand0_w, "expand");
this_module.def(expand1_w, "expand");
this_module.def(degree_w, "degree");
this_module.def(ldegree_w, "ldegree");
this_module.def(coeff1_w, "coeff");
this_module.def(coeff2_w, "coeff");
this_module.def(numer_w, "numer");
this_module.def(denom_w, "denom");
this_module.def(normal0_w, "normal");
this_module.def(normal1_w, "normal");
#ifdef PYGINAC_lst
this_module.def(to_rational_w, "to_rational");
#endif
this_module.def(collect_w, "collect");
this_module.def(eval0_w, "eval");
this_module.def(eval1_w, "eval");
this_module.def(evalf0_w, "evalf");
this_module.def(evalf1_w, "evalf");
#ifdef PYGINAC_symbol
this_module.def(diff1_w, "diff");
this_module.def(diff_w, "diff");
#endif
#ifdef PYGINAC_relational
this_module.def(series2_w, "series");
this_module.def(series3_w, "series");
#endif
this_module.def(subs1_w, "subs");
#ifdef PYGINAC_lst
this_module.def(subs1g_w, "subs");
this_module.def(subs2_w, "subs");
#endif
this_module.def(op_w, "op");
#ifdef PYGINAC_relational
this_module.def(lhs_w, "lhs");
this_module.def(rhs_w, "rhs");
#endif
this_module.def(is_zero_w, "is_zero");
//this_module.def(GiNaC::swap, "swap");
'''

implementation = '''
inline GiNaC::ex as_ex_w(python::ref obj) { return ex_w(obj); }

ex_w::ex_w(python::ref other): GiNaC::ex() {
  PyObject * o = other.get();
  DEBUG_C("ex_w::ex_w(raw:ref)");
  if (PyInt_Check(o)) {
    GiNaC::ex::ex(PyInt_AS_LONG(o)).swap(*this);
  } else if (PyFloat_Check(o)) {
    GiNaC::ex::ex(PyFloat_AS_DOUBLE(o)).swap(*this);
  } else if (PyComplex_Check(o)) {
    GiNaC::numeric n(cln::complex(PyComplex_RealAsDouble(o),PyComplex_ImagAsDouble(o)));
    GiNaC::ex::ex(n).swap(*this);
  } else if (BasicInstance_Check(o)) {
    Py_INCREF(o);
    GiNaC::ex::ex(BOOST_PYTHON_CONVERSION::from_python(o, python::type<const GiNaC::basic &>())).swap(*this);
    Py_DECREF(o);
  } else if (ExInstance_Check(o)) {
    Py_INCREF(o);
    GiNaC::ex::ex(BOOST_PYTHON_CONVERSION::from_python(o, python::type<const GiNaC::ex &>())).swap(*this);
    Py_DECREF(o);
  } else {
    cerr<<"ex_w("<<PyString_AsString(PyObject_Repr(o))<<")";
    PyErr_SetString(PyExc_TypeError, "ex() argument must be int|float|complex|basic|ex|string,sequence");
    throw python::error_already_set();
  }
}
'''






FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>