-
Notifications
You must be signed in to change notification settings - Fork 24.7k
[struct] Add struct.pack
and struct.unpack
polyfills
#156977
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
base: gh/guilhermeleobas/190/base
Are you sure you want to change the base?
[struct] Add struct.pack
and struct.unpack
polyfills
#156977
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/156977
Note: Links to docs will display an error until the docs builds have been completed. ❌ 1 Cancelled Job, 4 Unrelated FailuresAs of commit 20d6316 with merge base dea4864 ( CANCELLED JOB - The following job was cancelled. Please retry:
FLAKY - The following jobs failed but were likely due to flakiness present on trunk:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
torch/_dynamo/polyfills/struct.py
Outdated
|
||
|
||
@substitute_in_graph(struct.pack, can_constant_fold_through=True) # type: ignore[arg-type] | ||
def pack(fmt: Union[bytes, str], /, *v: Any) -> bytes: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def pack(fmt: Union[bytes, str], /, *v: Any) -> bytes: | |
def pack(fmt: str | bytes, /, *v: Any) -> bytes: |
torch/_dynamo/polyfills/struct.py
Outdated
|
||
|
||
@substitute_in_graph(struct.unpack, can_constant_fold_through=True) # type: ignore[arg-type] | ||
def unpack(format: Union[bytes, str], buffer: bytes) -> tuple[Any, ...]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def unpack(format: Union[bytes, str], buffer: bytes) -> tuple[Any, ...]: | |
def unpack(format: str | bytes, buffer: collections.abc.Buffer, /) -> tuple[Any, ...]: |
Stack from ghstack (oldest at bottom):
struct.pack
andstruct.unpack
polyfills #156977float.fromhex
#156976cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @chenyang78 @kadeng @chauhang @amjames