René's URL Explorer Experiment


Title: warnings raised by test_peg_generator when setuptools_scm is installed · Issue #133509 · python/cpython · GitHub

Open Graph Title: warnings raised by test_peg_generator when setuptools_scm is installed · Issue #133509 · python/cpython

X Title: warnings raised by test_peg_generator when setuptools_scm is installed · Issue #133509 · python/cpython

Description: Bug report Bug description: Hi, since #131802, we see test_peg_generator failing with the following warning: Warning -- logging._handlerList was modified by test_peg_generator Warning -- Before: (140617884985088, [

Open Graph Description: Bug report Bug description: Hi, since #131802, we see test_peg_generator failing with the following warning: Warning -- logging._handlerList was modified by test_peg_generator Warning -- Before: (1...

X Description: Bug report Bug description: Hi, since #131802, we see test_peg_generator failing with the following warning: Warning -- logging._handlerList was modified by test_peg_generator Warning -- Before: (1...

Opengraph URL: https://github.com/python/cpython/issues/133509

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"warnings raised by test_peg_generator when setuptools_scm is installed","articleBody":"# Bug report\n\n### Bug description:\n\nHi, since #131802, we see `test_peg_generator` failing with the following warning:\n```\nWarning -- logging._handlerList was modified by test_peg_generator\nWarning --   Before: (140617884985088, [\u003cweakref at 0x7fe4271c8720; to 'logging._StderrHandler' at 0x7fe427ceb620\u003e, \u003cweakref at 0x7fe421d4d350; to 'setuptools_scm._log.AlwaysStdErrHandler' at 0x7fe420b25fd0\u003e], [\u003cweakref at 0x7fe4271c8720; to 'logging._StderrHandler' at 0x7fe427ceb620\u003e])\nWarning --   After:  (140617884985088, [\u003cweakref at 0x7fe4271c8720; to 'logging._StderrHandler' at 0x7fe427ceb620\u003e, \u003cweakref at 0x7fe421d4d350; to 'setuptools_scm._log.AlwaysStdErrHandler' at 0x7fe420b25fd0\u003e], [\u003cweakref at 0x7fe4271c8720; to 'logging._StderrHandler' at 0x7fe427ceb620\u003e, \u003cweakref at 0x7fe421d4d350; to 'setuptools_scm._log.AlwaysStdErrHandler' at 0x7fe420b25fd0\u003e])\n```\n\nFor some reason, during the execution, second reference to the same 'setuptools_scm._log.AlwaysStdErrHandler' appears in the `_handlerList`.\n\nWhen I remove `setuptools_scm`, the issue is gone.\n\nInterestingly (at least to me), when I revert changes done in #131802 in `lib/test/support/__init__.py` and `os_helper.py` (commenting out `import logging` is enough), the issue is gone as well, so it seems like some weird side effect of the import?\n\nI tried to track the issue and got through setuptools all the way to `ep.load()` in `finalize_options()` which triggers the issue (see trace below).\n\nI added some debug prints to `_addHandlerRef` function, and it's apparently called only once with this handler. Though I also see a single call for the `logging._StderrHandler'` and it's there twice as well, so I am probably overlooking something...\n\nHere is the trace from when the handler ref is being added during the test execution:\n```pytb\n.....\n  File \"/build/cpython-3.13/Lib/test/test_peg_generator/test_c_parser.py\", line 131, in build_extension\n    generate_parser_c_extension(grammar, Path('.'), library_dir=self.library_dir)\n  File \"/build/cpython-3.13/Tools/peg_generator/pegen/testutil.py\", line 107, in generate_parser_c_extension\n    compile_c_extension(\n  File \"/build/cpython-3.13/Tools/peg_generator/pegen/build.py\", line 160, in compile_c_extension\n    dist = Distribution({\"name\": extension_name, \"ext_modules\": [extension]})\n  File \"/usr/lib/python3.13/vendor-packages/setuptools/dist.py\", line 323, in __init__\n    _Distribution.__init__(self, dist_attrs)\n  File \"/usr/lib/python3.13/vendor-packages/setuptools/_distutils/dist.py\", line 309, in __init__\n    self.finalize_options()\n  File \"/usr/lib/python3.13/vendor-packages/setuptools/dist.py\", line 787, in finalize_options\n    for ep in sorted(loaded, key=by_order):\n  File \"/usr/lib/python3.13/vendor-packages/setuptools/dist.py\", line 786, in \u003clambda\u003e\n    loaded = map(lambda e: e.load(), filtered)\n  File \"/build/cpython-3.13/Lib/importlib/metadata/__init__.py\", line 179, in load\n    module = import_module(match.group('module'))\n  File \"/build/cpython-3.13/Lib/importlib/__init__.py\", line 88, in import_module\n    return _bootstrap._gcd_import(name[level:], package, level)\n  File \"\u003cfrozen importlib._bootstrap\u003e\", line 1387, in _gcd_import\n  File \"\u003cfrozen importlib._bootstrap\u003e\", line 1360, in _find_and_load\n  File \"\u003cfrozen importlib._bootstrap\u003e\", line 1310, in _find_and_load_unlocked\n  File \"\u003cfrozen importlib._bootstrap\u003e\", line 488, in _call_with_frames_removed\n  File \"\u003cfrozen importlib._bootstrap\u003e\", line 1387, in _gcd_import\n  File \"\u003cfrozen importlib._bootstrap\u003e\", line 1360, in _find_and_load\n  File \"\u003cfrozen importlib._bootstrap\u003e\", line 1310, in _find_and_load_unlocked\n  File \"\u003cfrozen importlib._bootstrap\u003e\", line 488, in _call_with_frames_removed\n  File \"\u003cfrozen importlib._bootstrap\u003e\", line 1387, in _gcd_import\n  File \"\u003cfrozen importlib._bootstrap\u003e\", line 1360, in _find_and_load\n  File \"\u003cfrozen importlib._bootstrap\u003e\", line 1331, in _find_and_load_unlocked\n  File \"\u003cfrozen importlib._bootstrap\u003e\", line 935, in _load_unlocked\n  File \"\u003cfrozen importlib._bootstrap_external\u003e\", line 1026, in exec_module\n  File \"\u003cfrozen importlib._bootstrap\u003e\", line 488, in _call_with_frames_removed\n  File \"/usr/lib/python3.13/vendor-packages/setuptools_scm/__init__.py\", line 8, in \u003cmodule\u003e\n    from ._config import DEFAULT_LOCAL_SCHEME\n  File \"\u003cfrozen importlib._bootstrap\u003e\", line 1360, in _find_and_load\n  File \"\u003cfrozen importlib._bootstrap\u003e\", line 1331, in _find_and_load_unlocked\n  File \"\u003cfrozen importlib._bootstrap\u003e\", line 935, in _load_unlocked\n  File \"\u003cfrozen importlib._bootstrap_external\u003e\", line 1026, in exec_module\n  File \"\u003cfrozen importlib._bootstrap\u003e\", line 488, in _call_with_frames_removed\n  File \"/usr/lib/python3.13/vendor-packages/setuptools_scm/_config.py\", line 15, in \u003cmodule\u003e\n    from . import _log\n  File \"\u003cfrozen importlib._bootstrap\u003e\", line 1415, in _handle_fromlist\n  File \"\u003cfrozen importlib._bootstrap\u003e\", line 488, in _call_with_frames_removed\n  File \"\u003cfrozen importlib._bootstrap\u003e\", line 1360, in _find_and_load\n  File \"\u003cfrozen importlib._bootstrap\u003e\", line 1331, in _find_and_load_unlocked\n  File \"\u003cfrozen importlib._bootstrap\u003e\", line 935, in _load_unlocked\n  File \"\u003cfrozen importlib._bootstrap_external\u003e\", line 1026, in exec_module\n  File \"\u003cfrozen importlib._bootstrap\u003e\", line 488, in _call_with_frames_removed\n  File \"/usr/lib/python3.13/vendor-packages/setuptools_scm/_log.py\", line 48, in \u003cmodule\u003e\n    _default_handler = make_default_handler()\n  File \"/usr/lib/python3.13/vendor-packages/setuptools_scm/_log.py\", line 43, in make_default_handler\n    handler = AlwaysStdErrHandler()\n  File \"/usr/lib/python3.13/vendor-packages/setuptools_scm/_log.py\", line 23, in __init__\n    super().__init__(sys.stderr)\n  File \"/build/cpython-3.13/Lib/logging/__init__.py\", line 1128, in __init__\n    Handler.__init__(self)\n  File \"/build/cpython-3.13/Lib/logging/__init__.py\", line 941, in __init__\n    _addHandlerRef(self)\n```\n\nAll this is with Python 3.13 (latest changes), setuptools 80.3.1, setuptools_scm 8.3.1, and on Oracle Solaris, but I don't think this is necessarily platform dependent.\n\nI also reproduced this with older setuptools 73.0.1 and setuptools_scm 8.1.0.\n\n### CPython versions tested on:\n\n3.13\n\n### Operating systems tested on:\n\nOther","author":{"url":"https://github.com/kulikjak","@type":"Person","name":"kulikjak"},"datePublished":"2025-05-06T12:06:09.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":16},"url":"https://github.com/133509/cpython/issues/133509"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:9f9375e2-0d22-2b2d-eb1e-dc7e80fd6b61
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idE916:25EC2E:2ED4087:3F16094:6A53C26E
html-safe-nonceb77eb5983f8885bcf24fcf7d830037510a2dc5680b7982d9e63d15d9b391495f
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFOTE2OjI1RUMyRToyRUQ0MDg3OjNGMTYwOTQ6NkE1M0MyNkUiLCJ2aXNpdG9yX2lkIjoiNDU4ODY1MjkxODA1NjY2NTcxMCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac35aa0f0bfab62af510648e3ed4e1eb9969d2f2f5f33ff5b73b2cf9b79a15f0c8
hovercard-subject-tagissue:3042609779
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/133509/issue_layout
twitter:imagehttps://opengraph.githubassets.com/7332ebd407d3e17f68ad89bb637cf6a8aec3ae71dc4df677641ee3f650e3260a/python/cpython/issues/133509
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/7332ebd407d3e17f68ad89bb637cf6a8aec3ae71dc4df677641ee3f650e3260a/python/cpython/issues/133509
og:image:altBug report Bug description: Hi, since #131802, we see test_peg_generator failing with the following warning: Warning -- logging._handlerList was modified by test_peg_generator Warning -- Before: (1...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamekulikjak
hostnamegithub.com
expected-hostnamegithub.com
Noneb9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb
turbo-cache-controlno-preview
go-importgithub.com/python/cpython git https://github.com/python/cpython.git
octolytics-dimension-user_id1525981
octolytics-dimension-user_loginpython
octolytics-dimension-repository_id81598961
octolytics-dimension-repository_nwopython/cpython
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id81598961
octolytics-dimension-repository_network_root_nwopython/cpython
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release07a982c1d40157c619b364352b704c3ce66bb332
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/cpython/issues/133509#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F133509
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F133509
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=python%2Fcpython
Reloadhttps://github.com/python/cpython/issues/133509
Reloadhttps://github.com/python/cpython/issues/133509
Reloadhttps://github.com/python/cpython/issues/133509
Please reload this pagehttps://github.com/python/cpython/issues/133509
python https://github.com/python
cpythonhttps://github.com/python/cpython
Please reload this pagehttps://github.com/python/cpython/issues/133509
Notifications https://github.com/login?return_to=%2Fpython%2Fcpython
Fork 35k https://github.com/login?return_to=%2Fpython%2Fcpython
Star 73.8k https://github.com/login?return_to=%2Fpython%2Fcpython
Code https://github.com/python/cpython
Issues 5k+ https://github.com/python/cpython/issues
Pull requests 2.3k https://github.com/python/cpython/pulls
Actions https://github.com/python/cpython/actions
Projects https://github.com/python/cpython/projects
Security and quality 0 https://github.com/python/cpython/security
Insights https://github.com/python/cpython/pulse
Code https://github.com/python/cpython
Issues https://github.com/python/cpython/issues
Pull requests https://github.com/python/cpython/pulls
Actions https://github.com/python/cpython/actions
Projects https://github.com/python/cpython/projects
Security and quality https://github.com/python/cpython/security
Insights https://github.com/python/cpython/pulse
warnings raised by test_peg_generator when setuptools_scm is installedhttps://github.com/python/cpython/issues/133509#top
invalidhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22invalid%22
https://github.com/kulikjak
kulikjakhttps://github.com/kulikjak
on May 6, 2025https://github.com/python/cpython/issues/133509#issue-3042609779
#131802https://github.com/python/cpython/pull/131802
#131802https://github.com/python/cpython/pull/131802
invalidhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22invalid%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.