Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

type mismatch of default value for python #407

Closed
sumtiogo opened this issue May 20, 2015 · 1 comment
Closed

type mismatch of default value for python #407

sumtiogo opened this issue May 20, 2015 · 1 comment

Comments

@sumtiogo
Copy link

  • proto version: test on both libprotoc 2.5.0 and 2.6.1
  • python protobuf version: test on both 2.5.0 and 2.6.1
# file p.proto
message M {
    optional double d1 = 1 [default = 0.0];
    optional double d2 = 2 [default = 1.0];
    optional double d3 = 3 [default = 1.1];
}
>>> import p_pb2
>>> m = p_pb2.M()
>>> type(m.d1)
<type 'int'>
>>> type(m.d2)
<type 'int'>
>>> type(m.d3)
<type 'float'>

I thought the behavior is confusing. Is it possible to make the type of default value consistent with the type defined in proto file?

@acozzette acozzette self-assigned this Mar 7, 2017
@xfxyjwf xfxyjwf added this to Backlog in Fixit Q4`17 (P2 Bugs) via automation Dec 11, 2017
@xfxyjwf xfxyjwf assigned anandolee and unassigned acozzette Dec 11, 2017
@anandolee
Copy link
Contributor

It has been changed to always return a float value for the default

Fixit Q4`17 (P2 Bugs) automation moved this from Backlog to Done Jan 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

No branches or pull requests

4 participants