# Bug report

### Bug description:

Related bug: https://github.com/python/cpython/issues/111615
Related pull: https://github.com/python/cpython/pull/111638
Related [codes](https://github.com/python/cpython/blob/3.12/Lib/logging/config.py#L789-L804):
https://github.com/python/cpython/blob/bd0d97ce3497da35d17daa329c294f4cb87196ee/Lib/logging/config.py#L789-L804

#### reproducible example using Python 3.12.3

```python
import logging.config


def main(q):
    config = {
        'version': 1,
        'handlers': {
            'sink': {
                'class': 'logging.handlers.QueueHandler',
                'queue': q,
            },
        },
        'root': {
            'handlers': ['sink'],
        },
    }
    logging.config.dictConfig(config)


if __name__ == '__main__':
    import multiprocessing as mp
    main(mp.Manager().Queue())
    #import asyncio
    #main(asyncio.Queue())  # broken too
```

error:

```
Traceback (most recent call last):
  File "/usr/lib/python3.12/logging/config.py", line 581, in configure
    handler = self.configure_handler(handlers[name])
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/logging/config.py", line 801, in configure_handler
    raise TypeError('Invalid queue specifier %r' % qspec)
TypeError: Invalid queue specifier <AutoProxy[Queue] object, typeid 'Queue' at 0x7f8b07189d90>

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/xxx/logging-queue-handler-bug.py", line 33, in <module>
    main(mp.Manager().Queue())
  File "/home/xxx/logging-queue-handler-bug.py", line 29, in main
    logging.config.dictConfig(config)
  File "/usr/lib/python3.12/logging/config.py", line 914, in dictConfig
    dictConfigClass(config).configure()
  File "/usr/lib/python3.12/logging/config.py", line 588, in configure
    raise ValueError('Unable to configure handler '
ValueError: Unable to configure handler 'sink'
```

#### Queue classes to check for logging QueueHandler

* queue.Queue(), `<queue.Queue at 0x7fb86eeef170>`, **works**.
* multiprocessing
    - multiprocessing.Queue(), `<multiprocessing.queues.Queue at 0x7fb871790500>`, **works**.
    - multiprocessing.Manager().Queue()  `<AutoProxy[Queue] object, typeid 'Queue' at 0x7fb86ef4a840>`, **broken**.
       Its class is `multiprocessing.managers.AutoProxy[Queue]`, a subclass of `multiprocessing.managers.BaseProxy`.
* asyncio.queues.Queue() `<Queue at 0x7fb86f0be4e0 maxsize=0>`, **broken**.
* any other Queue?

#### discuss: how to fix

Check all Queue classes mentioned above in
https://github.com/python/cpython/blob/bd0d97ce3497da35d17daa329c294f4cb87196ee/Lib/logging/config.py#L792

or just focus on handling special cases: str and dict, while leaving other cases un-checked (e.g., queue.Queue, multiprocessing.queues.Queue).


### CPython versions tested on:

3.12

### Operating systems tested on:

Linux

<!-- gh-linked-prs -->
### Linked PRs
* gh-120030
* gh-120034
* gh-120035
* gh-120067
* gh-120071
* gh-120072
* gh-120090
* gh-120092
* gh-120093
* gh-120476
* gh-120531
* gh-120532
<!-- /gh-linked-prs -->

Python 3.12+ breaks backwards compatibility for logging QueueHandler with some Queue classes
This is a GitHub Issue
repo:cpython
owner:python
Title : Python 3.12+ breaks backwards compatibility for logging QueueHandler with some Queue classes
Issue date:

--- start body ---
# Bug report

### Bug description:

Related bug: https://github.com/python/cpython/issues/111615
Related pull: https://github.com/python/cpython/pull/111638
Related [codes](https://github.com/python/cpython/blob/3.12/Lib/logging/config.py#L789-L804):
https://github.com/python/cpython/blob/bd0d97ce3497da35d17daa329c294f4cb87196ee/Lib/logging/config.py#L789-L804

#### reproducible example using Python 3.12.3

```python
import logging.config


def main(q):
    config = {
        'version': 1,
        'handlers': {
            'sink': {
                'class': 'logging.handlers.QueueHandler',
                'queue': q,
            },
        },
        'root': {
            'handlers': ['sink'],
        },
    }
    logging.config.dictConfig(config)


if __name__ == '__main__':
    import multiprocessing as mp
    main(mp.Manager().Queue())
    #import asyncio
    #main(asyncio.Queue())  # broken too
```

error:

```
Traceback (most recent call last):
  File "/usr/lib/python3.12/logging/config.py", line 581, in configure
    handler = self.configure_handler(handlers[name])
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/logging/config.py", line 801, in configure_handler
    raise TypeError('Invalid queue specifier %r' % qspec)
TypeError: Invalid queue specifier <AutoProxy[Queue] object, typeid 'Queue' at 0x7f8b07189d90>

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/xxx/logging-queue-handler-bug.py", line 33, in <module>
    main(mp.Manager().Queue())
  File "/home/xxx/logging-queue-handler-bug.py", line 29, in main
    logging.config.dictConfig(config)
  File "/usr/lib/python3.12/logging/config.py", line 914, in dictConfig
    dictConfigClass(config).configure()
  File "/usr/lib/python3.12/logging/config.py", line 588, in configure
    raise ValueError('Unable to configure handler '
ValueError: Unable to configure handler 'sink'
```

#### Queue classes to check for logging QueueHandler

* queue.Queue(), `<queue.Queue at 0x7fb86eeef170>`, **works**.
* multiprocessing
    - multiprocessing.Queue(), `<multiprocessing.queues.Queue at 0x7fb871790500>`, **works**.
    - multiprocessing.Manager().Queue()  `<AutoProxy[Queue] object, typeid 'Queue' at 0x7fb86ef4a840>`, **broken**.
       Its class is `multiprocessing.managers.AutoProxy[Queue]`, a subclass of `multiprocessing.managers.BaseProxy`.
* asyncio.queues.Queue() `<Queue at 0x7fb86f0be4e0 maxsize=0>`, **broken**.
* any other Queue?

#### discuss: how to fix

Check all Queue classes mentioned above in
https://github.com/python/cpython/blob/bd0d97ce3497da35d17daa329c294f4cb87196ee/Lib/logging/config.py#L792

or just focus on handling special cases: str and dict, while leaving other cases un-checked (e.g., queue.Queue, multiprocessing.queues.Queue).


### CPython versions tested on:

3.12

### Operating systems tested on:

Linux

<!-- gh-linked-prs -->
### Linked PRs
* gh-120030
* gh-120034
* gh-120035
* gh-120067
* gh-120071
* gh-120072
* gh-120090
* gh-120092
* gh-120093
* gh-120476
* gh-120531
* gh-120532
<!-- /gh-linked-prs -->

--- end body ---
