Skip to content

Commit 0587774

Browse files
author
Chris
committed
Handle unicode files in a Python 2 and 3 compatible fassion using io.open
1 parent ad64e49 commit 0587774

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

memory_profiler.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import linecache
1313
import logging
1414
import os
15+
from io import open
1516
import pdb
1617
import subprocess
1718
import sys
@@ -20,6 +21,7 @@
2021
import warnings
2122
import contextlib
2223

24+
2325
if sys.platform == "win32":
2426
# any value except signal.CTRL_C_EVENT and signal.CTRL_BREAK_EVENT
2527
# can be used to kill a process unconditionally in Windows

test/test_unicode.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# -*- coding: utf-8 -*-
2-
# run only for Python 2.xx
32
@profile
43
def test_unicode(txt):
54
# test when unicode is present

0 commit comments

Comments
 (0)