Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(13580)

Side by Side Diff: Doc/c-api/exceptions.rst

Issue 11619: On Windows, don't encode filenames in the import machinery
Patch Set: Created 8 years, 4 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | Include/ast.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 .. highlightlang:: c 1 .. highlightlang:: c
2 2
3 3
4 .. _exceptionhandling: 4 .. _exceptionhandling:
5 5
6 ****************** 6 ******************
7 Exception Handling 7 Exception Handling
8 ****************** 8 ******************
9 9
10 The functions described in this chapter will let you handle and raise Python 10 The functions described in this chapter will let you handle and raise Python
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 if *filename* is not *NULL*, it is passed to the constructor of 221 if *filename* is not *NULL*, it is passed to the constructor of
222 :exc:`WindowsError` as a third parameter. *filename* is decoded from the 222 :exc:`WindowsError` as a third parameter. *filename* is decoded from the
223 filesystem encoding (:func:`sys.getfilesystemencoding`). Availability: 223 filesystem encoding (:func:`sys.getfilesystemencoding`). Availability:
224 Windows. 224 Windows.
225 225
226 226
227 .. c:function:: PyObject* PyErr_SetExcFromWindowsErrWithFilename(PyObject *type, int ierr, char *filename) 227 .. c:function:: PyObject* PyErr_SetExcFromWindowsErrWithFilename(PyObject *type, int ierr, char *filename)
228 228
229 Similar to :c:func:`PyErr_SetFromWindowsErrWithFilename`, with an additional 229 Similar to :c:func:`PyErr_SetFromWindowsErrWithFilename`, with an additional
230 parameter specifying the exception type to be raised. Availability: Windows. 230 parameter specifying the exception type to be raised. Availability: Windows.
231
232
233 .. c:function:: void PyErr_SyntaxLocationObject(char *filename, int lineno, int col_offset)
234
235 Set file, line, and offset information for the current exception. If the
236 current exception is not a :exc:`SyntaxError`, then it sets additional
237 attributes, which make the exception printing subsystem think the exception
238 is a :exc:`SyntaxError`.
239
240 .. versionadded:: 3.3
231 241
232 242
233 .. c:function:: void PyErr_SyntaxLocationEx(char *filename, int lineno, int col_ offset) 243 .. c:function:: void PyErr_SyntaxLocationEx(char *filename, int lineno, int col_ offset)
234 244
235 Set file, line, and offset information for the current exception. If the 245 Like :c:func:`PyErr_SyntaxLocationObject`, but *filename* is a byte string
236 current exception is not a :exc:`SyntaxError`, then it sets additional 246 decoded from the filesystem encoding (:func:`sys.getfilesystemencoding`).
237 attributes, which make the exception printing subsystem think the exception
238 is a :exc:`SyntaxError`. *filename* is decoded from the filesystem encoding
239 (:func:`sys.getfilesystemencoding`).
240 247
241 .. versionadded:: 3.2 248 .. versionadded:: 3.2
242 249
243 250
244 .. c:function:: void PyErr_SyntaxLocation(char *filename, int lineno) 251 .. c:function:: void PyErr_SyntaxLocation(char *filename, int lineno)
245 252
246 Like :c:func:`PyErr_SyntaxLocationExc`, but the col_offset parameter is 253 Like :c:func:`PyErr_SyntaxLocationEx`, but the *col_offset* parameter is
247 omitted. 254 omitted.
248 255
249 256
250 .. c:function:: void PyErr_BadInternalCall() 257 .. c:function:: void PyErr_BadInternalCall()
251 258
252 This is a shorthand for ``PyErr_SetString(PyExc_SystemError, message)``, 259 This is a shorthand for ``PyErr_SetString(PyExc_SystemError, message)``,
253 where *message* indicates that an internal operation (e.g. a Python/C API 260 where *message* indicates that an internal operation (e.g. a Python/C API
254 function) was invoked with an illegal argument. It is mostly for internal 261 function) was invoked with an illegal argument. It is mostly for internal
255 use. 262 use.
256 263
(...skipping 28 matching lines...) Expand all
285 :c:data:`PyExc_SyntaxWarning`, :c:data:`PyExc_RuntimeWarning`, and 292 :c:data:`PyExc_SyntaxWarning`, :c:data:`PyExc_RuntimeWarning`, and
286 :c:data:`PyExc_FutureWarning`. :c:data:`PyExc_Warning` is a subclass of 293 :c:data:`PyExc_FutureWarning`. :c:data:`PyExc_Warning` is a subclass of
287 :c:data:`PyExc_Exception`; the other warning categories are subclasses of 294 :c:data:`PyExc_Exception`; the other warning categories are subclasses of
288 :c:data:`PyExc_Warning`. 295 :c:data:`PyExc_Warning`.
289 296
290 For information about warning control, see the documentation for the 297 For information about warning control, see the documentation for the
291 :mod:`warnings` module and the :option:`-W` option in the command line 298 :mod:`warnings` module and the :option:`-W` option in the command line
292 documentation. There is no C API for warning control. 299 documentation. There is no C API for warning control.
293 300
294 301
295 .. c:function:: int PyErr_WarnExplicit(PyObject *category, const char *message, const char *filename, int lineno, const char *module, PyObject *registry) 302 .. c:function:: int PyErr_WarnExplicitObject(PyObject *category, PyObject *messa ge, PyObject *filename, int lineno, PyObject *module, PyObject *registry)
296 303
297 Issue a warning message with explicit control over all warning attributes. T his 304 Issue a warning message with explicit control over all warning attributes. T his
298 is a straightforward wrapper around the Python function 305 is a straightforward wrapper around the Python function
299 :func:`warnings.warn_explicit`, see there for more information. The *module* 306 :func:`warnings.warn_explicit`, see there for more information. The *module*
300 and *registry* arguments may be set to *NULL* to get the default effect 307 and *registry* arguments may be set to *NULL* to get the default effect
301 described there. *message* and *module* are UTF-8 encoded strings, 308 described there. *message* and *module* are UTF-8 encoded strings,
302 *filename* is decoded from the filesystem encoding 309 *filename* is decoded from the filesystem encoding
303 (:func:`sys.getfilesystemencoding`). 310 (:func:`sys.getfilesystemencoding`).
311
312 .. versionadded:: 3.3
313
314
315 .. c:function:: int PyErr_WarnExplicit(PyObject *category, const char *message, const char *filename, int lineno, const char *module, PyObject *registry)
316
317 Similar to :c:func:`PyErr_WarnExplicitObject` except that *message* and
318 *module* are UTF-8 encoded strings, and *filename* is decoded from the
319 filesystem encoding (:func:`sys.getfilesystemencoding`).
304 320
305 321
306 .. c:function:: int PyErr_WarnFormat(PyObject *category, Py_ssize_t stack_level, const char *format, ...) 322 .. c:function:: int PyErr_WarnFormat(PyObject *category, Py_ssize_t stack_level, const char *format, ...)
307 323
308 Function similar to :c:func:`PyErr_WarnEx`, but use 324 Function similar to :c:func:`PyErr_WarnEx`, but use
309 :c:func:`PyUnicode_FromFormat` to format the warning message. *format* is 325 :c:func:`PyUnicode_FromFormat` to format the warning message. *format* is
310 an ASCII-encoded string. 326 an ASCII-encoded string.
311 327
312 .. versionadded:: 3.2 328 .. versionadded:: 3.2
313 329
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 692
677 (1) 693 (1)
678 This is a base class for other standard exceptions. 694 This is a base class for other standard exceptions.
679 695
680 (2) 696 (2)
681 This is the same as :exc:`weakref.ReferenceError`. 697 This is the same as :exc:`weakref.ReferenceError`.
682 698
683 (3) 699 (3)
684 Only defined on Windows; protect code that uses this by testing that the 700 Only defined on Windows; protect code that uses this by testing that the
685 preprocessor macro ``MS_WINDOWS`` is defined. 701 preprocessor macro ``MS_WINDOWS`` is defined.
OLDNEW
« no previous file with comments | « no previous file | Include/ast.h » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+