8000 Pure-Python extension does not work with Python 3.12 · Issue #12187 · protocolbuffers/protobuf · GitHub
[go: up one dir, main page]

Skip to content
Pure-Python extension does not work with Python 3.12 #12187
@musicinmybrain

Description

@musicinmybrain

What version of protobuf and what language are you using?

Version: 3.19.6

The line that sets the docstring is present in the current release (22.1) and main, so I suspect that they will also be affected:

setattr(cls, property_name, _FieldProperty(field, getter, setter, doc=doc))

Language: Python

What operating system (Linux, Windows, ...) and version?

Fedora Linux Rawhide/39, plus experimental Python 3.12: https://copr.fedorainfracloud.org/coprs/g/python/python3.12/

What runtime / compiler are you using (e.g., python version or gcc version)

Python 3.12.0a5, GCC 13.0.1

What did you do?
Steps to reproduce the behavior:

  1. Build the pure-Python version of the Python protobuf extension.
  2. from google.protobuf import descriptor_pb2

This import occurred in the generated proto bindings in googleapis-common-protos; see downstream bug https://bugzilla.redhat.com/show_bug.cgi?id=2176158.

What did you expect to see

Successful import with no output.

What did you see instead?

[…]
  File "/usr/lib/python3.12/site-packages/google/protobuf/descriptor_pool.py", line 216, in AddSerializedFile
    from google.protobuf import descriptor_pb2  
  File "/usr/lib/python3.12/site-packages/google/protobuf/descriptor_pb2.py", line 1883, in <module>
    FileDescriptorSet = _reflection.GeneratedProtocolMessageType('FileDescriptorSet', (_message.Message,), {
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/google/protobuf/internal/python_message.py", line 198, in __init__
    _AddPropertiesForFields(descriptor, cls)
  File "/usr/lib/python3.12/site-packages/google/protobuf/internal/python_message.py", line 586, in _AddPropertiesForFields
    _AddPropertiesForField(field, cls)
  File "/usr/lib/python3.12/site-packages/google/protobuf/internal/python_message.py", line 612, in _AddPropertiesForField
    _AddPropertiesForRepeatedField(field, cls)  
  File "/usr/lib/python3.12/site-packages/google/protobuf/internal/python_message.py", line 668, in _AddPropertiesForRepeatedField
    setattr(cls, property_name, _FieldProperty(field, getter, setter, doc=doc))
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/google/protobuf/internal/python_message.py", line 623, in __init__
    property.__init__(self, getter, setter, doc=doc)
AttributeError: '_FieldProperty' object attribute '__doc__' is read-only

Anything else we should know about your project / environment

See also: #12186

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0