* Replace assert_true/assert_false with assert, because they are not provided in newer version of test/unit
* Use rescue to handle exception subclass
* Commented out the require that caused gc_test failure.
* Commented out test
* Fix typo
* Add support for primitive types in setters
* Update to address PR feedback
* Add tests and fixes for repeated fields
* Remove repeated field code, add getters
* Cleanup, test getters and oneofs
* Move boxing logic into separate class
* Add tests for wrapper type constructor args
* Update to add new setXXXValue methods
* Fix tests for invalid values
* Fix c extension for wrapper accessors
* Fix the bug that well known types didn't call Message_construct
* Address PR comments
* Refactoring init message with array logic
* Add include path to protoc
* Add missing TSRM_LS defintion
* Fix TSRM_LS
* Fix dist check
* Fix parsing empty Struct Values from Json
This fixes a bug. When parsing a struct from JSON like
struct = json_format.Parse('{"k": {}}', Struct())
then the struct's "k" value would end up not initialized, and accessing
the value would raise an error.
In[1]: struct['k']
ValueError: Value not set
That seems to be because the Struct field of the Value was not set.
In[2]: struct
Out[2]:
fields {
key: "k"
value {
}
}
This commit makes sure that the Value's Struct field is initialized even
if the Struct has no values itself.
This commit also extends a test to cover this case.
* Additionally test for empty list
* ParseFromString returns bytes parsed
ParseFromString is documented as returning the number of bytes parsed,
and the C++ implementation does this, so the Python implementation
should too.
See #5165.
* Fix docstring
* Add a test for ParseFromString length behavior
Many classes within collections were moved to collections.abc in Python
3.3 -- their usage as imported directly from collections is now
deprecated as of Python 3.7 and will be removed soon.
The fallback import added in this PR can be removed entirely when
support for versions of Python prior to 3.3 is dropped.
This reverts commit 93f6b67eb2.
Protoc adds already the relative path to the output directory.
Therefore, we have to remove this again from the output directory
to prevent adding it twice.
This change only adds basic proto2 support without advanced features
like extensions, custom options, maps, etc.
The protoc binary now generates ruby code for proto2 syntax.
However, for now, it is restricted to proto2 files without advanced features
like extensions, in which case it still errors out.
This change also modifies the DSL to add proto messages to the DescriptorPool.
There is a new DSL Builder#add_file to create a new FileDescriptor. With this,
the generated ruby DSL looks something like:
Google::Protobuf::DescriptorPool.generated_pool.build do
add_file "test.proto" do
add_message "foo" do
optional :val, :int32, 1
end
end
end
* Adopt upb change for timestamp and duration json to php
* Remove unused code
* Re-sync upb
* Fix php implementation timestamp json parsing
* Fix strptime use local timezone on mac.
* Remove succeeding tests
* Resync
* Add tests for values
* Fix php tests
* Fix encoder handlers change default value
Previously, oneofsubmsg_handler and submsg_handler change zval's default value directly.
The fix use REPLACE_ZVAL_VALUE which create a copy of parsed value and assign it to zval.
This is primarily for access to comments, which would be expected to be available in a protoc plugin.
The implementation has two fiddly aspects:
- We use a Lazy<T> to avoid building the map before cross-linking. An alternative would be to crosslink at the end of the constructor, and remove the calls to CrossLink elsewhere. This would be generally better IMO, but deviate from the Java code.
- The casts to IReadOnlyList<DescriptorBase> are unfortunate. They'll always work, because these lists are always ReadOnlyCollection<T> for a descriptor type... but we can't use IList<DescriptorBase> as that's not covariant, and it's annoyingly fiddly to change the field to be of type ReadOnlyCollection<T>.