Commit graph

62 commits

Author SHA1 Message Date
Jie Luo
eee53125c4 internal change
PiperOrigin-RevId: 613982814
2024-03-08 10:55:53 -08:00
Jie Luo
4ebba684c7 BREAKING CHANGE in v26: Remove RegisterExtension in message class
PiperOrigin-RevId: 595989309
2024-01-05 07:25:56 -08:00
Jie Luo
0eac77c2c6 Breaking change in 26 release: Remove msg.UnknownFields() support in pure python and cpp extension.
Users should use the add-on unknown_fields.py support.
Old usage example:
unknown_field_set = msg.UnknownFields()

New usage should be:
from google.protobuf import unknown_fields
unknown_field_set = unknown_fields.UnknownFieldSet(msg)
PiperOrigin-RevId: 589969095
2023-12-11 15:25:41 -08:00
Sandy Zhang
81068e8e8c Internal change
PiperOrigin-RevId: 566426899
2023-09-18 15:17:56 -07:00
Joshua Haberman
9ef8f5cffc Shorten our license headers into an abbreviated form that references LICENSE instead of including it in full.
PiperOrigin-RevId: 563897888
2023-09-08 18:50:27 -07:00
Jie Luo
3e966f1dc9 Add lock to pure python's field decoders
Fix data race that may increase flake rate of some tests.

PiperOrigin-RevId: 562044867
2023-09-01 14:15:10 -07:00
Protobuf Team Bot
12d4f418a7 Comparing a proto message with an object of unknown returns NotImplemented
The Python comparison protocol requires that if an object doesn't know how to
compare itself to an object of a different type, it returns NotImplemented
rather than False. The interpreter will then try performing the comparison using
the other operand. This translates, for protos, to:
If a proto message doesn't know how to compare itself to an object of
non-message type, it returns NotImplemented. This way, the interpreter will then
try performing the comparison using the comparison methods of the other object,
which may know how to compare itself to a message. If not, then Python will
return the combined result (e.g., if both objects don't know how to perform
__eq__, then the equality operator `==` return false).
This change allows one to compare a proto with custom matchers such as mock.ANY
that the message doesn't know how to compare to, regardless of whether
mock.ANY is on the right-hand side or left-hand side of the equality (prior to
this change, it only worked with mock.ANY on the left-hand side).

Fixes https://github.com/protocolbuffers/protobuf/issues/9173

PiperOrigin-RevId: 561728156
2023-08-31 12:32:18 -07:00
Jie Luo
abf5dfbfbc Fix a bug that strips options from descriptor.proto in Pure Python.
GetOptions on fields (which parse the _serialized_options) will be called for the first time of parse or serialize instead of Build time.

Note: GetOptions on messages are still called in Build time because of message_set_wire_format. If message options are needed in descriptor.proto, a parse error will be raised in GetOptions(). We can check the file to not invoke GetOptions() for descriptor.proto as long as message_set_wire_format not needed in descriptor.proto.

Other options except message options do not invoke GetOptions() in Build time

PiperOrigin-RevId: 560741182
2023-08-28 10:00:45 -07:00
Jie Luo
161989080b Fix wrong warning message info
PiperOrigin-RevId: 554629697
2023-08-07 16:43:40 -07:00
Protobuf Team Bot
0cf1ea48d4 Fix typo in warning about the deprecated use of message.UnknownFields().
The message.UnknownFields() support will be removed soon.

PiperOrigin-RevId: 554598474
2023-08-07 14:46:22 -07:00
Jie Luo
c988759a9b Raise warings for message.UnknownFields() usages and navigate to the new add
one API

The message.UnknownFields() support will be removed soon

PiperOrigin-RevId: 553871453
2023-08-04 11:59:29 -07:00
Jie Luo
862a2281ce Remove AddHelpersToExtenions() in generated code
PiperOrigin-RevId: 536439101
2023-05-30 10:20:55 -07:00
Jie Luo
86fc32cedc Removed message._extensions_by_number
PiperOrigin-RevId: 534514738
2023-05-23 12:21:02 -07:00
Jie Luo
e737c8108a Removed message._extensions_by_name
PiperOrigin-RevId: 533501166
2023-05-19 11:10:25 -07:00
Jie Luo
f75fd051d6 Change extension_handle to field_descriptor in python HasExtension() and ClearExtension()
PiperOrigin-RevId: 499349711
2023-01-03 17:07:15 -08:00
Jie Luo
3d3bebf8ab Internal change only
PiperOrigin-RevId: 491993057
2022-11-30 12:50:31 -08:00
Jie Luo
da9de8d4d4 Added is_closed to EnumDescriptor in protobuf python
PiperOrigin-RevId: 486274963
2022-11-04 18:34:08 -07:00
Jie Luo
9b725fb9a3 use FieldDescriptor.has_presence instead of file.syntax in python_message.py
PiperOrigin-RevId: 486254134
2022-11-04 16:17:40 -07:00
Jie Luo
5fc9c37208 Internal change
PiperOrigin-RevId: 485680539
2022-11-02 13:32:35 -07:00
Mike Kruskal
a29e0e3f44 Sync from Piper @439400376
PROTOBUF_SYNC_PIPER
2022-04-04 13:42:37 -07:00
Joshua Haberman
e5c570bb57 Sync from Piper @395706834
PROTOBUF_SYNC_PIPER
2021-09-09 08:21:42 -07:00
Alexander Shadchin
87dd07b436
Switch on "new" buffer API (#8339)
"Old" buffer API will removed in Python 3.10. This is also fix #7930.
2021-03-04 11:00:41 -08:00
Joshua Haberman
f77065d4eb Sync from Piper @316511779
PROTOBUF_SYNC_PIPER
2020-06-15 11:48:47 -07:00
Joshua Haberman
b7742c51fd Sync from Piper @305505267
PROTOBUF_SYNC_PIPER
2020-04-08 10:30:17 -07:00
Joshua Haberman
c649397029
Set execute bit on files if and only if they begin with (#!). (#7347)
* Set execute bit on files if and only if they begin with (#!).

Git only tracks the 'x' (executable) bit on each file. Prior to this
CL, our files were a random mix of executable and non-executable.
This change imposes some order by making files executable if and only
if they have shebang (#!) lines at the beginning.

We don't have any executable binaries checked into the repo, so
we shouldn't need to worry about that case.

* Added fix_permissions.sh script to set +x iff a file begins with (#!).
2020-04-01 15:28:25 -07:00
Joshua Haberman
b99994d994 Sync from Piper @304070343
PROTOBUF_SYNC_PIPER
2020-03-31 16:25:37 -07:00
Rafi Kamal
6c92f9dff1 Down integrate to GitHub 2019-10-11 12:05:46 -07:00
Paul Yang
763c358874
Down Integrate Internal Changes (#6634)
* Down integrate to GitHub

* Remove unintentional double assign

* Change ByteCountInt64 to int64_t

* Revert changes in binary_conformance_test.cc

* Revert unnecessary changes
2019-09-12 11:03:27 -07:00
Rafi Kamal
4f02f056b5 Down integrate to GitHub 2019-08-22 17:33:01 -07:00
Paul Yang
7bff8393ca
Down Integrate to GitHub (#6414)
* Down integrate to GitHub

* Fix broken tests
2019-07-19 14:49:01 -07:00
Hao Nguyen
66540237ca Down integrate to GitHub 2019-05-17 12:01:17 -07:00
Yilun Chong
d8c2501b43 down integration from internal 2019-02-22 18:13:33 +08:00
Bo Yang
624a40a387 Down-integrate internal changes to github. 2018-12-20 14:21:20 -08:00
Adam Cozzette
0894e07536 Integrated internal changes from Google 2018-11-09 11:28:22 -08:00
Josh Haberman
d61aede89c Down-integrate from google3. 2018-09-04 10:58:54 -07:00
Feng Xiao
6bbe197e9c Down-integrate from google3. 2018-08-08 17:00:41 -07:00
Adam Cozzette
13fd045dbb Integrated internal changes from Google 2017-09-14 10:03:57 -07:00
Jisi Liu
09354db143 Merge from Google internal for 3.4 release 2017-07-18 15:38:30 -07:00
Feng Xiao
d36c0c538a Down-integrate from google3. 2017-03-29 14:33:05 -07:00
Paul Yang
7f3e237071 Merge 3.2.x branch into master (#2648)
* Down-integrate internal changes to github.

* Update conformance test failure list.

* Explicitly import used class in nano test to avoid random test fail.

* Update _GNUC_VER to use the correct implementation of atomic operation
on Mac.

* maps_test.js: check whether Symbol is defined before using it (#2524)

Symbol is not yet available on older versions of Node.js and so this
test fails with them. This change just directly checks whether Symbol is
available before we try to use it.

* Added well_known_types_embed.cc to CLEANFILES so that it gets cleaned up

* Updated Makefile.am to fix out-of-tree builds

* Added Bazel genrule for generating well_known_types_embed.cc

In pull request #2517 I made this change for the CMake and autotools
builds but forgot to do it for the Bazel build.

* Update _GNUC_VER to use the correct implementation of atomic operation on Mac.

* Add new js file in extra dist.

* Bump version number to 3.2.0

* Fixed issue with autoloading - Invalid paths (#2538)

* PHP fix int64 decoding (#2516)

* fix int64 decoding

* fix int64 decoding + tests

* Fix int64 decoding on 32-bit machines.

* Fix warning in compiler/js/embed.cc

embed.cc: In function ‘std::string CEscape(const string&)’:
embed.cc:51:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int i = 0; i < str.size(); ++i) {
                                ^

* Fix include in auto-generated well_known_types_embed.cc

Restore include style fix (e3da722) that has been trampled by
auto-generation of well_known_types_embed.cc

* Fixed cross compilations with the Autotools build

Pull request #2517 caused cross compilations to start failing, because
the js_embed binary was being built to run on the target platform
instead of on the build machine. This change updates the Autotools build
to use the AX_PROG_CXX_FOR_BUILD macro to find a suitable compiler for
the build machine and always use that when building js_embed.

* Minor fix for autocreated object repeated fields and maps.

- If setting/clearing a repeated field/map that was objects, check the class
  before checking the autocreator.
- Just to be paranoid, don’t mutate within copy/mutableCopy for the autocreated
  classes to ensure there is less chance of issues if someone does something
  really crazy threading wise.
- Some more tests for the internal AutocreatedArray/AutocreatedDictionary
  classes to ensure things are working as expected.
- Add Xcode 8.2 to the full_mac_build.sh supported list.

* Fix generation of extending nested messages in JavaScript (#2439)

* Fix generation of extending nested messages in JavaScript

* Added missing test8.proto to build

* Fix generated code when there is no namespace but there is enum definition.

* Decoding unknown field should succeed.

* Add embed.cc in src/Makefile.am to fix dist check.

* Fixed "make distcheck" for the Autotools build

To make the test pass I needed to fix out-of-tree builds and update
EXTRA_DIST and CLEANFILES.

* Remove redundent embed.cc from src/Makefile.am

* Update version number to 3.2.0-rc.1 (#2578)

* Change protoc-artifacts version to 3.2.0-rc.1

* Update version number to 3.2.0rc2

* Update change logs for 3.2.0 release.

* Update php README

* Update upb, fixes some bugs (including a hash table problem). (#2611)

* Update upb, fixes some bugs (including a hash table problem).

* Ruby: added a test for the previous hash table corruption.

Verified that this triggers the bug in the currently released
version.

* Ruby: bugfix for SEGV.

* Ruby: removed old code for dup'ing defs.

* Reverting deployment target to 7.0 (#2618)

The Protobuf library doesn’t require the 7.1 deployment target so
reverting it back to 7.0

* Fix typo that breaks builds on big-endian (#2632)

* Bump version number to 3.2.0
2017-01-31 09:17:32 -08:00
Adam Cozzette
5a76e633ea Integrated internal changes from Google 2016-11-17 16:59:59 -08:00
Bo Yang
1c4cf0eeb5 Fix python cpp. 2016-10-10 11:44:21 -07:00
Bo Yang
cc8ca5b6a5 Integrate internal changes 2016-10-10 11:23:36 -07:00
Feng Xiao
9086d96439 Integrate from internal code base. 2016-07-13 13:48:40 -07:00
Jisi Liu
cf14183bcd Down integrate from Google internal. 2016-04-28 14:34:59 -07:00
Feng Xiao
e841bac4fc Down-integrate from internal code base. 2015-12-11 17:10:28 -08:00
Jisi Liu
46e8ff63cb Down-integrate from google internal. 2015-10-05 11:59:43 -07:00
Feng Xiao
b192ba87f7 Merge remote-tracking branch 'origin/master' into beta-1 2015-08-25 20:24:43 -07:00
Feng Xiao
eee38b0c01 Down-integrate from google3. 2015-08-22 18:25:48 -07:00
Dan O'Reilly
833c046fb7 Fixing some tests
Signed-off-by: Dan O'Reilly <oreilldf@gmail.com>
2015-08-13 01:17:26 -04:00