Skip to content

Commit 607485d

Browse files
committed
Support Python 3.13
1 parent 3d95fe8 commit 607485d

File tree

4 files changed

+17
-6
lines changed

4 files changed

+17
-6
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ jobs:
3535
- "3.10"
3636
- "3.11"
3737
- "3.12"
38+
- "3.13"
3839
dependencies:
3940
- ""
4041
- "colorama"
@@ -44,6 +45,7 @@ jobs:
4445
uses: "actions/setup-python@v2"
4546
with:
4647
python-version: "${{ matrix.python-version }}"
48+
allow-prereleases: true
4749
- name: "🐍 Display Python version"
4850
run: "python --version"
4951
- name: "🐍 Install dependencies"

colorlog/wrappers.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import functools
44
import logging
5+
import sys
56
import typing
67
from logging import (
78
CRITICAL,
@@ -53,8 +54,8 @@ def basicConfig(
5354
) -> None:
5455
"""Call ``logging.basicConfig`` and override the formatter it creates."""
5556
logging.basicConfig(**kwargs)
56-
logging._acquireLock() # type: ignore
57-
try:
57+
58+
def _basicConfig():
5859
handler = logging.root.handlers[0]
5960
handler.setFormatter(
6061
colorlog.formatter.ColoredFormatter(
@@ -67,8 +68,16 @@ def basicConfig(
6768
stream=kwargs.get("stream", None),
6869
)
6970
)
70-
finally:
71-
logging._releaseLock() # type: ignore
71+
72+
if sys.version_info >= (3, 13):
73+
with logging._lock:
74+
_basicConfig()
75+
else:
76+
logging._acquireLock() # type: ignore
77+
try:
78+
_basicConfig()
79+
finally:
80+
logging._releaseLock() # type: ignore
7281

7382

7483
def ensure_configured(func):

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
setup(
44
name="colorlog",
5-
version="6.8.2",
5+
version="6.8.3",
66
description="Add colours to the output of Python's logging module.",
77
long_description=open("README.md").read(),
88
long_description_content_type="text/markdown",

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tox]
2-
envlist = black,flake8,mypy,py38,py39,py310,py311,py312
2+
envlist = black,flake8,mypy,py38,py39,py310,py311,py312,py313
33

44
[testenv]
55
deps = pytest

0 commit comments

Comments
 (0)