Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed a subtle bug with Node fetch and Object role initialization #802

Merged
merged 1 commit into from Jul 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -12,6 +12,7 @@ and this project aspires to adhere to [Semantic Versioning](https://semver.org/s
- Avoid compile issue with using `_Pragma()` with Python 3.8 on Windows
- `conduit_node` and `conduit_datatype` in the C API are no longer aliases to `void` so that callers cannot pass just any pointer to the APIs.
- Fixed overread issue with Fortran API due to int vs bool binding error. Fortran API still provides logical returns for methods like conduit_node_has_path() however the binding implementation now properly translates C_INT return codes into logical values.
- Fixed a subtle bug with Node fetch and Object role initialization.

#### Blueprint
- Added the `blueprint::mesh::examples::polychain` example. It is an example of a polyhedral mesh. See Mesh Blueprint Examples docs (https://llnl-conduit.readthedocs.io/en/latest/blueprint_mesh.html#polychain) for more details.
Expand Down
2 changes: 1 addition & 1 deletion src/libs/conduit/conduit_node.cpp
Expand Up @@ -13412,7 +13412,7 @@ Node&
Node::fetch(const std::string &path)
{
// fetch w/ path forces OBJECT_ID
if(dtype().is_object())
if(!dtype().is_object())
{
init(DataType::object());
}
Expand Down
17 changes: 17 additions & 0 deletions src/tests/conduit/t_conduit_node.cpp
Expand Up @@ -1302,5 +1302,22 @@ TEST(conduit_node, describe)

}

//-----------------------------------------------------------------------------
TEST(conduit_node, avoid_crazy_town)
{
Node n;
n.append() = "here";
n.append() = "there";
n.print();
n["crazy_town"] = "not here";
std::string res = n.to_string();
std::cout << "res = " << res << std::endl;
EXPECT_EQ(res,"\ncrazy_town: \"not here\"\n");
}