Skip to content

Fix invisible character typo #123933

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 11, 2024
Merged

Fix invisible character typo #123933

merged 1 commit into from
Sep 11, 2024

Conversation

xyb
Copy link
Contributor

@xyb xyb commented Sep 11, 2024

Remove accidental addition of zero-width character (U+FEFF) in #118622, reported by @jaraco:

The character can be found by:

❯ rg '\ufeff'
Lib/zipfile/_path/__init__.py
283:    If the zipfile has no filename, such attributes are not

The character has been removed and can no longer be found in the cpython repository.

Additionally, @jaraco has requested a new feature in ruff to detect invisible characters in the future (astral-sh/ruff#13297). Since cpython uses ruff for linting, this feature will prevent similar issues from occurring in the future.

Remove accidental addition of zero-width character (U+FEFF) reported by @jaraco:
- python@c3f4a6b#commitcomment-146456562
@xyb
Copy link
Contributor Author

xyb commented Sep 11, 2024

@jaraco I also took the time to investigate the GitHub pull request's "Files changed" page, where I noticed that the HTML included the invisible character, although it wasn't explicitly displayed.

Screenshot 2024-09-11 at 13 39 58

I believe it would be beneficial to suggest a feature to the GitHub development team to improve the visibility of invisible characters in code difference pages, making it easier for developers to identify and address these issues.

Update:
Ooh, in fact, there's already a long-standing feature request to GitHub, dating back to 2022, highlighting the need for this capability: https://github.com/orgs/community/discussions/10966

@jaraco
Copy link
Member

jaraco commented Sep 11, 2024

Thanks @xyb. I was planning to let the fix in zipp to make its way here naturally, but I'm also happy to have this fixed here sooner.

@jaraco jaraco merged commit e9eedf1 into python:main Sep 11, 2024
37 checks passed
@jaraco
Copy link
Member

jaraco commented Sep 11, 2024

Since cpython uses ruff for linting

I don't think it's the case that CPython uses ruff for linting. in fact, I don't think any linters are used. It's only the case that zipp uses ruff for linting and the code is subsequently merged into CPython.

@aisk
Copy link
Contributor

aisk commented Sep 11, 2024

FYI, we can show the invisible characters in the git commit history using cat -A:

$ git show 572b48f7f2dd8ef795417f08f2cd70b2140e3446 | cat -A
diff --git a/Lib/zipfile/_path/__init__.py b/Lib/zipfile/_path/__init__.py$
index 5079db90648..c0e53e273cf 100644$
--- a/Lib/zipfile/_path/__init__.py$
+++ b/Lib/zipfile/_path/__init__.py$
@@ -280,7 +280,7 @@ class Path:$
     >>> str(path.parent)$
     'mem'$
 $
-    If the zipfile has no filename, such M-oM-;M-?attributes are not$
+    If the zipfile has no filename, such attributes are not$
     valid and accessing them will raise an Exception.$
 $
     >>> zf.filename = None$

@AlexWaygood
Copy link
Member

I don't think it's the case that CPython uses ruff for linting. in fact, I don't think any linters are used.

We use some specific Ruff rules on some specific areas of the CPython codebase. But we do not currently run Ruff on any parts of the standard library (and I think it would have to be extensively discussed before we did so). See https://github.com/python/cpython/blob/main/.pre-commit-config.yaml for details.

@xyb xyb deleted the fixtypo branch September 11, 2024 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants