handle = ctypes_dlopen(name_str, mode);
Py_XDECREF(name2);
if (!handle) {
- char *errmsg = ctypes_dlerror();
+ const char *errmsg = ctypes_dlerror();
if (!errmsg)
errmsg = "dlopen() error";
PyErr_SetString(PyExc_OSError,
/* Release Number */
-char *PyCursesVersion = "2.2";
+static const char PyCursesVersion[] = "2.2";
/* Includes */
}
if (!initialised_setupterm && setupterm(termstr,fd,&err) == ERR) {
- char* s = "setupterm: unknown error";
+ const char* s = "setupterm: unknown error";
if (err == 0) {
s = "setupterm: could not find terminal";
pysqlite_connection_exit(pysqlite_Connection* self, PyObject* args)
{
PyObject* exc_type, *exc_value, *exc_tb;
- char* method_name;
+ const char* method_name;
PyObject* result;
if (!PyArg_ParseTuple(args, "OOO", &exc_type, &exc_value, &exc_tb)) {
static PyObject *
test_string_to_double(PyObject *self) {
double result;
- char *msg;
+ const char *msg;
#define CHECK_STRING(STR, expected) \
result = PyOS_string_to_double(STR, NULL, NULL); \
extern long ieee_handler(const char*, const char*, sigfpe_handler_type);
#endif
- char *mode="exception", *in="all", *out;
+ const char *mode="exception", *in="all";
+ char *out;
(void) nonstandard_arithmetic();
(void) ieee_flags("clearall",mode,in,&out);
(void) ieee_handler("set","common",(sigfpe_handler_type)handler);
{
if (!(_PyRuntime.gc.debug & DEBUG_SAVEALL)
&& _PyRuntime.gc.garbage != NULL && PyList_GET_SIZE(_PyRuntime.gc.garbage) > 0) {
- char *message;
+ const char *message;
if (_PyRuntime.gc.debug & DEBUG_UNCOLLECTABLE)
message = "gc: %zd uncollectable objects at " \
"shutdown";
port = htons((u_short)atoi(servname));
} else {
struct servent *sp;
- char *proto;
+ const char *proto;
proto = NULL;
switch (pai->ai_socktype) {
run_file(FILE *fp, const wchar_t *filename, PyCompilerFlags *p_cf)
{
PyObject *unicode, *bytes = NULL;
- char *filename_str;
+ const char *filename_str;
int run;
/* call pending calls like signal handlers (SIGINT) */
DWORD off_lo; /* lower 32 bits of offset */
DWORD size_hi; /* upper 32 bits of size */
DWORD size_lo; /* lower 32 bits of size */
- char *tagname = "";
+ const char *tagname = "";
DWORD dwErr = 0;
int fileno;
HANDLE fh = 0;
typedef struct {
PyObject_HEAD
- char *devicename; /* name of the device file */
+ const char *devicename; /* name of the device file */
int fd; /* file descriptor */
int mode; /* file mode (O_RDONLY, etc.) */
Py_ssize_t icount; /* input count */
{
oss_audio_t *self;
int fd, afmts, imode;
- char *devicename = NULL;
- char *mode = NULL;
+ const char *devicename = NULL;
+ const char *mode = NULL;
/* Two ways to call open():
open(device, mode) (for consistency with builtin open())
static oss_mixer_t *
newossmixerobject(PyObject *arg)
{
- char *devicename = NULL;
+ const char *devicename = NULL;
int fd;
oss_mixer_t *self;
/*[clinic end generated code: output=760412661a34ad5a input=ef7bb59b09c21d62]*/
{
Py_ssize_t left, right, mysize, byteslen;
- char *myptr, *bytesptr;
+ char *myptr;
+ const char *bytesptr;
Py_buffer vbytes;
if (bytes == Py_None) {
else {
if (PyObject_GetBuffer(bytes, &vbytes, PyBUF_SIMPLE) != 0)
return NULL;
- bytesptr = (char *) vbytes.buf;
+ bytesptr = (const char *) vbytes.buf;
byteslen = vbytes.len;
}
myptr = PyByteArray_AS_STRING(self);
/*[clinic end generated code: output=d005c9d0ab909e66 input=80843f975dd7c480]*/
{
Py_ssize_t left, right, mysize, byteslen;
- char *myptr, *bytesptr;
+ char *myptr;
+ const char *bytesptr;
Py_buffer vbytes;
if (bytes == Py_None) {
else {
if (PyObject_GetBuffer(bytes, &vbytes, PyBUF_SIMPLE) != 0)
return NULL;
- bytesptr = (char *) vbytes.buf;
+ bytesptr = (const char *) vbytes.buf;
byteslen = vbytes.len;
}
myptr = PyByteArray_AS_STRING(self);
/*[clinic end generated code: output=030e2fbd2f7276bd input=e728b994954cfd91]*/
{
Py_ssize_t right, mysize, byteslen;
- char *myptr, *bytesptr;
+ char *myptr;
+ const char *bytesptr;
Py_buffer vbytes;
if (bytes == Py_None) {
else {
if (PyObject_GetBuffer(bytes, &vbytes, PyBUF_SIMPLE) != 0)
return NULL;
- bytesptr = (char *) vbytes.buf;
+ bytesptr = (const char *) vbytes.buf;
byteslen = vbytes.len;
}
myptr = PyByteArray_AS_STRING(self);
{
PyObject *func = PyInstanceMethod_Function(self);
PyObject *funcname = NULL , *result = NULL;
- char *defname = "?";
+ const char *defname = "?";
if (func == NULL) {
PyErr_BadInternalCall();
/* These do not need to be freed. re is either an alias
for pre or a pointer to a constant. lead and tail
are pointers to constants. */
- char *re = NULL;
- char *lead = "";
- char *tail = "";
+ const char *re = NULL;
+ const char *lead = "";
+ const char *tail = "";
if (v->cval.real == 0. && copysign(1.0, v->cval.real)==1.0) {
/* Real part is +0: just output the imaginary part and do not
PyObject *result;
if (gen->gi_running) {
- char *msg = "generator already executing";
+ const char *msg = "generator already executing";
if (PyCoro_CheckExact(gen)) {
msg = "coroutine already executing";
}
if (f->f_lasti == -1) {
if (arg && arg != Py_None) {
- char *msg = "can't send non-None value to a "
- "just-started generator";
+ const char *msg = "can't send non-None value to a "
+ "just-started generator";
if (PyCoro_CheckExact(gen)) {
msg = NON_INIT_CORO_MSG;
}
PyErr_SetNone(PyExc_GeneratorExit);
retval = gen_send_ex(gen, Py_None, 1, 1);
if (retval) {
- char *msg = "generator ignored GeneratorExit";
+ const char *msg = "generator ignored GeneratorExit";
if (PyCoro_CheckExact(gen)) {
msg = "coroutine ignored GeneratorExit";
} else if (PyAsyncGen_CheckExact(gen)) {
{
const uint8_t *q = (const uint8_t *)p;
char msgbuf[64];
- char *msg;
+ const char *msg;
size_t nbytes;
const uint8_t *tail;
int i;
id = (char)q[-SST];
if (id != api) {
msg = msgbuf;
- snprintf(msg, sizeof(msgbuf), "bad ID: Allocated using API '%c', verified using API '%c'", id, api);
+ snprintf(msgbuf, sizeof(msgbuf), "bad ID: Allocated using API '%c', verified using API '%c'", id, api);
msgbuf[sizeof(msgbuf)-1] = 0;
goto error;
}
if (len == -1)
return -1;
if (len > 1) {
- char *msg = "expected at most 1 arguments, got %d";
+ const char *msg = "expected at most 1 arguments, got %d";
PyErr_Format(PyExc_TypeError, msg, len);
return -1;
}
assert(args == NULL || PyTuple_Check(args));
len = (args != NULL) ? PyTuple_GET_SIZE(args) : 0;
if (len > 1) {
- char *msg = "update() takes at most 1 positional argument (%d given)";
+ const char *msg = "update() takes at most 1 positional argument (%d given)";
PyErr_Format(PyExc_TypeError, msg, len);
return NULL;
}
Py_ssize_t collstartpos = *inpos;
Py_ssize_t collendpos = *inpos+1;
Py_ssize_t collpos;
- char *encoding = "charmap";
- char *reason = "character maps to <undefined>";
+ const char *encoding = "charmap";
+ const char *reason = "character maps to <undefined>";
charmapencode_result x;
Py_UCS4 ch;
int val;
/* output buffer */
_PyUnicodeWriter writer;
/* error handler */
- char *reason = "character maps to <undefined>";
+ const char *reason = "character maps to <undefined>";
PyObject *errorHandler = NULL;
PyObject *exc = NULL;
int ignore;
if (count == 0) {
char Buffer[4096];
- char *msg;
+ const char *msg;
if (target_version && target_version[0]) {
wsprintf(Buffer,
"Python version %s required, which was not found"
/* If we're interactive, use (GNU) readline */
if (tty) {
PyObject *po = NULL;
- char *promptstr;
+ const char *promptstr;
char *s = NULL;
PyObject *stdin_encoding = NULL, *stdin_errors = NULL;
PyObject *stdout_encoding = NULL, *stdout_errors = NULL;
static int
compiler_visit_slice(struct compiler *c, slice_ty s, expr_context_ty ctx)
{
- char * kindname = NULL;
+ const char * kindname = NULL;
switch (s->kind) {
case Index_kind:
kindname = "index";
#ifdef Py_HASH_STATS
int i;
Py_ssize_t total = 0;
- char *fmt = "%2i %8" PY_FORMAT_SIZE_T "d %8" PY_FORMAT_SIZE_T "d\n";
+ const char *fmt = "%2i %8" PY_FORMAT_SIZE_T "d %8" PY_FORMAT_SIZE_T "d\n";
fprintf(stderr, "len calls total\n");
for (i = 1; i <= Py_HASH_STATS_MAX; i++) {
ensure_decimal_point(char* buffer, size_t buf_size, int precision)
{
int digit_count, insert_count = 0, convert_to_exp = 0;
- char *chars_to_insert, *digits_start;
+ const char *chars_to_insert;
+ char *digits_start;
/* search for the first non-digit character */
char *p = buffer;
{
PyObject *v, *w, *errtype, *errtext;
PyObject *msg_obj = NULL;
- char *msg = NULL;
+ const char *msg = NULL;
int offset = err->offset;
errtype = PyExc_SyntaxError;