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

Improve Tf.Status python binding #3311

Open
roggiezhang-nv opened this issue Sep 23, 2024 · 2 comments
Open

Improve Tf.Status python binding #3311

roggiezhang-nv opened this issue Sep 23, 2024 · 2 comments
Labels
needs review Issue needing input/review by the repo maintainer (Pixar)

Comments

@roggiezhang-nv
Copy link
Contributor

roggiezhang-nv commented Sep 23, 2024

Description of Issue

Tf.Status accepts a verbose argument in python

def Status(msg, verbose=True):

This has no equivalent in C++, so the binding attempts to set a "null context" by passing empty strings for module, functio, and filename.

Those arguments are passed to Tf_PythonCallContext

StatusHelper(Tf_PythonCallContext(fileName.c_str(), moduleName.c_str(),

which joins the module & function name without checking if they are empty

https://github.com/PixarAnimationStudios/OpenUSD/blob/release/pxr/base/tf/pyCallContext.cpp#L42

resulting in a TfCallContext with a function "." instead of the intended "" (or ideally None/nullptr).

This is highly confusing on the c++ side (e.g. in a TfDiagnosticMgr Delegate implementation).

Hopefully this is a non-contentious fix to check for empty string before joining.

But I also wonder if it wouldn't be better to use TfCallContext::hide() instead so c++ callsites could check diagnostic.GetContext().IsHidden() rather than diagnostic.GetSourceFunction().empty()

Steps to Reproduce

System Information (OS, Hardware)

Package Versions

Build Flags

@roggiezhang-nv roggiezhang-nv changed the title Improve Tf.Status python binding Improve Tf.Status python binding Sep 23, 2024
@roggiezhang-nv
Copy link
Contributor Author

@nvmkuruc for vis.

@jesschimein
Copy link
Contributor

Filed as internal issue #USD-10179

@nvmkuruc nvmkuruc added the needs review Issue needing input/review by the repo maintainer (Pixar) label Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs review Issue needing input/review by the repo maintainer (Pixar)
Projects
None yet
Development

No branches or pull requests

3 participants