Skip to content

Commit 68937f3

Browse files
dmalanKareem Zidane
authored and
Kareem Zidane
committedFeb 11, 2019
adds back eprint for now
1 parent 112a4d2 commit 68937f3

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed
 

Diff for: ‎setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@
1616
package_dir={"": "src"},
1717
packages=["cs50"],
1818
url="https://github.com/cs50/python-cs50",
19-
version="3.0.2"
19+
version="3.1.0"
2020
)

Diff for: ‎src/cs50/cs50.py

+12
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,18 @@ def write(self, x):
3232
sys.stdout = flushfile(sys.stdout)
3333

3434

35+
def eprint(*args, **kwargs):
36+
"""
37+
Print an error message to standard error, prefixing it with
38+
file name and line number from which method was called.
39+
"""
40+
end = kwargs.get("end", "\n")
41+
sep = kwargs.get("sep", " ")
42+
(filename, lineno) = inspect.stack()[1][1:3]
43+
print("{}:{}: ".format(filename, lineno), end="")
44+
print(*args, end=end, file=sys.stderr, sep=sep)
45+
46+
3547
def formatException(type, value, tb):
3648
"""
3749
Format traceback, darkening entries from global site-packages directories

0 commit comments

Comments
 (0)
Please sign in to comment.