aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/google/protobuf/compiler/python
diff options
context:
space:
mode:
authorGravatar Jie Luo <anandolee@gmail.com>2017-04-10 16:37:57 -0700
committerGravatar Feng Xiao <xfxyjwf@gmail.com>2017-04-10 16:37:57 -0700
commit899460c9cb328e51b5da0ffe5d73e03c8f00dd15 (patch)
tree882fc6e219956b77f3f30c8560b10c017fa7f61f /src/google/protobuf/compiler/python
parente91caa1f197ec1bd48a713c435c47e6f3948a1fb (diff)
cherrypick descriptor_pool.FindFileContainingSymbol by extensions (#2962)
* Use PyUnicode_AsEncodedString() instead of PyUnicode_AsEncodedObject() * Cherrypick the fix descriptor_pool.FindFileContainingSymbol by extensions.
Diffstat (limited to 'src/google/protobuf/compiler/python')
-rw-r--r--src/google/protobuf/compiler/python/python_generator.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/google/protobuf/compiler/python/python_generator.cc b/src/google/protobuf/compiler/python/python_generator.cc
index f83f155a..21a7e158 100644
--- a/src/google/protobuf/compiler/python/python_generator.cc
+++ b/src/google/protobuf/compiler/python/python_generator.cc
@@ -445,8 +445,6 @@ void Generator::PrintFileDescriptor() const {
printer_->Outdent();
printer_->Print(")\n");
- printer_->Print("_sym_db.RegisterFileDescriptor($name$)\n", "name",
- kDescriptorKey);
printer_->Print("\n");
}
@@ -999,6 +997,10 @@ void Generator::FixForeignFieldsInDescriptors() const {
for (int i = 0; i < file_->extension_count(); ++i) {
AddExtensionToFileDescriptor(*file_->extension(i));
}
+ // TODO(jieluo): Move this register to PrintFileDescriptor() when
+ // FieldDescriptor.file is added in generated file.
+ printer_->Print("_sym_db.RegisterFileDescriptor($name$)\n", "name",
+ kDescriptorKey);
printer_->Print("\n");
}