Skip to content

protobuf: Tighten annotations for MergeFromString and ParseFromString.#3333

Merged
srittau merged 1 commit intopython:masterfrom
benjaminp:protobuf-serialized
Oct 10, 2019
Merged

protobuf: Tighten annotations for MergeFromString and ParseFromString.#3333
srittau merged 1 commit intopython:masterfrom
benjaminp:protobuf-serialized

Conversation

@benjaminp
Copy link
Contributor

No description provided.

Copy link
Collaborator

@srittau srittau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, just one style nit and one question.


_T = TypeVar("_T")

if sys.version_info[0] == 2:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style nit: We use sys.version_info < (3,) consistently throughout typeshed.

if sys.version_info[0] == 2:
_Serialized = Union[bytes, buffer, unicode]
else:
_Serialized = Union[bytes, memoryview]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case this also allows bytestring, this could be simplified to just bytes, per the documentation.

@benjaminp benjaminp force-pushed the protobuf-serialized branch from 87b4fea to 20dcf42 Compare October 10, 2019 15:34
@srittau srittau merged commit fc23c82 into python:master Oct 10, 2019
@benjaminp benjaminp deleted the protobuf-serialized branch October 11, 2019 03:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants