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

Do not access PyFrameObject fields directly on Python 3.9+ #1928

Merged

Conversation

musicinmybrain
Copy link
Contributor

Fixes a Python 3.11 incompatibility. Still accesses PyCodeObject fields directly.

Description of Change(s)

Fixes Issue(s)

  • (No issue filed.)
  • I have submitted a signed Contributor License Agreement

pxr/base/tf/pyTracing.cpp Outdated Show resolved Hide resolved
Fixes a Python 3.11 incompatibility. Still accesses PyCodeObject fields
directly.
@musicinmybrain
Copy link
Contributor Author

Adjusted based on @hroncok’s good suggestion. Also adjusted the C-style cast style to match others in the codebase ((Foo *) var(Foo *)var).

@musicinmybrain
Copy link
Contributor Author

Now the patch defines a static inline compatibility version of PyFrame_GetCode on older Pythons that don’t have it, as suggested in https://docs.python.org/3.11/whatsnew/3.11.html#id6. I think the result is a bit cleaner.

Now PyFrame_GetCode is used exactly where it is available: Python 3.9.0b1 and later, again based on example in the CPython documentation.

I’ve made the change in a separate commit for clarity, but it can of course be squashed.

@musicinmybrain musicinmybrain changed the title Do not access PyFrameObject fields directly on Python 3.10+ Do not access PyFrameObject fields directly on Python 3.9+ Jun 30, 2022
@sunyab
Copy link
Contributor

sunyab commented Jun 30, 2022

Filed as internal issue #USD-7464

@pixar-oss pixar-oss merged commit 2c05644 into PixarAnimationStudios:dev Aug 16, 2022
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