parent
f75d707ae9
commit
22c7daf1e3
10 changed files with 5 additions and 185 deletions
@ -1,89 +0,0 @@ |
||||
--- BUILD
|
||||
+++ BUILD
|
||||
@@ -525,7 +525,7 @@ cc_binary(
|
||||
filegroup(
|
||||
name = "testdata",
|
||||
srcs = glob(["src/google/protobuf/testdata/**/*"]),
|
||||
- visibility = ["//:__subpackages__"],
|
||||
+ visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
RELATIVE_LITE_TEST_PROTOS = [
|
||||
@@ -931,13 +931,10 @@ py_library(
|
||||
[
|
||||
"python/google/protobuf/**/*.py",
|
||||
],
|
||||
- exclude = [
|
||||
- "python/google/protobuf/internal/*_test.py",
|
||||
- "python/google/protobuf/internal/test_util.py",
|
||||
- ],
|
||||
),
|
||||
imports = ["python"],
|
||||
srcs_version = "PY2AND3",
|
||||
+ visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
cc_binary(
|
||||
@@ -1038,13 +1035,6 @@ py_proto_library(
|
||||
name = "protobuf_python",
|
||||
srcs = COPIED_WELL_KNOWN_PROTOS,
|
||||
include = "python",
|
||||
- data = select({
|
||||
- "//conditions:default": [],
|
||||
- ":use_fast_cpp_protos": [
|
||||
- ":python/google/protobuf/internal/_api_implementation.so",
|
||||
- ":python/google/protobuf/pyext/_message.so",
|
||||
- ],
|
||||
- }),
|
||||
default_runtime = "",
|
||||
protoc = ":protoc",
|
||||
py_libs = [
|
||||
@@ -1080,6 +1070,7 @@ py_proto_library(
|
||||
protoc = ":protoc",
|
||||
srcs_version = "PY2AND3",
|
||||
deps = [":protobuf_python"],
|
||||
+ visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
py_proto_library(
|
||||
@@ -1093,6 +1084,7 @@ py_proto_library(
|
||||
protoc = ":protoc",
|
||||
srcs_version = "PY2AND3",
|
||||
deps = [":python_common_test_protos"],
|
||||
+ visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
py_library(
|
||||
|
||||
--- python/google/protobuf/internal/test_util.py
|
||||
+++ python/google/protobuf/internal/test_util.py
|
||||
@@ -634,6 +634,13 @@ def GoldenFile(filename):
|
||||
# Found it. Load the golden file from the testdata directory.
|
||||
return open(full_path, 'rb')
|
||||
|
||||
+ # Search for cross-repo path.
|
||||
+ full_path = os.path.join('external/com_google_protobuf/src/google/protobuf/testdata',
|
||||
+ filename)
|
||||
+ if os.path.exists(full_path):
|
||||
+ # Found it. Load the golden file from the testdata directory.
|
||||
+ return open(full_path, 'rb')
|
||||
+
|
||||
raise RuntimeError(
|
||||
'Could not find golden files. This test must be run from within the '
|
||||
'protobuf source package so that it can read test data files from the '
|
||||
|
||||
--- python/google/protobuf/internal/testing_refleaks.py
|
||||
+++ python/google/protobuf/internal/testing_refleaks.py
|
||||
@@ -67,6 +67,12 @@ class ReferenceLeakCheckerMixin(object):
|
||||
NB_RUNS = 3
|
||||
|
||||
def run(self, result=None):
|
||||
+ testMethod = getattr(self, self._testMethodName)
|
||||
+ expecting_failure_method = getattr(testMethod, "__unittest_expecting_failure__", False)
|
||||
+ expecting_failure_class = getattr(self, "__unittest_expecting_failure__", False)
|
||||
+ if expecting_failure_class or expecting_failure_method:
|
||||
+ return
|
||||
+
|
||||
# python_message.py registers all Message classes to some pickle global
|
||||
# registry, which makes the classes immortal.
|
||||
# We save a copy of this registry, and reset it before we could references.
|
@ -1,50 +0,0 @@ |
||||
/*
|
||||
* Copyright (c) 2009-2021, Google LLC |
||||
* All rights reserved. |
||||
* |
||||
* Redistribution and use in source and binary forms, with or without |
||||
* modification, are permitted provided that the following conditions are met: |
||||
* * Redistributions of source code must retain the above copyright |
||||
* notice, this list of conditions and the following disclaimer. |
||||
* * Redistributions in binary form must reproduce the above copyright |
||||
* notice, this list of conditions and the following disclaimer in the |
||||
* documentation and/or other materials provided with the distribution. |
||||
* * Neither the name of Google LLC nor the |
||||
* names of its contributors may be used to endorse or promote products |
||||
* derived from this software without specific prior written permission. |
||||
* |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
||||
* ARE DISCLAIMED. IN NO EVENT SHALL Google LLC BE LIABLE FOR ANY DIRECT, |
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||
*/ |
||||
|
||||
#include "python/python_api.h" |
||||
|
||||
static struct PyModuleDef module_def = { |
||||
PyModuleDef_HEAD_INIT, |
||||
"google.protobuf.internal._api_implementation", |
||||
"Protobuf Module", |
||||
-1, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL, |
||||
NULL}; |
||||
|
||||
PyMODINIT_FUNC PyInit__api_implementation(void) { |
||||
PyObject* module = PyModule_Create(&module_def); |
||||
|
||||
if (PyModule_AddIntConstant(module, "api_version", 2)) { |
||||
Py_DECREF(module); |
||||
return NULL; |
||||
} |
||||
|
||||
return module; |
||||
} |
Loading…
Reference in new issue