8000 Fix BytesWarning in torch.load() by aphedges · Pull Request #74813 · pytorch/pytorch · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix BytesWarning in torch.load() #74813

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
2 changes: 1 addition & 1 deletion test/run_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ def get_executable_command(options, allow_pytest, disable_coverage=False):
if options.coverage and not disable_coverage:
executable = ["coverage", "run", "--parallel-mode", "--source=torch"]
else:
executable = [sys.executable]
executable = [sys.executable, "-bb"]
if options.pytest:
if allow_pytest:
executable += ["-m", "pytest"]
Expand Down
4 changes: 2 additions & 2 deletions test/test_torch.py
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,7 @@ def cpp_warn_fn():

# Checks for cpp context in the warning message
escaped_warning_message = str(warning.message).encode('unicode_escape')
self.assertTrue(re.search(s, str(escaped_warning_message), re.IGNORECASE) is not None)
self.assertTrue(re.search(s, repr(escaped_warning_message), re.IGNORECASE) is not None)

# Checks the Python features of the warning
# Note: the eager mode warning refers to the line in the function
Expand All @@ -764,7 +764,7 @@ def cpp_warn_fn():

# Checks for cpp context in the warning message
escaped_warning_message = str(warning.message).encode('unicode_escape')
self.assertTrue(re.search(s, str(escaped_warning_message), re.IGNORECASE) is not None)
self.assertTrue(re.search(s, repr(escaped_warning_message), re.IGNORECASE) is not None)

# Checks the Python features of the warning
# Note: the jitted warning's lineno refers to the call to the jitted
Expand Down
2 changes: 1 addition & 1 deletion torch/serialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def _is_zipfile(f) -> bool:
start = f.tell()

byte = f.read(1)
while byte != "":
while byte != b"":
read_bytes.append(byte)
if len(read_bytes) == 4:
break
Expand Down
0