-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
[Enum] minor fixes and cleanup #110905
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
Comments
I don't see a problem with your example. >>> class X:
... ___x = 1
...
>>> X._X___x
1
>>> X.___x
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: type object 'X' has no attribute '___x'. Did you mean: '_X___x'?
|
The comparison of str and list is indeed buggy. It looks like bug + bug equals no bug. |
Indeed - a self-cancelling bug! Or a bug and an anti-bug... hmm. Anyway, the correct fix is just to remove that line. |
The docs about private variables. |
Documentation: https://docs.python.org/3/tutorial/classes.html?highlight=private%20variable#private-variables: Any identifier of the form |
(cherry picked from commit a77180e) Co-authored-by: Pieter Eendebak <[email protected]>
(cherry picked from commit a77180e) Co-authored-by: Pieter Eendebak <[email protected]>
Closing the issue as the problem is resolved on the main branch. There are open PRs with backports to 3.11 and 3.12, but those are nice-to-have (can be closed afaic). |
@ethanfurman Will you merge the backport PR? |
Still considering. |
Closed the backports without merging. |
Uh oh!
There was an error while loading. Please reload this page.
Bug report
Bug description:
The
_is_private
method has incorrect results on attributes starting with a triple underscore. Example:The relevant code is:
The check
name[pat_len:pat_len+1] != ['_']
is alwaysFalse
, sincename[pat_len:pat_len+1]
is astr
and['_']
a list.CPython versions tested on:
CPython main branch
Operating systems tested on:
Windows
Linked PRs
The text was updated successfully, but these errors were encountered: