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 for pypy3.9-v7.3.11 #59

Merged
merged 1 commit into from
Jun 1, 2023
Merged

Conversation

logicsys
Copy link
Contributor

@logicsys logicsys commented May 31, 2023

Python 3.9.16 (feeb267ead3e6771d3f2f49b83e1894839f64fb7, Dec 29 2022, 14:23:21)
PyPy 7.3.11 with GCC 10.2.1 20210130 (Red Hat 10.2.1-11)

Tests run fine on pypy 7.3.11 with those 2 changes

Ran 24 tests in 0.154s

OK

Python 2.7 (release build): 11 C tests succeeded!
Ignore missing Python executable: python3.4
Ignore missing Python executable: python3.5
Ignore missing Python executable: python3.6
Ignore missing Python executable: python3.7
Ignore missing Python executable: python3.8
CPython 3.9 (release build): 11 C tests succeeded!
CPython 3.9 (release build): 11 C++03 tests succeeded!
CPython 3.9 (release build): 11 C++11 tests succeeded!
Ignore missing Python executable: python3.10
Ignore missing Python executable: python3.11
Ignore missing Python executable: python3.12
Ignore missing Python executable: python3-debug
Ignore missing Python executable: pypy
Ignore missing Python executable: pypy2
Ignore missing Python executable: pypy2.7
Ignore missing Python executable: pypy3
Ignore missing Python executable: pypy3.6
Ignore missing Python executable: pypy3.7
Ignore missing Python executable: pypy3.8
Ignore missing Python executable: pypy3.9
PyPy 3.9 (release build): 8 C tests succeeded!
PyPy 3.9 (release build): 8 C++03 tests succeeded!
PyPy 3.9 (release build): 8 C++11 tests succeeded!

Tested: 3 Python executables

@vstinner
Copy link
Member

vstinner commented Jun 1, 2023

Currently, when I run pypy3.9 runtests.py --current locally, it fails with:

building 'test_pythoncapi_compat_cext' extension
creating build
creating build/temp.linux-x86_64-3.9
gcc -pthread -DNDEBUG -O2 -fPIC -I/usr/include/pypy3.9 -c test_pythoncapi_compat_cext.c -o build/temp.linux-x86_64-3.9/test_pythoncapi_compat_cext.o -I/home/vstinner/python/pythoncapi-compat -Werror -Wall -Wextra -Wconversion -Wno-typedef-redefinition -std=c99
In file included from /usr/include/pypy3.9/Python.h:123,
                 from /home/vstinner/python/pythoncapi-compat/pythoncapi_compat.h:21,
                 from test_pythoncapi_compat_cext.c:4:
/usr/include/pypy3.9/pypy_decl.h:648:29: error: static declaration of 'PyPyObject_CallNoArgs' follows non-static declaration
  648 | #define PyObject_CallNoArgs PyPyObject_CallNoArgs
      |                             ^~~~~~~~~~~~~~~~~~~~~
/home/vstinner/python/pythoncapi-compat/pythoncapi_compat.h:395:1: note: in expansion of macro 'PyObject_CallNoArgs'
  395 | PyObject_CallNoArgs(PyObject *func)
      | ^~~~~~~~~~~~~~~~~~~
/usr/include/pypy3.9/pypy_decl.h:648:29: note: previous declaration of 'PyPyObject_CallNoArgs' with type 'struct _object *(struct _object *)'
  648 | #define PyObject_CallNoArgs PyPyObject_CallNoArgs
      |                             ^~~~~~~~~~~~~~~~~~~~~
/usr/include/pypy3.9/pypy_decl.h:649:30: note: in expansion of macro 'PyObject_CallNoArgs'
  649 | PyAPI_FUNC(struct _object *) PyObject_CallNoArgs(struct _object *arg0);
      |                              ^~~~~~~~~~~~~~~~~~~
/usr/include/pypy3.9/pypy_decl.h:652:29: error: static declaration of 'PyPyObject_CallOneArg' follows non-static declaration
  652 | #define PyObject_CallOneArg PyPyObject_CallOneArg
      |                             ^~~~~~~~~~~~~~~~~~~~~
/home/vstinner/python/pythoncapi-compat/pythoncapi_compat.h:406:1: note: in expansion of macro 'PyObject_CallOneArg'
  406 | PyObject_CallOneArg(PyObject *func, PyObject *arg)
      | ^~~~~~~~~~~~~~~~~~~
/usr/include/pypy3.9/pypy_decl.h:652:29: note: previous declaration of 'PyPyObject_CallOneArg' with type 'struct _object *(struct _object *, struct _object *)'
  652 | #define PyObject_CallOneArg PyPyObject_CallOneArg
      |                             ^~~~~~~~~~~~~~~~~~~~~
/usr/include/pypy3.9/pypy_decl.h:653:30: note: in expansion of macro 'PyObject_CallOneArg'
  653 | PyAPI_FUNC(struct _object *) PyObject_CallOneArg(struct _object *arg0, struct _object *arg1);
      |                              ^~~~~~~~~~~~~~~~~~~
cc1: note: unrecognized command-line option '-Wno-typedef-redefinition' may have been intended to silence earlier diagnostics
error: command '/usr/bin/gcc' failed with exit code 1

But 7 months ago, the pypy3.9 job completed successfully: https://github.com/python/pythoncapi-compat/actions/runs/3557936154 on commit 3779f12. Did PyPy 3.9 added PyObject_CallNoArgs() and PyObject_CallOneArg() recently?

@logicsys
Copy link
Contributor Author

logicsys commented Jun 1, 2023

Yeah they were added in 3.9-v7.3.11 and were not present in 3.9-v7.3.10

@logicsys
Copy link
Contributor Author

logicsys commented Jun 1, 2023

Of course if the older pypy versions are failing with this change, we'll need to have it only take effect for pypy3.9-v7.3.11..
Will have a go later today

@logicsys
Copy link
Contributor Author

logicsys commented Jun 1, 2023

Hmm this PR works for me on both 3.9-v7.3.11 & 3.9-v7.3.10..

@vstinner
Copy link
Member

vstinner commented Jun 1, 2023

The 3.12-dev CI was broken, I just fixed it: commit 513acb3. Please rebase your PR on top of it.

@vstinner
Copy link
Member

vstinner commented Jun 1, 2023

Yeah they were added in 3.9-v7.3.11 and were not present in 3.9-v7.3.10

Hum, that's annoying. Since it's implemented as a macro in PyPy, what do you think of checking if the macro is already defined or not, rather than checking for PyPy? #if !defined(PyObject_CallNoArgs) && ... existing check ....

@logicsys
Copy link
Contributor Author

logicsys commented Jun 1, 2023

yeah that sounds like a better approach, will try now

@@ -390,7 +390,7 @@ PyThreadState_LeaveTracing(PyThreadState *tstate)


// bpo-37194 added PyObject_CallNoArgs() to Python 3.9.0a1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you mind to mention the PyPy version which added support for these functions, here and the same comment below?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no problem, I should have known better than to make changes without commenting them ha

pushed it up there

@vstinner
Copy link
Member

vstinner commented Jun 1, 2023

It's kind of sad that PyPy updates requires fixing pythoncapi_compat.h, but so far, I failed to find a "future proof" approach to support PyPy.

@vstinner vstinner merged commit e266312 into python:main Jun 1, 2023
17 of 18 checks passed
@vstinner
Copy link
Member

vstinner commented Jun 1, 2023

I merged your PR, thanks.

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.

None yet

2 participants