GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Deprecate old backward compatible shims in configure_formatter()/handler(). · Issue #115032 · python/cpython

Deprecate old backward compatible shims in configure_formatter()/handler(). #115032

New issue
Copy link
New issue
Copy link
Closed
Closed
Deprecate old backward compatible shims in configure_formatter()/handler().#115032
Copy link
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancementA feature request or enhancement

Description

@felixxm
felixxm
opened on Feb 5, 2024
Issue body actions

Feature or enhancement

Proposal:

DictConfigurator.configure_formatter() and configure_handler() contain workarounds for old configurations

cpython/Lib/logging/config.py

Lines 670 to 676 in bcccf1f

#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)

cpython/Lib/logging/config.py

Lines 844 to 851 in bcccf1f

if "'stream'" not in str(te):
raise
#The argument name changed from strm to stream
#Retry with old name.
#This is so that code can be used with older Python versions
#(e.g. by Django)
kwargs['strm'] = kwargs.pop('stream')
result = factory(**kwargs)

Django doesn't use fmt and strm for many years. I think both can be deprecated and removed.

I'd like to prepare a patch, if accepted.

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

Linked PRs

  • gh-115032: Update DictConfigurator.configure_formatter() comment about fmt retry. #115303
  • gh-115032: Deprecate support for custom logging handlers with 'strm' argument. #115314

Activity

  1. felixxm
    added
    type-featureA feature request or enhancementA feature request or enhancement
    on Feb 5, 2024
  2. sobolevn commented on Feb 7, 2024

    @sobolevn
    sobolevn
    on Feb 7, 2024
    Member
    More actions

    cc @vsajip

    Reacted by Mariusz Felisiak
  3. hugovk
    added
    stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory
    on Feb 7, 2024
  4. vsajip commented on Feb 7, 2024

    @vsajip
    vsajip
    on Feb 7, 2024
    Member
    More actions

    I realise Django doesn't use them any more, but what about other code / users? I wouldn't strongly object to removing them, but there's a chance that any such change might need to be reverted if there are complaints that it breaks existing code somewhere. And, of course, no backporting of any such change. Perhaps deprecate, but not remove immediately - rather, in line with the usual deprecation cycle. It's just a little wart in the current code, after all.

  5. AlexWaygood
    added this to Logging issues 🪵on Feb 7, 2024
  6. felixxm commented on Feb 7, 2024

    @felixxm
    felixxm
    on Feb 7, 2024
    ContributorAuthor
    More actions

    Perhaps deprecate, but not remove immediately - rather, in line with the usual deprecation cycle.

    Yes that's what I was trying to propose. We have an existing and straightforward upgrade path i.e. use format instead of fmt and use stream instead of strm, so it seems fine to deprecate the current workarounds and remove them in 3.15 (I guess 🤔).

    It's just a little wart in the current code, after all.

    True, but they become an issue when there are dozens of such workarounds ("death by a thousand cuts").

  7. vsajip commented on Feb 7, 2024

    @vsajip
    vsajip
    on Feb 7, 2024
    Member
    More actions

    become an issue when there are dozens of such workarounds

    Well, it's not that bad IMO, but I'll look at a PR that does deprecation.

    Reacted by Mariusz Felisiak
  8. felixxm commented on Feb 11, 2024

    @felixxm
    felixxm
    on Feb 11, 2024
    ContributorAuthor
    More actions

    While preparing a patch, I noticed that we can deprecate strm, however, fmt is still needed because config is passed directly to the custom formatters and Formatter except fmt instead of format.

  9. felixxm
    added 3 commits that reference this issue on Feb 11, 2024

    pythongh-115032: Update DictConfigurator.configure_formatter() commen…

    e3a921b

    pythongh-115032: Deprecate support for custom logging handlers with '…

    fee2731

    pythongh-115032: Deprecate support for custom logging handlers with '…

    c7125ba
  10. vsajip
    added a commit that references this issue on Feb 13, 2024

    gh-115032: Update DictConfigurator.configure_formatter() comment abou…

    d823c23
  11. fsc-eriker
    added a commit that references this issue on Feb 14, 2024

    pythongh-115032: Update DictConfigurator.configure_formatter() commen…

    f32bfe3
  12. felixxm
    added a commit that references this issue on Apr 26, 2025

    pythongh-115032: Deprecate support for custom logging handlers with '…

    9f1a63e
  13. vsajip
    added a commit that references this issue on Apr 27, 2025

    gh-115032: Deprecate support for custom logging handlers with 'strm' …

    28a2fd0
  14. vsajip
    closed this as completedon May 8, 2025
  15. github-project-automation
    moved this to Done in Logging issues 🪵on May 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancementA feature request or enhancement

    Projects

    • Logging issues 🪵
      Status
      Done
      Show more project fields

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.