|
| 1 | ++++ |
| 2 | +title = "Changes Announced on November 7, 2024" |
| 3 | +linkTitle = "November 7, 2024" |
| 4 | +toc_hide = "true" |
| 5 | +description = "Changes announced for Protocol Buffers on November 7, 2024." |
| 6 | +type = "docs" |
| 7 | ++++ |
| 8 | + |
| 9 | +The following sections cover planned breaking changes in the v30 release, |
| 10 | +expected in 2025 Q1. Also included are some changes that aren't breaking but may |
| 11 | +require action on your part. These are in addition to those mentioned in the |
| 12 | +[News article from October 2](/news/2024-10-02). |
| 13 | + |
| 14 | +These describe changes as we anticipate them being implemented, but due to the |
| 15 | +flexible nature of software some of these changes may not land or may vary from |
| 16 | +how they are described in this topic. |
| 17 | + |
| 18 | +## Introduce ASAN Poisoning After Clearing Oneof Messages on Arena |
| 19 | + |
| 20 | +This change adds a hardening check that affects C++ protobufs using Arenas. |
| 21 | +Oneof messages allocated on the protobuf arena will now be cleared in debug and |
| 22 | +poisoned in ASAN mode. After calling clear, future attempts to use the memory |
| 23 | +region will cause a crash in ASAN as a use-after-free error. |
| 24 | + |
| 25 | +This implementation |
| 26 | +[requires C++17](/news/2024-10-02#drop-cpp-14). |
| 27 | + |
| 28 | +## Python setdefault Behavior Change for Map Fields |
| 29 | + |
| 30 | +Starting in v30, `setdefault` will be similar to `dict` for `ScalarMap`, except |
| 31 | +that both key and value must be set. `setdefault` will be rejected for |
| 32 | +`MessageMaps`. |
| 33 | + |
| 34 | +## Remove Deprecated py_proto_library Macro |
| 35 | + |
| 36 | +The deprecated internal `py_proto_library` Bazel macro in `protobuf.bzl` will be |
| 37 | +removed in v30.x. |
| 38 | + |
| 39 | +This should be replaced by the official `py_proto_library` which will be moved |
| 40 | +to protobuf in `bazel/py_proto_library` as of v29.x. This implementation was |
| 41 | +previously available in `rules_python` prior to v29.x. |
| 42 | + |
| 43 | +## Python Nested Message Class \_\_qualname\_\_ Contains the Outer Message Name |
| 44 | + |
| 45 | +Python nested message class `__qualname__` now contains the outer message name. |
| 46 | +Prior to v30, `__qualname__` has the same result with `__name__` for nested |
| 47 | +message, in that the outer message name was not included. |
| 48 | + |
| 49 | +For example: |
| 50 | + |
| 51 | +```python |
| 52 | +message Foo { |
| 53 | + message Bar { |
| 54 | + bool bool_field = 1; |
| 55 | + } |
| 56 | +} |
| 57 | +nested = test_pb2.Foo.Bar() |
| 58 | +self.assertEqual('Bar', nested.__class__.__name__) |
| 59 | +self.assertEqual('Foo.Bar', nested.__class__.__qualname__) # It was 'Bar' before |
| 60 | +``` |
| 61 | + |
| 62 | +## Dropping our C++ CocoaPods release |
| 63 | + |
| 64 | +In v30, we will be dropping our C++ CocoaPods release, which has been broken |
| 65 | +since v4.x.x. C++ users should use our |
| 66 | +[GitHub release](https://github.com/protocolbuffers/protobuf/releases) directly |
| 67 | +instead. |
| 68 | + |
| 69 | +## Ruby and PHP Errors in JSON Parsing |
| 70 | + |
| 71 | +v30 fixes non-conformance in JSON parsing of strings in numeric fields per the |
| 72 | +[JSON spec](https://protobuf.dev/programming-guides/json/). |
| 73 | + |
| 74 | +This fix will not be accompanied by a major version bump, but Ruby and PHP will |
| 75 | +now raise errors for non-numeric strings (e.g. "", "12abc", "abc") in numeric |
| 76 | +fields. v29.x will include a warning for these error cases. |
0 commit comments