aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/compiler/python_generator.cc
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2017-04-18 13:39:18 -0700
committerGravatar Craig Tiller <ctiller@google.com>2017-04-18 13:39:18 -0700
commitcac4e178fda78564934c21ec2e77b5763dc3111a (patch)
tree175197d7ffac02cdc936e3844ace737103b6e928 /src/compiler/python_generator.cc
parent8b24229b7ca6b30b6c3eae64e20551386abc6ecb (diff)
parentc2d9f1e297b7a504412be85ec9840e59bfdb794e (diff)
Merge github.com:grpc/grpc into cpparena
Diffstat (limited to 'src/compiler/python_generator.cc')
-rw-r--r--src/compiler/python_generator.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/compiler/python_generator.cc b/src/compiler/python_generator.cc
index 2649c1688d..50ee54abff 100644
--- a/src/compiler/python_generator.cc
+++ b/src/compiler/python_generator.cc
@@ -101,6 +101,14 @@ PrivateGenerator::PrivateGenerator(const GeneratorConfiguration& config,
void PrivateGenerator::PrintAllComments(StringVector comments,
grpc_generator::Printer* out) {
if (comments.empty()) {
+ // Python requires code structures like class and def to have
+ // a body, even if it is just "pass" or a docstring. We need
+ // to ensure not to generate empty bodies. We could do something
+ // smarter and more sophisticated, but at the moment, if there is
+ // no docstring to print, we simply emit "pass" to ensure validity
+ // of the generated code.
+ out->Print("# missing associated documentation comment in .proto file\n");
+ out->Print("pass\n");
return;
}
out->Print("\"\"\"");