@@ -97,7 +97,7 @@ Functions are accessed as attributes of dll objects::
9797 <_FuncPtr object at 0x...>
9898 >>> print(windll.kernel32.MyOwnFunction) # doctest: +WINDOWS
9999 Traceback (most recent call last):
100- File "<stdin>", line 1, in ?
100+ File "<stdin>", line 1, in <module>
101101 File "ctypes.py", line 239, in __getattr__
102102 func = _StdcallFuncPtr(name, self)
103103 AttributeError: function 'MyOwnFunction' not found
@@ -135,7 +135,7 @@ functions can be accessed by indexing the dll object with the ordinal number::
135135 <_FuncPtr object at 0x...>
136136 >>> cdll.kernel32[0] # doctest: +WINDOWS
137137 Traceback (most recent call last):
138- File "<stdin>", line 1, in ?
138+ File "<stdin>", line 1, in <module>
139139 File "ctypes.py", line 310, in __getitem__
140140 func = _StdcallFuncPtr(name, self)
141141 AttributeError: function ordinal 0 not found
@@ -168,11 +168,11 @@ although an error is raised the function *has* been called::
168168
169169 >>> windll.kernel32.GetModuleHandleA() # doctest: +WINDOWS
170170 Traceback (most recent call last):
171- File "<stdin>", line 1, in ?
171+ File "<stdin>", line 1, in <module>
172172 ValueError: Procedure probably called with not enough arguments (4 bytes missing)
173173 >>> windll.kernel32.GetModuleHandleA(0, 0) # doctest: +WINDOWS
174174 Traceback (most recent call last):
175- File "<stdin>", line 1, in ?
175+ File "<stdin>", line 1, in <module>
176176 ValueError: Procedure probably called with too many arguments (4 bytes in excess)
177177 >>>
178178
@@ -181,13 +181,13 @@ The same exception is raised when you call an ``stdcall`` function with the
181181
182182 >>> cdll.kernel32.GetModuleHandleA(None) # doctest: +WINDOWS
183183 Traceback (most recent call last):
184- File "<stdin>", line 1, in ?
184+ File "<stdin>", line 1, in <module>
185185 ValueError: Procedure probably called with not enough arguments (4 bytes missing)
186186 >>>
187187
188188 >>> windll.msvcrt.printf(b"spam") # doctest: +WINDOWS
189189 Traceback (most recent call last):
190- File "<stdin>", line 1, in ?
190+ File "<stdin>", line 1, in <module>
191191 ValueError: Procedure probably called with too many arguments (4 bytes in excess)
192192 >>>
193193
@@ -200,7 +200,7 @@ argument values::
200200
201201 >>> windll.kernel32.GetModuleHandleA(32) # doctest: +WINDOWS
202202 Traceback (most recent call last):
203- File "<stdin>", line 1, in ?
203+ File "<stdin>", line 1, in <module>
204204 OSError: exception: access violation reading 0x00000020
205205 >>>
206206
@@ -373,7 +373,7 @@ from within *IDLE* or *PythonWin*::
373373 19
374374 >>> printf(b"%f bottles of beer\n", 42.5)
375375 Traceback (most recent call last):
376- File "<stdin>", line 1, in ?
376+ File "<stdin>", line 1, in <module>
377377 ArgumentError: argument 2: exceptions.TypeError: Don't know how to convert parameter 2
378378 >>>
379379
@@ -436,7 +436,7 @@ prototype for a C function), and tries to convert the arguments to valid types::
436436
437437 >>> printf(b"%d %d %d", 1, 2, 3)
438438 Traceback (most recent call last):
439- File "<stdin>", line 1, in ?
439+ File "<stdin>", line 1, in <module>
440440 ArgumentError: argument 2: exceptions.TypeError: wrong type
441441 >>> printf(b"%s %d %f\n", b"X", 2, 3)
442442 X 2 3.000000
@@ -486,7 +486,7 @@ single character Python bytes object into a C char::
486486 'def'
487487 >>> strchr(b"abcdef", b"def")
488488 Traceback (most recent call last):
489- File "<stdin>", line 1, in ?
489+ File "<stdin>", line 1, in <module>
490490 ArgumentError: argument 2: exceptions.TypeError: one character string expected
491491 >>> print(strchr(b"abcdef", b"x"))
492492 None
@@ -512,7 +512,7 @@ useful to check for error return values and automatically raise an exception::
512512 486539264
513513 >>> GetModuleHandle("something silly") # doctest: +WINDOWS
514514 Traceback (most recent call last):
515- File "<stdin>", line 1, in ?
515+ File "<stdin>", line 1, in <module>
516516 File "<stdin>", line 3, in ValidHandle
517517 OSError: [Errno 126] The specified module could not be found.
518518 >>>
@@ -583,7 +583,7 @@ Here is a simple example of a POINT structure, which contains two integers named
583583 0 5
584584 >>> POINT(1, 2, 3)
585585 Traceback (most recent call last):
586- File "<stdin>", line 1, in ?
586+ File "<stdin>", line 1, in <module>
587587 ValueError: too many initializers
588588 >>>
589589
@@ -786,7 +786,7 @@ new type::
786786 <class 'ctypes.LP_c_long'>
787787 >>> PI(42)
788788 Traceback (most recent call last):
789- File "<stdin>", line 1, in ?
789+ File "<stdin>", line 1, in <module>
790790 TypeError: expected c_long instead of int
791791 >>> PI(c_int(42))
792792 <ctypes.LP_c_long object at 0x...>
@@ -862,7 +862,7 @@ but not instances of other types::
862862
863863 >>> bar.values = (c_byte * 4)()
864864 Traceback (most recent call last):
865- File "<stdin>", line 1, in ?
865+ File "<stdin>", line 1, in <module>
866866 TypeError: incompatible types, c_byte_Array_4 instance instead of LP_c_long instance
867867 >>>
868868
@@ -913,7 +913,7 @@ work::
913913 ... ("next", POINTER(cell))]
914914 ...
915915 Traceback (most recent call last):
916- File "<stdin>", line 1, in ?
916+ File "<stdin>", line 1, in <module>
917917 File "<stdin>", line 2, in cell
918918 NameError: name 'cell' is not defined
919919 >>>
0 commit comments