Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14864889
D17694.id52758.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Subscribers
None
D17694.id52758.diff
View Options
diff --git a/arcanist/linter/PythonFileEncodingLinter.php b/arcanist/linter/PythonFileEncodingLinter.php
--- a/arcanist/linter/PythonFileEncodingLinter.php
+++ b/arcanist/linter/PythonFileEncodingLinter.php
@@ -49,7 +49,7 @@
list($open, $offset) = $match;
$isBin = preg_match(
- "/open\(.*,\s? +['\"][rwxat+]*b[rwxat+]*['\"]/s", $open);
+ "/open\(.*,\s? +(\*\*kwargs|['\"][rwxat+]*b[rwxat+]*['\"])/s", $open);
$hasEncoding = preg_match("/encoding=.(ascii|utf8|utf-8)./", $open);
if (!$isBin && !$hasEncoding) {
diff --git a/test/functional/test_framework/test_node.py b/test/functional/test_framework/test_node.py
--- a/test/functional/test_framework/test_node.py
+++ b/test/functional/test_framework/test_node.py
@@ -586,8 +586,8 @@
def debug_log_path(self) -> Path:
return self.chain_path / "debug.log"
- def debug_log_bytes(self) -> int:
- with open(self.debug_log_path, encoding="utf-8") as dl:
+ def debug_log_size(self, **kwargs) -> int:
+ with open(self.debug_log_path, **kwargs) as dl:
dl.seek(0, 2)
return dl.tell()
@@ -608,13 +608,15 @@
if unexpected_msgs is None:
unexpected_msgs = []
time_end = time.time() + timeout * self.timeout_factor
- prev_size = self.debug_log_bytes()
+ prev_size = self.debug_log_size(
+ encoding="utf-8"
+ ) # Must use same encoding that is used to read() below
yield
while True:
found = True
- with open(self.debug_log_path, encoding="utf-8") as dl:
+ with open(self.debug_log_path, encoding="utf-8", errors="replace") as dl:
dl.seek(prev_size)
log = dl.read()
print_log = " - " + "\n - ".join(log.splitlines())
@@ -650,7 +652,9 @@
If a chatty_callable is provided, it is repeated at every iteration.
"""
time_end = time.time() + timeout * self.timeout_factor
- prev_size = self.debug_log_bytes()
+ prev_size = self.debug_log_size(
+ mode="rb"
+ ) # Must use same mode that is used to read() below
yield
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, May 20, 23:01 (4 h, 55 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5865682
Default Alt Text
D17694.id52758.diff (2 KB)
Attached To
D17694: test: Ignore UTF-8 errors in assert_debug_log
Event Timeline
Log In to Comment