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

Fix python wrappers to be explicit for RTLD_GLOBAL environments. #641

Conversation

abucior
Copy link

@abucior abucior commented Oct 1, 2018

I recently ran into some problems with the Python bindings to USD. Our Python configuration uses RTLD_GLOBAL for legacy reasons.

The problem with this is that multiple USD projects contain functions with the same name. For example, there are multiple "wrapRegistry()" and "wrapNode()" functions defined in various places. We were seeing problems where, for example, ndr's module wrap function ended up calling sdr's wrapRegistry() instead of ndr's, and ndr's wrapRegistry() was never called. This led to various runtime errors. Our workaround was to rename wrapRegistry() in sdr as "wrapSdrRegistry()", for example, and use TF_WRAP(SdrRegistry) in the module wrapper. We made a handful of changes like this to make all the wrap calls explicit.

Description of Change(s)

This change makes all python wrappers uniquely named.

Fixes Issue(s)

I recently ran into some problems with the Python bindings to USD. Our Python configuration uses RTLD_GLOBAL for legacy reasons.

The problem with this is that multiple USD projects contain functions with the same name. For example, there are multiple "wrapRegistry()" and "wrapNode()" functions defined in various places. We were seeing problems where, for example, ndr's module wrap function ended up calling sdr's wrapRegistry() instead of ndr's, and ndr's wrapRegistry() was never called. This led to various runtime errors.  Our workaround was to rename wrapRegistry() in sdr as "wrapSdrRegistry()", for example, and use TF_WRAP(SdrRegistry) in the module wrapper. We made a handful of changes like this to make all the wrap calls explicit.

This change makes all python wrappers uniquely named.
@jtran56
Copy link

jtran56 commented Oct 4, 2018

Filed as internal issue #USD-4800.

pixar-oss pushed a commit that referenced this pull request Oct 25, 2018
These wrapping functions are an implementation detail
and do not need to be exported from the Python module.
This also avoids issues when wrapping functions from
different libraries have the same name and Python is
set to load modules using RTLD_GLOBAL.

Also update some old documentation.

Addresses #641

(Internal change: 1903686)
@c64kernal
Copy link
Contributor

Hi @abucior -- we think with commit f61f103 this would no longer be needed. Please reopen if for some reason you're still running into issues that require this PR. Thanks!

@c64kernal c64kernal closed this Jan 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants