Skip to content

Commit 245a79d

Browse files
committed
Fix exception messages for Python 2/3
1 parent 6650d0b commit 245a79d

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

cypari2/closure.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ cpdef Gen objtoclosure(f):
157157
>>> mul(4)
158158
Traceback (most recent call last):
159159
...
160-
TypeError: pymul() missing 1 required positional argument: 'j'
160+
TypeError: pymul() ...
161161
>>> mul(None, None)
162162
Traceback (most recent call last):
163163
...

tests/rundoctest.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@
1414
# The doctests assume utf-8 encoding
1515
cypari2.string_utils.encoding = "utf-8"
1616

17+
# For doctests, we want exceptions to look the same,
18+
# regardless of the Python version. Python 3 will put the
19+
# module name in the traceback, which we avoid by faking
20+
# the module to be __main__.
21+
cypari2.handle_error.PariError.__module__ = "__main__"
22+
1723
failed = 0
1824
attempted = 0
1925
for mod in [cypari2.closure, cypari2.convert, cypari2.gen,

0 commit comments

Comments
 (0)