Message340657
<nod>, it seems like the problem must somehow stem from the new commit using frame.f_code.co_filename (or the C equivalent), instead of using __file__ as previously.
Consider this warn2.py, similar to the other but with no single quotes in the warning message:
```
import doctest
class Tester:
r"""Provide docstring for testing.
>>> import warnings
>>> from contextlib import redirect_stderr
>>> from io import StringIO
>>> sio = StringIO()
>>> with redirect_stderr(sio):
... warnings.warn("Warning with no quotes")
>>> sio.getvalue()
'...'
"""
doctest.run_docstring_examples(
Tester(),
{},
optionflags=doctest.ELLIPSIS,
)
```
This doctest PASSES for me in both 3.7 and 3.8; note that the expected doctest output from `sio.getvalue()` is *single-quote delimited*. This implies to me that REPL string output is single-quote delimited by default, and that there's some sort of "smart string formatter" functionality involved that is working correctly in 3.7 but not in 3.8, which REPL-prints the single-quote-containing string using enclosing double-quotes, so as to avoid escaping the internal single quotes.
Why 11a8966 would break this in this way is ... baffling to me.
---
Unfortunately, I don't think it will work to fix the doctest on my end simply by using `print(sio.getvalue())`, as the resulting message is one line long in 3.7, but two lines long in 3.8. Further, doctest gets confused when you try to start a line of output with an ellipsis, as it thinks it's a continuation of the prior command. |
|
Date |
User |
Action |
Args |
2019-04-22 15:21:28 | bskinn | set | recipients:
+ bskinn, brett.cannon, vstinner, takluyver, xtreak |
2019-04-22 15:21:28 | bskinn | set | messageid: <1555946488.63.0.794230566474.issue36695@roundup.psfhosted.org> |
2019-04-22 15:21:28 | bskinn | link | issue36695 messages |
2019-04-22 15:21:28 | bskinn | create | |
|