Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
322d8939
Commit
322d8939
authored
Aug 12, 2015
by
Tamir Duberstein
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove Python 2.5 cruft
parent
3ff56252
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
18 deletions
+8
-18
descriptor_pool.py
python/google/protobuf/descriptor_pool.py
+2
-4
python_generator.cc
src/google/protobuf/compiler/python/python_generator.cc
+6
-14
No files found.
python/google/protobuf/descriptor_pool.py
View file @
322d8939
...
...
@@ -192,8 +192,7 @@ class DescriptorPool(object):
try
:
file_proto
=
self
.
_internal_db
.
FindFileByName
(
file_name
)
except
KeyError
:
_
,
error
,
_
=
sys
.
exc_info
()
#PY25 compatible for GAE.
except
KeyError
as
error
:
if
self
.
_descriptor_db
:
file_proto
=
self
.
_descriptor_db
.
FindFileByName
(
file_name
)
else
:
...
...
@@ -228,8 +227,7 @@ class DescriptorPool(object):
try
:
file_proto
=
self
.
_internal_db
.
FindFileContainingSymbol
(
symbol
)
except
KeyError
:
_
,
error
,
_
=
sys
.
exc_info
()
#PY25 compatible for GAE.
except
KeyError
as
error
:
if
self
.
_descriptor_db
:
file_proto
=
self
.
_descriptor_db
.
FindFileContainingSymbol
(
symbol
)
else
:
...
...
src/google/protobuf/compiler/python/python_generator.cc
View file @
322d8939
...
...
@@ -28,7 +28,6 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//#PY25 compatible generated code for GAE.
// Copyright 2007 Google Inc. All Rights Reserved.
// Author: robinson@google.com (Will Robinson)
//
...
...
@@ -166,7 +165,6 @@ void PrintTopBoilerplate(
printer
->
Print
(
"# Generated by the protocol buffer compiler. DO NOT EDIT!
\n
"
"# source: $filename$
\n
"
"
\n
import sys
\n
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))"
//##PY25
"
\n
"
,
"filename"
,
file
->
name
());
if
(
HasTopLevelEnums
(
file
))
{
...
...
@@ -258,12 +256,9 @@ string StringifyDefaultValue(const FieldDescriptor& field) {
case
FieldDescriptor
:
:
CPPTYPE_ENUM
:
return
SimpleItoa
(
field
.
default_value_enum
()
->
number
());
case
FieldDescriptor
:
:
CPPTYPE_STRING
:
//##!PY25 return "b\"" + CEscape(field.default_value_string()) +
//##!PY25 (field.type() != FieldDescriptor::TYPE_STRING ? "\"" :
//##!PY25 "\".decode('utf-8')");
return
"_b(
\"
"
+
CEscape
(
field
.
default_value_string
())
+
//##PY25
(
field
.
type
()
!=
FieldDescriptor
::
TYPE_STRING
?
"
\"
)"
:
//##PY25
"
\"
).decode('utf-8')"
);
//##PY25
return
"b
\"
"
+
CEscape
(
field
.
default_value_string
())
+
(
field
.
type
()
!=
FieldDescriptor
::
TYPE_STRING
?
"
\"
"
:
"
\"
.decode('utf-8')"
);
case
FieldDescriptor
:
:
CPPTYPE_MESSAGE
:
return
"None"
;
}
...
...
@@ -389,8 +384,7 @@ void Generator::PrintFileDescriptor() const {
printer_
->
Print
(
m
,
file_descriptor_template
);
printer_
->
Indent
();
printer_
->
Print
(
//##!PY25 "serialized_pb=b'$value$'\n",
"serialized_pb=_b('$value$')
\n
"
,
//##PY25
"serialized_pb=b'$value$'
\n
"
,
"value"
,
strings
::
CHexEscape
(
file_descriptor_serialized_
));
if
(
file_
->
dependency_count
()
!=
0
)
{
printer_
->
Print
(
",
\n
dependencies=["
);
...
...
@@ -1034,10 +1028,8 @@ string Generator::OptionsValue(
return
"None"
;
}
else
{
string
full_class_name
=
"descriptor_pb2."
+
class_name
;
//##!PY25 return "_descriptor._ParseOptions(" + full_class_name + "(), b'"
//##!PY25 + CEscape(serialized_options)+ "')";
return
"_descriptor._ParseOptions("
+
full_class_name
+
"(), _b('"
//##PY25
+
CEscape
(
serialized_options
)
+
"'))"
;
//##PY25
return
"_descriptor._ParseOptions("
+
full_class_name
+
"(), b'"
+
CEscape
(
serialized_options
)
+
"')"
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment