Skip to content

Commit

Permalink
Eliminate invalid log object errors due to GC changes in Python 3.13.
Browse files Browse the repository at this point in the history
  • Loading branch information
GrahamDumpleton committed Nov 21, 2024
1 parent 0232519 commit 6421db9
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
1 change: 1 addition & 0 deletions docs/release-notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Release Notes
.. toctree::
:maxdepth: 2

release-notes/version-5.0.2
release-notes/version-5.0.1
release-notes/version-5.0.0

Expand Down
16 changes: 16 additions & 0 deletions docs/release-notes/version-5.0.2.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
=============
Version 5.0.2
=============

Version 5.0.2 of mod_wsgi can be obtained from:

https://codeload.github.com/GrahamDumpleton/mod_wsgi/tar.gz/5.0.2

Bugs Fixed
----------

* Eliminate noise in logs under Python 3.13 when Python garbage collection
decides to delay destruction of objects until a second phase, resulting in
the `wsgi.errors` log object being accessed after the request had been
completed and the log object marked as invalid. This resulted due to changes
in garbage collection behaviour in Python 3.13.
2 changes: 1 addition & 1 deletion src/server/wsgi_logger.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ static PyObject *Log_flush(LogObject *self, PyObject *args)
if (thread_info && thread_info->log_buffer)
return Log_flush((LogObject *)thread_info->log_buffer, args);

if (self->expired) {
if (self->expired && self->s) {
PyErr_SetString(PyExc_RuntimeError, "log object has expired");
return NULL;
}
Expand Down
4 changes: 2 additions & 2 deletions src/server/wsgi_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@

#define MOD_WSGI_MAJORVERSION_NUMBER 5
#define MOD_WSGI_MINORVERSION_NUMBER 0
#define MOD_WSGI_MICROVERSION_NUMBER 1
#define MOD_WSGI_VERSION_STRING "5.0.1"
#define MOD_WSGI_MICROVERSION_NUMBER 2
#define MOD_WSGI_VERSION_STRING "5.0.2"

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

Expand Down

0 comments on commit 6421db9

Please sign in to comment.