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: Replace _Py_IsFinalizing with Py_IsFinalizing for Python 3.13 compatibility and added version hex #2360

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Ko496-glitch
Copy link

Summary

  • Addressed issue Build failure with Python 3.13 #2358 by replacing the deprecated _Py_IsFinalizing with the public API Py_IsFinalizing, introduced in Python 3.13.
  • Added version gating using PY_VERSION_HEX to ensure compatibility with older Python versions.

Changes:

  • Updated AsyncioExecutor.h:
    • Replaced _Py_IsFinalizing with Py_IsFinalizing.
    • Added a macro to alias _Py_IsFinalizing for Python versions before 3.13.

Reference:

@facebook-github-bot
Copy link
Contributor

Hi @Ko496-glitch!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@gmarzot
Copy link

gmarzot commented Jan 9, 2025

@Ko496-glitch I noticed you working in this area and wanted to draw your attention to this PR #2361 I would be interested in how you are building and encountered the python 3.13 issue and any review comments on the PR. That PR also handles the issue Issue #2358

@Ko496-glitch
Copy link
Author

@gmarzot for this issue i just went through the python directory in the codebase and checked for the most relevant file, good amount of info was already presented as this issue was also handled back in june in pr #42034. The change also seems good to the issuer. let me know if you want any other info on this PR.

@Ko496-glitch
Copy link
Author

@gmarzot Hi just checking in to see if everything is good for this PR?

@gmarzot
Copy link

gmarzot commented Jan 12, 2025

@gmarzot Hi just checking in to see if everything is good for this PR?

I think something like this below is clearer and more direct:

 private:
  static bool isPyFinalizing() noexcept {
#if PY_VERSION_HEX <= 0x03070000     // unsupported anyway - can remove
    return false;
#elif PY_VERSION_HEX >= 0x030D0000  // Python 3.13+
    return Py_IsFinalizing();
#else
    return _Py_IsFinalizing();
#endif
  }

I think the PR I have here includes this solution and addresses a number of other issues getting the python bindings working so I would recommend that PR to the maintainers

@facebook-github-bot
Copy link
Contributor

@Orvid has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants