New GitHub issue #110875 from he-dev:<br>

<hr>

<pre>
# Bug report

### Bug description:

When the library tries to initialize a formatter and comes across the old `format` property, it falls back to an error handler, but before it does that, it pops the `.` dicationary from the `config` making it impossible to process it later during the second call to `self.configure_custom(config)`

https://github.com/python/cpython/blob/main/Lib/logging/config.py#L480

This is whrere `configure_custom` calls `props = config.pop('.', None)`, but it does that before `result = c(**kwargs)` which throws an exception when it finds the `format` property.

```python
    def configure_custom(self, config):
        """Configure an object with a user-supplied factory."""
        c = config.pop('()')
        if not callable(c):
 c = self.resolve(c)
        props = config.pop('.', None)
 # Check for valid identifiers
        kwargs = {k: config[k] for k in config if valid_ident(k)}
        result = c(**kwargs)
        if props:
 for name, value in props.items():
                setattr(result, name, value)
        return result
```

Then then initialization continues here inside the `except` that call `configure_custom` for the second time, but this time without the `.` in the `config` so it's skipped.

https://github.com/python/cpython/blob/main/Lib/logging/config.py#L670

```python
 def configure_formatter(self, config):
        """Configure a formatter from a dictionary."""
        if '()' in config:
 factory = config['()'] # for use in exception handler
            try:
 result = self.configure_custom(config)
            except TypeError as te:
                if "'format'" not in str(te):
 raise
                #Name of parameter changed from fmt to format.
                #Retry with old name.
                #This is so that code can be used with older Python versions
                #(e.g. by Django)
                config['fmt'] = config.pop('format')
 config['()'] = factory
                result = self.configure_custom(config)
```

I guess the function `configure_custom` should call `props = config.pop('.', None)` after `result = c(**kwargs)` so that the `.` remains in the `config` for the second call in case an exception is thrown during the first try.


### CPython versions tested on:

3.10

### Operating systems tested on:

Windows
</pre>

<hr>

<a href="https://github.com/python/cpython/issues/110875">View on GitHub</a>
<p>Labels: type-bug</p>
<p>Assignee: </p>