comparison Python/errors.c @ 42794:84618b2064c1

Add const to some strings that are not modified
author Neal Norwitz <nnorwitz@gmail.com>
date Fri, 24 Aug 2007 20:00:37 +0000
parents 61fb597917d1
children b51ac2d2d538
comparison
equal deleted inserted replaced
42793:61fb597917d1 42794:84618b2064c1
346 return NULL; 346 return NULL;
347 } 347 }
348 348
349 349
350 PyObject * 350 PyObject *
351 PyErr_SetFromErrnoWithFilename(PyObject *exc, char *filename) 351 PyErr_SetFromErrnoWithFilename(PyObject *exc, const char *filename)
352 { 352 {
353 PyObject *name = filename ? PyUnicode_FromString(filename) : NULL; 353 PyObject *name = filename ? PyUnicode_FromString(filename) : NULL;
354 PyObject *result = PyErr_SetFromErrnoWithFilenameObject(exc, name); 354 PyObject *result = PyErr_SetFromErrnoWithFilenameObject(exc, name);
355 Py_XDECREF(name); 355 Py_XDECREF(name);
356 return result; 356 return result;
357 } 357 }
358 358
359 #ifdef Py_WIN_WIDE_FILENAMES 359 #ifdef Py_WIN_WIDE_FILENAMES
360 PyObject * 360 PyObject *
361 PyErr_SetFromErrnoWithUnicodeFilename(PyObject *exc, Py_UNICODE *filename) 361 PyErr_SetFromErrnoWithUnicodeFilename(PyObject *exc, const Py_UNICODE *filename)
362 { 362 {
363 PyObject *name = filename ? 363 PyObject *name = filename ?
364 PyUnicode_FromUnicode(filename, wcslen(filename)) : 364 PyUnicode_FromUnicode(filename, wcslen(filename)) :
365 NULL; 365 NULL;
366 PyObject *result = PyErr_SetFromErrnoWithFilenameObject(exc, name); 366 PyObject *result = PyErr_SetFromErrnoWithFilenameObject(exc, name);
492 } 492 }
493 #endif /* Py_WIN_WIDE_FILENAMES */ 493 #endif /* Py_WIN_WIDE_FILENAMES */
494 #endif /* MS_WINDOWS */ 494 #endif /* MS_WINDOWS */
495 495
496 void 496 void
497 _PyErr_BadInternalCall(char *filename, int lineno) 497 _PyErr_BadInternalCall(const char *filename, int lineno)
498 { 498 {
499 PyErr_Format(PyExc_SystemError, 499 PyErr_Format(PyExc_SystemError,
500 "%s:%d: bad argument to internal function", 500 "%s:%d: bad argument to internal function",
501 filename, lineno); 501 filename, lineno);
502 } 502 }
534 } 534 }
535 535
536 536
537 537
538 PyObject * 538 PyObject *
539 PyErr_NewException(char *name, PyObject *base, PyObject *dict) 539 PyErr_NewException(const char *name, PyObject *base, PyObject *dict)
540 { 540 {
541 char *dot; 541 const char *dot;
542 PyObject *modulename = NULL; 542 PyObject *modulename = NULL;
543 PyObject *classname = NULL; 543 PyObject *classname = NULL;
544 PyObject *mydict = NULL; 544 PyObject *mydict = NULL;
545 PyObject *bases = NULL; 545 PyObject *bases = NULL;
546 PyObject *result = NULL; 546 PyObject *result = NULL;