Currently, if you access a ListValue from a Struct and attempted to
assign it to another Struct, you would get an exception:
> s1 = spb.Struct()
> s1['a'] = [1]
> s2 = spb.Struct()
> s2['a'] = s1['a']
ValueError: Unexpected type
This fixes that case.
* Fix construction of messages using the C++ Python implementation when a map field is passed from one message to another.
* Add a test on message map field construction
* python 3 support
* review comments
* add test
* Collapse code into one
* Add several fixes for python toolchain
* Fix versin regex
* Make script exit on error
* Fix version regex
* Fix version regex
* Fix version regex
* Fix version regex
* Make test run on the current commit
* Fix test
* Fix test
* Use git to retrieve current commit
* Fix tests
* Fix tests
* Also make linux and mac work on the current commit
* Fix test
* Down-integrate internal changes to github.
* fix python conformance test
* fix csharp conformance test
* add back java map_lite_test.proto's optimize for option
* fix php conformance test
* Rebuild python docker image
* Update docker image
* Change call to build_and_run_docker.sh
* Set up python tests for different versions
* Fix comments
* Add kokoro build for python source package
* Use libc++ for xcode 10 (#5303)
The xcode 10 removes the deprecated libstdc++ library. We could set
"MACOSX_DEPLOYMENT_TARGET" to "10.9" to use libc++ instead.
* Add python 3.7 build
* Add build for python 3.7 on linux and windows
* Remove unused source build
* Add comment
* Fix $MACOSX_DEPLOYMENT_TARGET mismatch
* Fix MACOSX_DEPLOYMENT_TARGET mismatch
* Add missing import for sysconfig
* Add missing imports
* 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.