You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "tacaswell (via GitHub)" <gi...@apache.org> on 2024/06/07 17:53:34 UTC

[PR] GH-41475: [PYTHON] build with py313 [arrow]

tacaswell opened a new pull request, #42034:
URL: https://github.com/apache/arrow/pull/42034

   
   <!--
   Thanks for opening a pull request!
   If this is your first pull request you can find detailed information on how 
   to contribute here:
     * [New Contributor's Guide](https://arrow.apache.org/docs/dev/developers/guide/step_by_step/pr_lifecycle.html#reviews-and-merge-of-the-pull-request)
     * [Contributing Overview](https://arrow.apache.org/docs/dev/developers/overview.html)
   
   
   If this is not a [minor PR](https://github.com/apache/arrow/blob/main/CONTRIBUTING.md#Minor-Fixes). Could you open an issue for this pull request on GitHub? https://github.com/apache/arrow/issues/new/choose
   
   Opening GitHub issues ahead of time contributes to the [Openness](http://theapacheway.com/open/#:~:text=Openness%20allows%20new%20users%20the,must%20happen%20in%20the%20open.) of the Apache Arrow project.
   
   Then could you also rename the pull request title in the following format?
   
       GH-${GITHUB_ISSUE_ID}: [${COMPONENT}] ${SUMMARY}
   
   or
   
       MINOR: [${COMPONENT}] ${SUMMARY}
   
   In the case of PARQUET issues on JIRA the title also supports:
   
       PARQUET-${JIRA_ISSUE_ID}: [${COMPONENT}] ${SUMMARY}
   
   -->
   
   ### Rationale for this change
   
   The private function `_Py_IsFinalizing` renamed to `Py_IsFinalizing` in Python 3.13.0a1.  Without this change pyarrow will not compile with this version of Python or higher.
   
   Closes #41475
   
   
   <!--
    Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
    Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.  
   -->
   
   ### What changes are included in this PR?
   
   add a version-gated `#define` to handle the change.
   
   <!--
   There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
   -->
   
   ### Are these changes tested?
   
   Local build succeeds. 
   
   <!--
   We typically require tests for all PRs in order to:
   1. Prevent the code from being accidentally broken by subsequent changes
   2. Serve as another way to document the expected behavior of the code
   
   If tests are not included in your PR, please explain why (for example, are they covered by existing tests)?
   -->
   
   ### Are there any user-facing changes?
   
   no
   
   <!--
   If there are user-facing changes then we may require documentation to be updated before approving the PR.
   -->
   
   <!--
   If there are any breaking changes to public APIs, please uncomment the line below and explain which changes are breaking.
   -->
   <!-- **This PR includes breaking changes to public APIs.** -->
   
   <!--
   Please uncomment the line below (and provide explanation) if the changes fix either (a) a security vulnerability, (b) a bug that caused incorrect or invalid data to be produced, or (c) a bug that causes a crash (even when the API contract is upheld). We use this to highlight fixes to issues that may affect users without their knowledge. For this reason, fixing bugs that cause errors don't count, since those are usually obvious.
   -->
   <!-- **This PR contains a "Critical Fix".** -->


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-41475: [Python] Build with py313 [arrow]

Posted by "jorisvandenbossche (via GitHub)" <gi...@apache.org>.
jorisvandenbossche commented on PR #42034:
URL: https://github.com/apache/arrow/pull/42034#issuecomment-2160771023

   > Instead of doing such adjustements one by one, how about we vendor a version of https://github.com/python/pythoncapi-compat ?
   
   I am not very familiar with it to estimate how much we would make use of it (this PR also essentially only adds 3 lines, and the actual changes to change `_Py_IsFinalizing` to `Py_IsFinalizing` is still something that we would had to do). But yes, if that tool is exactly meant for this, maybe why not just use it.
   
   I quickly tested its upgrade script on the pyarrow C++ code, and what it does change is replace a bunch of `.. == Py_None` cases with `Py_IsNone(..)`.
   
   But maybe the more interesting usage of the tool would be that we can use newer C API functions in our code that might make our PyArrow C++ easier to read or maintain? (but again not sure how much of those cases would actually apply here)
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-41475: [Python] Build with py313 [arrow]

Posted by "jorisvandenbossche (via GitHub)" <gi...@apache.org>.
jorisvandenbossche commented on PR #42034:
URL: https://github.com/apache/arrow/pull/42034#issuecomment-2160775358

   (I am also fine with considering https://github.com/python/pythoncapi-compat for a follow-up issue, and at least ensure now pyarrow builds with Python 3.13)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-41475: [Python] Build with py313 [arrow]

Posted by "pitrou (via GitHub)" <gi...@apache.org>.
pitrou commented on PR #42034:
URL: https://github.com/apache/arrow/pull/42034#issuecomment-2158594109

   Instead of doing such adjustements one by one, how about we vendor a version of https://github.com/python/pythoncapi-compat ? cc @jorisvandenbossche 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-41475: [Python] Build with py313 [arrow]

Posted by "pitrou (via GitHub)" <gi...@apache.org>.
pitrou commented on PR #42034:
URL: https://github.com/apache/arrow/pull/42034#issuecomment-2160856438

   > I quickly tested its upgrade script on the pyarrow C++ code, and what it does change is replace a bunch of `.. == Py_None` cases with `Py_IsNone(..)`.
   > 
   > But maybe the more interesting usage of the tool would be that we can use newer C API functions in our code that might make our PyArrow C++ easier to read or maintain? (but again not sure how much of those cases would actually apply here)
   
   Yes, the idea would be to use newer C API functions as in this PR. Vendoring it should be trivial: there is [a single `.h` file](https://github.com/python/pythoncapi-compat/blob/main/pythoncapi_compat.h).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-41475: [PYTHON] build with py313 [arrow]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #42034:
URL: https://github.com/apache/arrow/pull/42034#issuecomment-2155275758

   :warning: GitHub issue #41475 **has been automatically assigned in GitHub** to PR creator.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-41475: [Python] Build with py313 [arrow]

Posted by "kou (via GitHub)" <gi...@apache.org>.
kou commented on code in PR #42034:
URL: https://github.com/apache/arrow/pull/42034#discussion_r1632102656


##########
python/pyarrow/src/arrow/python/udf.cc:
##########
@@ -28,6 +28,11 @@
 #include "arrow/util/checked_cast.h"
 #include "arrow/util/logging.h"
 
+#if PY_VERSION_HEX >= 0x030D00A4
+#define __Py_IsFinalizing Py_IsFinalizing
+#else
+#define __Py_IsFinalizing _Py_IsFinalizing
+#endif

Review Comment:
   How about always using `Py_IsFinalizing` (new API)?
   
   ```suggestion
   #if PY_VERSION_HEX < 0x030D00A4
   #define Py_IsFinalizing() _Py_IsFinalizing()
   #endif
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-41475: [Python] Build with py313 [arrow]

Posted by "jorisvandenbossche (via GitHub)" <gi...@apache.org>.
jorisvandenbossche commented on code in PR #42034:
URL: https://github.com/apache/arrow/pull/42034#discussion_r1634896023


##########
python/pyarrow/src/arrow/python/udf.cc:
##########
@@ -28,6 +28,9 @@
 #include "arrow/util/checked_cast.h"
 #include "arrow/util/logging.h"
 
+#if PY_VERSION_HEX < 0x030D00A4

Review Comment:
   ```suggestion
   // Py_IsFinalizing added in Python 3.13.0a4
   #if PY_VERSION_HEX < 0x030D00A4
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-41475: [Python] Build with py313 [arrow]

Posted by "tacaswell (via GitHub)" <gi...@apache.org>.
tacaswell commented on code in PR #42034:
URL: https://github.com/apache/arrow/pull/42034#discussion_r1633619349


##########
python/pyarrow/src/arrow/python/udf.cc:
##########
@@ -28,6 +28,11 @@
 #include "arrow/util/checked_cast.h"
 #include "arrow/util/logging.h"
 
+#if PY_VERSION_HEX >= 0x030D00A4
+#define __Py_IsFinalizing Py_IsFinalizing
+#else
+#define __Py_IsFinalizing _Py_IsFinalizing
+#endif

Review Comment:
   Fair, I'll merge this, and then amend in the rest of the changes.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org