Skip to content

Commit

Permalink
Fix deprecation warning in PyArg_ParseTuple().
Browse files Browse the repository at this point in the history
  • Loading branch information
GrahamDumpleton committed Feb 13, 2021
1 parent 5ef3989 commit 2c9d1b3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions docs/release-notes/version-4.8.0.rst
Expand Up @@ -55,6 +55,11 @@ Bugs Fixed
opens up security holes with the potential for user code to run as the
``root`` user when Python is initialized.

* Fix a Python deprecation warning for ``PyArg_ParseTuple()`` which would
cause the process to crash when deprecation warnings were turned on
globally for an application. Crash was occuring whenever anything was
output to Apache error log via ``print()``.

Features Changed
----------------

Expand Down
4 changes: 2 additions & 2 deletions src/server/wsgi_logger.c
Expand Up @@ -223,7 +223,7 @@ static PyObject *Log_isatty(LogObject *self, PyObject *args)
return Py_False;
}

static void Log_queue(LogObject *self, const char *msg, int len)
static void Log_queue(LogObject *self, const char *msg, Py_ssize_t len)
{
const char *p = NULL;
const char *q = NULL;
Expand Down Expand Up @@ -330,7 +330,7 @@ static void Log_queue(LogObject *self, const char *msg, int len)
static PyObject *Log_write(LogObject *self, PyObject *args)
{
const char *msg = NULL;
int len = -1;
Py_ssize_t len = -1;

WSGIThreadInfo *thread_info = NULL;

Expand Down
2 changes: 2 additions & 0 deletions src/server/wsgi_python.h
Expand Up @@ -21,6 +21,8 @@

/* ------------------------------------------------------------------------- */

#define PY_SSIZE_T_CLEAN 1

#include <Python.h>

#if !defined(PY_VERSION_HEX)
Expand Down

0 comments on commit 2c9d1b3

Please sign in to comment.