File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed
src/google/protobuf/compiler/python Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -1194,10 +1194,18 @@ void PrintDescriptorOptionsFixingCode(absl::string_view descriptor,
1194
1194
io::Printer* printer) {
1195
1195
// Reset the _options to None thus DescriptorBase.GetOptions() can
1196
1196
// parse _options again after extensions are registered.
1197
+ size_t dot_pos = descriptor.find (' .' );
1198
+ std::string descriptor_name;
1199
+ if (dot_pos == std::string::npos) {
1200
+ descriptor_name = absl::StrCat (" _globals['" , descriptor, " ']" );
1201
+ } else {
1202
+ descriptor_name = absl::StrCat (" _globals['" , descriptor.substr (0 , dot_pos),
1203
+ " ']" , descriptor.substr (dot_pos));
1204
+ }
1197
1205
printer->Print (
1198
- " $descriptor $._options = None\n "
1199
- " $descriptor $._serialized_options = $serialized_value$\n " ,
1200
- " descriptor " , descriptor , " serialized_value" , options);
1206
+ " $descriptor_name $._options = None\n "
1207
+ " $descriptor_name $._serialized_options = $serialized_value$\n " ,
1208
+ " descriptor_name " , descriptor_name , " serialized_value" , options);
1201
1209
}
1202
1210
} // namespace
1203
1211
You can’t perform that action at this time.
0 commit comments