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 — gh-75223: Deprecate undotted extensions in `mimetypes.MimeTypes.add_type` by hugovk · Pull Request #128638 · python/cpython

Conversation

@hugovk

@hugovk hugovk commented Jan 8, 2025 •
edited by github-actions Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

As suggested by @encukou at #2895 (comment), we should deprecate this before raising a backwards-incompatible ValueError.

This PR is the first step to add a deprecation warning.

  • Issue: mimetypes.add_type should complain when you give it an undotted ext #75223

📚 Documentation preview 📚: https://cpython-previews--128638.org.readthedocs.build/

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
OddBloke and others added 15 commits September 10, 2019 09:33
@OddBloke
Add a test for mimetypes.add_type
2e6a0e5
@OddBloke
bpo-31040: Reject undotted extensions in mimetypes.add_type
1485be9
Extensions that don't start with a dot will never be found by
methods/functions that act on the registry, so we should stop users from
mistakenly adding them.

The one exception is the empty string extension.  This could be in use
to detect absent extensions, so instead of raising a ValueError we emit
a warning.
@arhadthedev
Address the review
f0c1bf7
@arhadthedev
Merge branch 'main' into fix-for-31040
0d9bec2
@hugovk
Merge branch 'main' into fix-for-31040
2f23267
@hugovk
Assert output first, expected result second; link to method in news
ef5cf14
@hugovk
Assert adding MIME type with empty extension emits no warning
bac8d5d
@hugovk
Assert exception message when adding MIME type with undotted extension
e177398
@hugovk
Remove unused import
094f69b
@hugovk
Fix Sphinx reference; replace bpo with gh-issue
cbc5421
@hugovk
Replace with more useful test case
41d4e89
@hugovk
Improve wording: avoid triple negative
50179cf
@hugovk
Fix news filename
352811b
@hugovk
Merge remote-tracking branch 'upstream/main' into deprecate-undotted-…
c79666b
…mimetypes
@hugovk
Deprecate undotted extensions in mimetypes.add_type
e3b2ee9
@hugovk
hugovk requested a review from a team as a code owner January 8, 2025 15:11
@bedevere-app bedevere-app Bot mentioned this pull request Jan 8, 2025
mimetypes.add_type should complain when you give it an undotted ext #75223
Closed
@bedevere-app bedevere-app Bot added the awaiting core review label Jan 8, 2025
@hugovk hugovk mentioned this pull request Jan 8, 2025
gh-75223: Reject undotted extensions in mimetypes.add_type() #2895
Closed
hugovk added 3 commits February 7, 2025 23:43
@hugovk
Merge branch 'main' into 3.14-deprecate-undotted-mimetypes
6f8eed7
@hugovk
Merge branch 'main' into 3.14-deprecate-undotted-mimetypes
43b37b7
@hugovk
Merge branch 'main' into 3.14-deprecate-undotted-mimetypes
8118997
@python-cla-bot

python-cla-bot Bot commented Apr 18, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

CLA signed

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

encukou
encukou approved these changes Apr 28, 2025
View reviewed changes

@encukou encukou left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thank you!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

hugovk reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
Comment thread Lib/mimetypes.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting core review labels Apr 28, 2025
hugovk and others added 2 commits April 28, 2025 16:56
@hugovk @encukou
Remove some info
0799253
Co-authored-by: Petr Viktorin <[email protected]>
@hugovk
Merge branch 'main' into 3.14-deprecate-undotted-mimetypes
f703411
@hugovk
hugovk enabled auto-merge (squash) April 28, 2025 13:57
@hugovk
hugovk merged commit ee9102a into python:main Apr 28, 2025
@hugovk
hugovk deleted the 3.14-deprecate-undotted-mimetypes branch April 28, 2025 14:24
@bedevere-app bedevere-app Bot removed the awaiting merge label Apr 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@encukou encukou encukou approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@hugovk @encukou @OddBloke @arhadthedev
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.