Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix: Fix the issue with empty package name #341

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions proto/_package_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,7 @@ def compile(name, attrs):
module_name = module.__name__ if hasattr(module, __name__) else ""
proto_module = getattr(module, "__protobuf__", object())

# A package should be present; get the marshal from there.
# TODO: Revert to empty string as a package value after protobuf fix.
# When package is empty, upb based protobuf fails with an
# "TypeError: Couldn't build proto file into descriptor pool: invalid name: empty part ()' means"
# during an attempt to add to descriptor pool.
package = getattr(
proto_module, "package", module_name if module_name else "_default_package"
)
package = getattr(proto_module, "package", module_name if module_name else "")
marshal = Marshal(name=getattr(proto_module, "marshal", package))

# Done; return the data.
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
long_description=README,
platforms="Posix; MacOS X",
include_package_data=True,
install_requires=("protobuf >= 3.19.0, <5.0.0dev",),
install_requires=("protobuf >= 4.21.6, <5.0.0dev",),
extras_require={
"testing": [
"google-api-core[grpc] >= 1.31.5",
Expand Down