pybind / pybind11_protobuf

Pybind11 bindings for Google's Protocol Buffers
Other
56 stars 34 forks source link

Python 3.11 and PyFrameObject #99

Open blais opened 1 year ago

blais commented 1 year ago

Has pybind11_protobuf been tested with Python 3.11 and forward? I believe PyFrameObject has been removed from the public API and curious to know someone has tested it working with this version or later.

rwgk commented 1 year ago

Has pybind11_protobuf been tested with Python 3.11 and forward?

Not to my knowledge, but pybind11 GitHub Actions testing includes routine testing with Python 3.11. I've also tested with Python 3.12 (last I tried the Python tests (i.e. extending) worked, embedding had one failure).

PyFrameObject

Where does that come in for pybind11_protobuf? Searching for "frame" (case-insensitive) under pybind11_protobuf doesn't have any matches.

blais commented 1 year ago

I just delved deeper and noticed you've gated usage of (deprecated) pyext to a flag. Thanks for doing that (keeping it alive but conditional is the right choice IMHO, offers transition).

I'm getting the following errors with 3.12.0a2. errors_3.12.log

And while I'm at it, I tried compiling with a recent pb version (21.12), I'm getting this: errors_3.12_pb21.12.log

rwgk commented 1 year ago

Looks like the protobuf library isn't Python 3.12 compatible.

protobuf/internal/python_message.py", line 623, in __init__
    property.__init__(self, getter, setter, doc=doc)
AttributeError: '_FieldProperty' object attribute '__doc__' is read-only

It's really very early to even try.

blais commented 1 year ago

Never mind; I've managed to fix my install of 3.11.1 and was able to successfully update to protobuf 21.12 and run your unit tests unch'ed. This is good enough. The bug looks like something they'll have to fix in Python 3.12 itself.

blais commented 1 year ago

Actually no.... the problem occurs when I enable fast cpp protos with:

bazel test --define=use_fast_cpp_protos=true  //...

The problem is that it attempts to build com_google_protobuf/python/google/protobuf/pyext. For my use case I really need to share the protos between C++ and Python (I'll have a lot of cross-language passing around of protos).

For reference, see https://github.com/protocolbuffers/protobuf/issues/11031

rwgk commented 1 year ago

@laramiel JIC you have suggestions.

From my end: If you send a PR with the changes you need, I'll apply it internally (manually), which will then automatically get exported back here. — Currently we're not set up for automatically processing PRs.