[2.7] bpo-28315: Improve code examples in docs (GH-1372) (#1447)
Replace
File "<stdin>", line 1, in ?
with
File "<stdin>", line 1, in <module>.
(cherry picked from commit 8856940cf2e82cb17db2b684cd5732fe658605ca)
diff --git a/Doc/library/ctypes.rst b/Doc/library/ctypes.rst
index 052cdee..df9ccbf 100644
--- a/Doc/library/ctypes.rst
+++ b/Doc/library/ctypes.rst
@@ -87,7 +87,7 @@
<_FuncPtr object at 0x...>
>>> print windll.kernel32.MyOwnFunction # doctest: +WINDOWS
Traceback (most recent call last):
- File "<stdin>", line 1, in ?
+ File "<stdin>", line 1, in <module>
File "ctypes.py", line 239, in __getattr__
func = _StdcallFuncPtr(name, self)
AttributeError: function 'MyOwnFunction' not found
@@ -126,7 +126,7 @@
<_FuncPtr object at 0x...>
>>> cdll.kernel32[0] # doctest: +WINDOWS
Traceback (most recent call last):
- File "<stdin>", line 1, in ?
+ File "<stdin>", line 1, in <module>
File "ctypes.py", line 310, in __getitem__
func = _StdcallFuncPtr(name, self)
AttributeError: function ordinal 0 not found
@@ -159,11 +159,11 @@
>>> windll.kernel32.GetModuleHandleA() # doctest: +WINDOWS
Traceback (most recent call last):
- File "<stdin>", line 1, in ?
+ File "<stdin>", line 1, in <module>
ValueError: Procedure probably called with not enough arguments (4 bytes missing)
>>> windll.kernel32.GetModuleHandleA(0, 0) # doctest: +WINDOWS
Traceback (most recent call last):
- File "<stdin>", line 1, in ?
+ File "<stdin>", line 1, in <module>
ValueError: Procedure probably called with too many arguments (4 bytes in excess)
>>>
@@ -172,13 +172,13 @@
>>> cdll.kernel32.GetModuleHandleA(None) # doctest: +WINDOWS
Traceback (most recent call last):
- File "<stdin>", line 1, in ?
+ File "<stdin>", line 1, in <module>
ValueError: Procedure probably called with not enough arguments (4 bytes missing)
>>>
>>> windll.msvcrt.printf("spam") # doctest: +WINDOWS
Traceback (most recent call last):
- File "<stdin>", line 1, in ?
+ File "<stdin>", line 1, in <module>
ValueError: Procedure probably called with too many arguments (4 bytes in excess)
>>>
@@ -191,7 +191,7 @@
>>> windll.kernel32.GetModuleHandleA(32) # doctest: +WINDOWS
Traceback (most recent call last):
- File "<stdin>", line 1, in ?
+ File "<stdin>", line 1, in <module>
WindowsError: exception: access violation reading 0x00000020
>>>
@@ -354,7 +354,7 @@
19
>>> printf("%f bottles of beer\n", 42.5)
Traceback (most recent call last):
- File "<stdin>", line 1, in ?
+ File "<stdin>", line 1, in <module>
ArgumentError: argument 2: exceptions.TypeError: Don't know how to convert parameter 2
>>>
@@ -417,7 +417,7 @@
>>> printf("%d %d %d", 1, 2, 3)
Traceback (most recent call last):
- File "<stdin>", line 1, in ?
+ File "<stdin>", line 1, in <module>
ArgumentError: argument 2: exceptions.TypeError: wrong type
>>> printf("%s %d %f\n", "X", 2, 3)
X 2 3.000000
@@ -467,7 +467,7 @@
'def'
>>> strchr("abcdef", "def")
Traceback (most recent call last):
- File "<stdin>", line 1, in ?
+ File "<stdin>", line 1, in <module>
ArgumentError: argument 2: exceptions.TypeError: one character string expected
>>> print strchr("abcdef", "x")
None
@@ -493,7 +493,7 @@
486539264
>>> GetModuleHandle("something silly") # doctest: +WINDOWS
Traceback (most recent call last):
- File "<stdin>", line 1, in ?
+ File "<stdin>", line 1, in <module>
File "<stdin>", line 3, in ValidHandle
WindowsError: [Errno 126] The specified module could not be found.
>>>
@@ -564,7 +564,7 @@
0 5
>>> POINT(1, 2, 3)
Traceback (most recent call last):
- File "<stdin>", line 1, in ?
+ File "<stdin>", line 1, in <module>
ValueError: too many initializers
>>>
@@ -767,7 +767,7 @@
<class 'ctypes.LP_c_long'>
>>> PI(42)
Traceback (most recent call last):
- File "<stdin>", line 1, in ?
+ File "<stdin>", line 1, in <module>
TypeError: expected c_long instead of int
>>> PI(c_int(42))
<ctypes.LP_c_long object at 0x...>
@@ -843,7 +843,7 @@
>>> bar.values = (c_byte * 4)()
Traceback (most recent call last):
- File "<stdin>", line 1, in ?
+ File "<stdin>", line 1, in <module>
TypeError: incompatible types, c_byte_Array_4 instance instead of LP_c_long instance
>>>
@@ -894,7 +894,7 @@
... ("next", POINTER(cell))]
...
Traceback (most recent call last):
- File "<stdin>", line 1, in ?
+ File "<stdin>", line 1, in <module>
File "<stdin>", line 2, in cell
NameError: name 'cell' is not defined
>>>
diff --git a/Doc/library/doctest.rst b/Doc/library/doctest.rst
index b31d620..cf67b23 100644
--- a/Doc/library/doctest.rst
+++ b/Doc/library/doctest.rst
@@ -425,7 +425,7 @@
>>> [1, 2, 3].remove(42)
Traceback (most recent call last):
- File "<stdin>", line 1, in ?
+ File "<stdin>", line 1, in <module>
ValueError: list.remove(x): x not in list
That doctest succeeds if :exc:`ValueError` is raised, with the ``list.remove(x):
@@ -449,7 +449,7 @@
>>> raise ValueError('multi\n line\ndetail')
Traceback (most recent call last):
- File "<stdin>", line 1, in ?
+ File "<stdin>", line 1, in <module>
ValueError: multi
line
detail
@@ -607,7 +607,7 @@
>>> (1, 2)[3] = 'moo'
Traceback (most recent call last):
- File "<stdin>", line 1, in ?
+ File "<stdin>", line 1, in <module>
TypeError: object doesn't support item assignment
passes under Python 2.3 and later Python versions with the flag specified,
diff --git a/Doc/library/fpectl.rst b/Doc/library/fpectl.rst
index 8ca671b..d48b820 100644
--- a/Doc/library/fpectl.rst
+++ b/Doc/library/fpectl.rst
@@ -88,7 +88,7 @@
>>> import math
>>> math.exp(1000)
Traceback (most recent call last):
- File "<stdin>", line 1, in ?
+ File "<stdin>", line 1, in <module>
FloatingPointError: in math_1
diff --git a/Doc/library/pdb.rst b/Doc/library/pdb.rst
index 9177f95..33d7750 100644
--- a/Doc/library/pdb.rst
+++ b/Doc/library/pdb.rst
@@ -70,7 +70,7 @@
>>> import mymodule
>>> mymodule.test()
Traceback (most recent call last):
- File "<stdin>", line 1, in ?
+ File "<stdin>", line 1, in <module>
File "./mymodule.py", line 4, in test
test2()
File "./mymodule.py", line 3, in test2
diff --git a/Doc/library/unicodedata.rst b/Doc/library/unicodedata.rst
index a3a7c96..d7c48c4 100644
--- a/Doc/library/unicodedata.rst
+++ b/Doc/library/unicodedata.rst
@@ -161,7 +161,7 @@
9
>>> unicodedata.decimal(u'a')
Traceback (most recent call last):
- File "<stdin>", line 1, in ?
+ File "<stdin>", line 1, in <module>
ValueError: not a decimal
>>> unicodedata.category(u'A') # 'L'etter, 'u'ppercase
'Lu'