Skip to content

Commit

Permalink
Per #1954, trying to debug difference in behavior on my Mac vs Seneca.
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnHalleyGotway committed Sep 6, 2022
1 parent d4605af commit 82ec2f7
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 7 deletions.
6 changes: 4 additions & 2 deletions src/libcode/vx_data2d_python/grid_from_python_dict.cc
Original file line number Diff line number Diff line change
Expand Up @@ -495,15 +495,17 @@ void lookup_python_num_array(const Python3_Dict & dict, const char *key, NumArra

{

PyObject * obj = dict.lookup_list(key);
PyObject * obj = dict.lookup_item(key);

/* JHG
Python3_List list(obj);
for (int j=0; j<(list.size()); ++j) {
vals.add(pyobject_as_double(list[j]));
}

*/
return;

}
Expand Down
27 changes: 27 additions & 0 deletions src/libcode/vx_python3_utils/python3_dict.cc
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,33 @@ return ( s );
////////////////////////////////////////////////////////////////////////


PyObject * Python3_Dict::lookup_item(const char * key) const

{

PyObject * a = 0;

a = PyDict_GetItemString(Object, key);

if ( ! a ) {

mlog << Error << "\nPython3_Dict::lookup_item(const char * key) -> "
<< "value for key \"" << key << "\" not found\n\n";

exit ( 1 );

}

cout << "JHG key " << key << " has type " << Py_TYPE(a)->tp_name << "\n";

return ( a );

}


////////////////////////////////////////////////////////////////////////


PyObject * Python3_Dict::lookup_dict(const char * key) const

{
Expand Down
11 changes: 6 additions & 5 deletions src/libcode/vx_python3_utils/python3_dict.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,13 @@ class Python3_Dict {
int size() const;


int lookup_int (const char * key) const;
double lookup_double (const char * key) const;
ConcatString lookup_string (const char * key, bool error_out = true) const;
int lookup_int (const char * key) const;
double lookup_double (const char * key) const;
ConcatString lookup_string (const char * key, bool error_out = true) const;

PyObject * lookup_dict (const char * key) const;
PyObject * lookup_list (const char * key) const;
PyObject * lookup_item (const char * key) const;
PyObject * lookup_dict (const char * key) const;
PyObject * lookup_list (const char * key) const;

};

Expand Down

0 comments on commit 82ec2f7

Please sign in to comment.