Skip to content

Commit 2acadcf

Browse files
author
Viktor Gyenes
committed
fix compile error caused by non-standard ?: operator in nnef.cpp
1 parent f0001f9 commit 2acadcf

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

nnef-pyproject/nnef/nnef.cpp

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,11 @@ static PyObject* parse( PyObject* self, PyObject* args, PyObject* kwargs, bool i
404404
return NULL;
405405
}
406406

407+
if ( !stdlib )
408+
{
409+
stdlib = "";
410+
}
411+
407412
std::ifstream gfs, qfs;
408413
std::stringstream gss, qss;
409414

@@ -440,12 +445,6 @@ static PyObject* parse( PyObject* self, PyObject* args, PyObject* kwargs, bool i
440445
std::istream& gis = isFile ? (std::istream&)gfs : (std::istream&)gss;
441446
std::istream& qis = isFile ? (std::istream&)qfs : (std::istream&)qss;
442447

443-
std::string stdlib_source;
444-
if ( stdlib )
445-
{
446-
stdlib_source = stdlib;
447-
}
448-
449448
std::set<std::string> lowered;
450449
if ( lower )
451450
{
@@ -462,7 +461,7 @@ static PyObject* parse( PyObject* self, PyObject* args, PyObject* kwargs, bool i
462461
}
463462
}
464463

465-
nnef::CompParser parser(stdlib_source, lowered);
464+
nnef::CompParser parser(stdlib, lowered);
466465

467466
GraphCallback callback(qis, isFile ? quant : "quantization");
468467

@@ -512,6 +511,11 @@ static PyObject* createSession( PyObject* self, PyObject* args, PyObject* kwargs
512511
return NULL;
513512
}
514513

514+
if ( !stdlib )
515+
{
516+
stdlib = "";
517+
}
518+
515519
std::set<std::string> lowered;
516520
if ( lower )
517521
{
@@ -531,7 +535,7 @@ static PyObject* createSession( PyObject* self, PyObject* args, PyObject* kwargs
531535
std::unique_ptr<nnef::Graph> graph(new nnef::Graph());
532536
std::string error;
533537

534-
if ( !nnef::load_graph(path, *graph, error, stdlib ?: "", lowered) )
538+
if ( !nnef::load_graph(path, *graph, error, stdlib, lowered) )
535539
{
536540
PyErr_SetString(PyExc_ValueError, error.c_str());
537541
return NULL;

0 commit comments

Comments
 (0)