]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
practracker: codecs.open -> io.open for python 3.14
authorAlex Xu (Hello71) <alex_y_xu@yahoo.ca>
Mon, 15 Sep 2025 23:37:00 +0000 (19:37 -0400)
committerAlex Xu (Hello71) <alex_y_xu@yahoo.ca>
Mon, 15 Sep 2025 23:37:59 +0000 (19:37 -0400)
codecs.open is now deprecated: https://docs.python.org/3.14/whatsnew/3.14.html.
it prints a DeprecationWarning which makes tests fail, and may be removed in
the future. io.open works on python 2 and 3

scripts/maint/practracker/practracker.py

index 76ffd64cfb372d382098d70be96fede9d5edc5b6..fd2abe6c2752137543dc70786b312d49230ef433 100755 (executable)
@@ -24,7 +24,7 @@ from __future__ import division
 from __future__ import print_function
 from __future__ import unicode_literals
 
-import codecs, os, sys
+import io, os, sys
 
 import metrics
 import util
@@ -64,7 +64,7 @@ TOR_TOPDIR = None
 #######################################################
 
 def open_file(fname):
-    return codecs.open(fname, 'r', encoding='utf-8')
+    return io.open(fname, 'r', encoding='utf-8')
 
 def consider_file_size(fname, f):
     """Consider the size of 'f' and yield an FileSizeItem for it.