Changeset 11336:da96782f1c2b in orange


Ignore:
Timestamp:
02/20/13 11:05:12 (14 months ago)
Author:
Ales Erjavec <ales.erjavec@…>
Branch:
default
Message:

Fixed argument parsing in probability estimator constructors.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • source/orange/lib_components.cpp

    r10478 r11336  
    24592459    argp = args; 
    24602460    if ((argp != argc) && ((*argp==Py_None) || PyOrDistribution_Check(*argp))) { 
    2461         dist = (*argp==Py_None) ? PDistribution() : PyOrange_AsDistribution(*argp++); 
     2461        if (*argp == Py_None){ 
     2462            dist = PDistribution(); 
     2463            argp++; 
     2464        } else { 
     2465            dist = PyOrange_AsDistribution(*argp++); 
     2466        } 
     2467 
    24622468        if ((argp != argc) && PyOrDistribution_Check(*argp)) 
    24632469            apriori = PyOrange_AsDistribution(*argp++); 
     
    25152521    PExampleGenerator gen; 
    25162522    int weightID = 0; 
    2517     if (!PyArg_UnpackTuple(uargs, "ProbabilityEstimatorConstructor.call", 0, 4, args, args+1, args+2, args+3)) 
     2523    if (!PyArg_UnpackTuple(uargs, "ConditionalProbabilityEstimatorConstructor.call", 0, 4, args, args+1, args+2, args+3)) 
    25182524        return PYNULL; 
    25192525 
     
    25252531    argp = args; 
    25262532    if ((argp != argc) && ((*argp==Py_None) || PyOrContingency_Check(*argp))) { 
    2527         cont = (*argp==Py_None) ? PContingency() : PyOrange_AsContingency(*argp++); 
     2533        if (*argp==Py_None){ 
     2534            cont = PContingency(); 
     2535            argp++; 
     2536        } else { 
     2537            cont = PyOrange_AsContingency(*argp++); 
     2538        } 
     2539 
    25282540        if ((argp != argc) && PyOrDistribution_Check(*argp)) 
    25292541            apriori = PyOrange_AsDistribution(*argp++); 
     
    25392551 
    25402552    if (argp != argc) 
    2541         PYERROR(PyExc_TypeError, "Invalid arguments for 'ProbabilityEstimatorConstructor.call'", PYNULL); 
     2553        PYERROR(PyExc_TypeError, "Invalid arguments for 'ConditionalProbabilityEstimatorConstructor.call'", PYNULL); 
    25422554 
    25432555    return WrapOrange(cest->call(cont, apriori, gen, weightID)); 
Note: See TracChangeset for help on using the changeset viewer.