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

Switch on "new" buffer API #8339

Merged
merged 4 commits into from Mar 4, 2021
Merged

Conversation

shadchin
Copy link
Contributor

"Old" buffer API will removed in Python 3.10. This is also fix #7930.

@google-cla
Copy link

google-cla bot commented Feb 24, 2021

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@google-cla google-cla bot added the cla: no label Feb 24, 2021
@google-cla google-cla bot added cla: yes and removed cla: no labels Feb 24, 2021
@shadchin shadchin changed the title Switch on "new" buffer API. Switch on "new" buffer API Feb 25, 2021
@shadchin
Copy link
Contributor Author

shadchin commented Mar 2, 2021

Can anyone watch this PR?

"Old" buffer API will removed in Python 3.10. This is also fix protocolbuffers#7930.
@shadchin
Copy link
Contributor Author

shadchin commented Mar 2, 2021

I fixed warning with deprecation PyEval_CallObject for Python 3.9

@acozzette Can you rerun tests, please?

@shadchin
Copy link
Contributor Author

shadchin commented Mar 2, 2021

Free bonus from switching on "new" buffer API:

  • add support memoryview for Python 2.7

@acozzette It looks like another restart is needed :)

@shadchin
Copy link
Contributor Author

shadchin commented Mar 3, 2021

@acozzette, I don't have access for Kokoro build failed.

Could you, please, help me to understand failure reasons?

@acozzette
Copy link
Member

Here is the error message and the last few log lines before it:

py27-cpp run-test: commands[1] | python setup.py -q build --cpp_implementation --warnings_as_errors --compile_static_extension
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
In file included from /tmp/protobuf/protobuf/python/.tox/py27-cpp/include/python2.7/Python.h:8,
                 from google/protobuf/pyext/descriptor_pool.cc:35:
/tmp/protobuf/protobuf/python/.tox/py27-cpp/include/python2.7/pyconfig.h:1223: error: "_POSIX_C_SOURCE" redefined [-Werror]
 #define _POSIX_C_SOURCE 200112L

In file included from /usr/include/x86_64-linux-gnu/c++/8/bits/os_defines.h:39,
                 from /usr/include/x86_64-linux-gnu/c++/8/bits/c++config.h:508,
                 from /usr/include/c++/8/type_traits:38,
                 from /usr/include/c++/8/unordered_map:38,
                 from google/protobuf/pyext/descriptor_pool.cc:33:
/usr/include/features.h:265: note: this is the location of the previous definition
 # define _POSIX_C_SOURCE 200809L

In file included from /tmp/protobuf/protobuf/python/.tox/py27-cpp/include/python2.7/Python.h:8,
                 from google/protobuf/pyext/descriptor_pool.cc:35:
/tmp/protobuf/protobuf/python/.tox/py27-cpp/include/python2.7/pyconfig.h:1245: error: "_XOPEN_SOURCE" redefined [-Werror]
 #define _XOPEN_SOURCE 600

In file included from /usr/include/x86_64-linux-gnu/c++/8/bits/os_defines.h:39,
                 from /usr/include/x86_64-linux-gnu/c++/8/bits/c++config.h:508,
                 from /usr/include/c++/8/type_traits:38,
                 from /usr/include/c++/8/unordered_map:38,
                 from google/protobuf/pyext/descriptor_pool.cc:33:
/usr/include/features.h:202: note: this is the location of the previous definition
 # define _XOPEN_SOURCE 700

cc1plus: all warnings being treated as errors
error: command 'gcc' failed with exit status 1
ERROR: InvocationError for command /tmp/protobuf/protobuf/python/.tox/py27-cpp/bin/python setup.py -q build --cpp_implementation --warnings_as_errors --compile_static_extension (exited with code 1)

@shadchin
Copy link
Contributor Author

shadchin commented Mar 4, 2021

These errors are not related to the change in this PR. It looks like something has changed in the build since October 1, 2020 #7927

I removed --warnings_as_errors for Python 2.7

@acozzette Can you rerun tests, please?

@dlj-NaN dlj-NaN merged commit 87dd07b into protocolbuffers:master Mar 4, 2021
@shadchin shadchin deleted the fix_python_3_10 branch March 5, 2021 03:39
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.

Compiler warnings when building for Python 3.7 and 3.8
4 participants