René's URL Explorer Experiment


Title: bpo-38250: [Enum] single-bit flags are canonical by ethanfurman · Pull Request #24215 · python/cpython · GitHub

Open Graph Title: bpo-38250: [Enum] single-bit flags are canonical by ethanfurman · Pull Request #24215 · python/cpython

X Title: bpo-38250: [Enum] single-bit flags are canonical by ethanfurman · Pull Request #24215 · python/cpython

Description: Flag members are now divided by one-bit verses multi-bit, with multi-bit being treated as aliases. Iterating over a flag only returns the contained single-bit flags. Iterating, repr(), and str() show members in definition order. When constructing combined-member flags, any extra integer values are either discarded (CONFORM), turned into ints (EJECT) or treated as errors (STRICT). Flag classes can specify which of those three behaviors is desired: >>> class Test(Flag, boundary=CONFORM): ... ONE = 1 ... TWO = 2 ... >>> Test(5) Besides the three above behaviors, there is also KEEP, which should not be used unless necessary -- for example, _convert_ specifies KEEP as there are flag sets in the stdlib that are incomplete and/or inconsistent (e.g. ssl.Options). KEEP will, as the name suggests, keep all bits; however, iterating over a flag with extra bits will only return the canonical flags contained, not the extra bits. https://bugs.python.org/issue38250

Open Graph Description: Flag members are now divided by one-bit verses multi-bit, with multi-bit being treated as aliases. Iterating over a flag only returns the contained single-bit flags. Iterating, repr(), and str() s...

X Description: Flag members are now divided by one-bit verses multi-bit, with multi-bit being treated as aliases. Iterating over a flag only returns the contained single-bit flags. Iterating, repr(), and str() s...

Opengraph URL: https://github.com/python/cpython/pull/24215

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:6d7761ee-7819-7424-33b4-c682c8ced2d0
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id857E:16ACC6:98F5C:D9D07:6A50EBB2
html-safe-nonce620922c3fc14b4e41e072542e0d9727ea8491ec144e4228279c2a65d74c65a68
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NTdFOjE2QUNDNjo5OEY1QzpEOUQwNzo2QTUwRUJCMiIsInZpc2l0b3JfaWQiOiI1OTgwNjgxOTgyMjQ1Mzk5NDc0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac0ac5fd8b403b2df3883dc5848117b0639e8c4ff0764e99c88f5db7b2195f782d
hovercard-subject-tagpull_request:554585401
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/python/cpython/pull/24215/files
twitter:imagehttps://avatars.githubusercontent.com/u/7659890?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/7659890?s=400&v=4
og:image:altFlag members are now divided by one-bit verses multi-bit, with multi-bit being treated as aliases. Iterating over a flag only returns the contained single-bit flags. Iterating, repr(), and str() s...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None72b13e0e8d0319acdd27a145cfe73f4f06c791713d0ac4690e41fb68ad28cac0
turbo-cache-controlno-preview
diff-viewunified
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 full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasefb19d617b534959801b4b7453938ecf1dfa22131
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/cpython/pull/24215/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F24215%2Ffiles
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%2Fpull%2F24215%2Ffiles
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%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=python%2Fcpython
Reloadhttps://github.com/python/cpython/pull/24215/files
Reloadhttps://github.com/python/cpython/pull/24215/files
Reloadhttps://github.com/python/cpython/pull/24215/files
Please reload this pagehttps://github.com/python/cpython/pull/24215/files
python https://github.com/python
cpythonhttps://github.com/python/cpython
Please reload this pagehttps://github.com/python/cpython/pull/24215/files
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
Sign up for GitHub https://github.com/signup?return_to=%2Fpython%2Fcpython%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fpython%2Fcpython%2Fissues%2Fnew%2Fchoose
ethanfurmanhttps://github.com/ethanfurman
python:masterhttps://github.com/python/cpython/tree/master
ethanfurman:enum-single_bit_flagshttps://github.com/ethanfurman/cpython/tree/enum-single_bit_flags
Conversation 75 https://github.com/python/cpython/pull/24215
Commits 30 https://github.com/python/cpython/pull/24215/commits
Checks 0 https://github.com/python/cpython/pull/24215/checks
Files changed https://github.com/python/cpython/pull/24215/files
Please reload this pagehttps://github.com/python/cpython/pull/24215/files
bpo-38250: [Enum] single-bit flags are canonical https://github.com/python/cpython/pull/24215/files#top
Show all changes 30 commits https://github.com/python/cpython/pull/24215/files
5f522d3 [Enum] fix Flag iteration, repr(), and str() ethanfurman Jan 13, 2021 https://github.com/python/cpython/pull/24215/commits/5f522d38139dc6d9bd7781500f811016b683b66f
f7f9e72 add boundary KEEP for Flags (default for _convert_) ethanfurman Jan 14, 2021 https://github.com/python/cpython/pull/24215/commits/f7f9e728e123dcaecccda0a96d4cdff6cce5bd01
d289ba3 update re.RegexFlag for new Flag implementation ethanfurman Jan 14, 2021 https://github.com/python/cpython/pull/24215/commits/d289ba3e0551ae7a7c8cdbec0e445764812a03e3
72dbdd7 remove extra white space ethanfurman Jan 14, 2021 https://github.com/python/cpython/pull/24215/commits/72dbdd70f88781c898cf7bac2af94584a94f169f
210fae7 test that zero-valued members are empty ethanfurman Jan 14, 2021 https://github.com/python/cpython/pull/24215/commits/210fae7fbf4ba3d3ab3e1a356a3a9542321a3fb8
48bcd07 update tests to confirm CONFORM with negate ethanfurman Jan 14, 2021 https://github.com/python/cpython/pull/24215/commits/48bcd07c3738bc5db889068af8525f911aa39df7
1fd7471 update aenum.rst; add doctest to test_enum ethanfurman Jan 14, 2021 https://github.com/python/cpython/pull/24215/commits/1fd7471f351be3e477a52ded6a2303612cd0d06e
aa425e6 fix doc test ethanfurman Jan 14, 2021 https://github.com/python/cpython/pull/24215/commits/aa425e6de2670e3a67b63e63c8ace521a0343f7b
4786942 optimizations ethanfurman Jan 14, 2021 https://github.com/python/cpython/pull/24215/commits/4786942ead0a4c0d95093476861ee8dfa99470d0
45565b2 formatting ethanfurman Jan 14, 2021 https://github.com/python/cpython/pull/24215/commits/45565b248ec416a17c58715fdf126b87a6441c21
806c8c6 add news entry ethanfurman Jan 14, 2021 https://github.com/python/cpython/pull/24215/commits/806c8c62f14483a2e19e35e9b45b7e15005cce4f
668c9a9 fix formatting of news entry ethanfurman Jan 15, 2021 https://github.com/python/cpython/pull/24215/commits/668c9a9d14e5c6495ea75abf762c9e3a6e5d0167
9bd9e97 update iteration method and order ethanfurman Jan 20, 2021 https://github.com/python/cpython/pull/24215/commits/9bd9e97469c5592d43973bf3e93ea9a39f5298e1
18bcbac add John Belmonte ethanfurman Jan 20, 2021 https://github.com/python/cpython/pull/24215/commits/18bcbacaab7026eadf3550eb8fab9fa7439d3dc8
f1c4584 more bit-fiddling improvements ethanfurman Jan 20, 2021 https://github.com/python/cpython/pull/24215/commits/f1c45843b7e36f3dbfa2e0f323279c45c8cf2dbf
e3713aa use pop() instead of "del" ethanfurman Jan 20, 2021 https://github.com/python/cpython/pull/24215/commits/e3713aaceb7238d79496f3c21cc4051abe9d1c33
c4ec211 update DynamicClassAttribute __doc__ ethanfurman Jan 20, 2021 https://github.com/python/cpython/pull/24215/commits/c4ec21165c88c7034bb019e06acbc332e8534250
00b2bfe remove formatting changes ethanfurman Jan 20, 2021 https://github.com/python/cpython/pull/24215/commits/00b2bfe72474edac387108aef80b7b69b5efd40b
9f432c3 remove extra parens ethanfurman Jan 20, 2021 https://github.com/python/cpython/pull/24215/commits/9f432c3358cc0db3e09be584c9a97aaa705ac878
15c060a remove formatting changes ethanfurman Jan 20, 2021 https://github.com/python/cpython/pull/24215/commits/15c060a2245c201f87371617e067768c296cc7b9
86d7669 remove formatting ethanfurman Jan 20, 2021 https://github.com/python/cpython/pull/24215/commits/86d76698c1fcae2b6bc7ef876300710615995841
55915df simplify determination of member iteration ethanfurman Jan 22, 2021 https://github.com/python/cpython/pull/24215/commits/55915df64a7c5e5e7051162de8bb14ec1570a678
95bf9c8 add note about next auto() value for Enum and Flag ethanfurman Jan 25, 2021 https://github.com/python/cpython/pull/24215/commits/95bf9c84aa79e4198e779290a96a1eba35dc2c68
41ac1ce local name optimizations ethanfurman Jan 25, 2021 https://github.com/python/cpython/pull/24215/commits/41ac1cecf1677e86e582183c114185e0b3cee484
3ea814e remove commented-out code ethanfurman Jan 25, 2021 https://github.com/python/cpython/pull/24215/commits/3ea814e21c2a8f2e0d010faaf4615ee67563246a
4983558 add test for next auto() and _order_ ethanfurman Jan 25, 2021 https://github.com/python/cpython/pull/24215/commits/4983558af7b1d14d12eeea038b2f63811bc4c354
651da18 raise TypeError if _value_ not added in custom new ethanfurman Jan 25, 2021 https://github.com/python/cpython/pull/24215/commits/651da184f1ae6ff5c067a658130473fb13e09422
6e99d48 enable doc tests, update formatting ethanfurman Jan 25, 2021 https://github.com/python/cpython/pull/24215/commits/6e99d485737c71bef77abb8979c607dc6f38024c
b52c5a2 fix note ethanfurman Jan 25, 2021 https://github.com/python/cpython/pull/24215/commits/b52c5a2d8aef05914ead91e2f0404b54c6187f5b
8d7b272 Update 2021-01-14-15-07-16.bpo-38250.1fvhOk.rst ethanfurman Jan 25, 2021 https://github.com/python/cpython/pull/24215/commits/8d7b2724fbec9eaa670dcfe3f7a942f31494cc5c
Clear filters https://github.com/python/cpython/pull/24215/files
Please reload this pagehttps://github.com/python/cpython/pull/24215/files
Please reload this pagehttps://github.com/python/cpython/pull/24215/files
enum.rst https://github.com/python/cpython/pull/24215/files#diff-4cebe6df5185cf2ebe9799ee15c1d84d0152462b1f79969d36e0e72abdc3335d
enum.py https://github.com/python/cpython/pull/24215/files#diff-e5dd6e444e4e6c2cdeb8edf271d057f9da52f7b406dcd8b655dc396fb013bd03
re.py https://github.com/python/cpython/pull/24215/files#diff-b3acb629f8cea6310bc296c20238eee20737bf70057079b4ee4624a643c2775d
test_enum.py https://github.com/python/cpython/pull/24215/files#diff-8467f9fbbff81abf26d87a8dbbf0e0c866157971948010e48cc73539251a9e4c
test_re.py https://github.com/python/cpython/pull/24215/files#diff-8e462ca5167ec7a83a5710c179ef56cbae19cd614303fbcf2ec33fd9db914e2a
types.py https://github.com/python/cpython/pull/24215/files#diff-14c8ad728bd63143566c2c1e5a85a7b20cebc910278ac9202978e845dc63f215
ACKS https://github.com/python/cpython/pull/24215/files#diff-d1243956feb505c5459fc05387e194609efb5c350cee202942be47ed30d7d7d0
2021-01-14-15-07-16.bpo-38250.1fvhOk.rst https://github.com/python/cpython/pull/24215/files#diff-dae51d0807e8a1f72c323384f6a361c0e027804d48f4dc7ae7d8716ecbe0b9fb
Doc/library/enum.rsthttps://github.com/python/cpython/pull/24215/files#diff-4cebe6df5185cf2ebe9799ee15c1d84d0152462b1f79969d36e0e72abdc3335d
View file https://github.com/ethanfurman/cpython/blob/8d7b2724fbec9eaa670dcfe3f7a942f31494cc5c/Doc/library/enum.rst
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/24215/{{ revealButtonHref }}
https://github.com/python/cpython/pull/24215/files#diff-4cebe6df5185cf2ebe9799ee15c1d84d0152462b1f79969d36e0e72abdc3335d
https://github.com/python/cpython/pull/24215/files#diff-4cebe6df5185cf2ebe9799ee15c1d84d0152462b1f79969d36e0e72abdc3335d
https://github.com/python/cpython/pull/24215/files#diff-4cebe6df5185cf2ebe9799ee15c1d84d0152462b1f79969d36e0e72abdc3335d
https://github.com/python/cpython/pull/24215/files#diff-4cebe6df5185cf2ebe9799ee15c1d84d0152462b1f79969d36e0e72abdc3335d
https://github.com/python/cpython/pull/24215/files#diff-4cebe6df5185cf2ebe9799ee15c1d84d0152462b1f79969d36e0e72abdc3335d
https://github.com/python/cpython/pull/24215/files#diff-4cebe6df5185cf2ebe9799ee15c1d84d0152462b1f79969d36e0e72abdc3335d
https://github.com/python/cpython/pull/24215/files#diff-4cebe6df5185cf2ebe9799ee15c1d84d0152462b1f79969d36e0e72abdc3335d
https://github.com/python/cpython/pull/24215/files#diff-4cebe6df5185cf2ebe9799ee15c1d84d0152462b1f79969d36e0e72abdc3335d
https://github.com/python/cpython/pull/24215/files#diff-4cebe6df5185cf2ebe9799ee15c1d84d0152462b1f79969d36e0e72abdc3335d
https://github.com/python/cpython/pull/24215/files#diff-4cebe6df5185cf2ebe9799ee15c1d84d0152462b1f79969d36e0e72abdc3335d
https://github.com/python/cpython/pull/24215/files#diff-4cebe6df5185cf2ebe9799ee15c1d84d0152462b1f79969d36e0e72abdc3335d
https://github.com/python/cpython/pull/24215/files#diff-4cebe6df5185cf2ebe9799ee15c1d84d0152462b1f79969d36e0e72abdc3335d
https://github.com/python/cpython/pull/24215/files#diff-4cebe6df5185cf2ebe9799ee15c1d84d0152462b1f79969d36e0e72abdc3335d
https://github.com/python/cpython/pull/24215/files#diff-4cebe6df5185cf2ebe9799ee15c1d84d0152462b1f79969d36e0e72abdc3335d
https://github.com/python/cpython/pull/24215/files#diff-4cebe6df5185cf2ebe9799ee15c1d84d0152462b1f79969d36e0e72abdc3335d
https://github.com/python/cpython/pull/24215/files#diff-4cebe6df5185cf2ebe9799ee15c1d84d0152462b1f79969d36e0e72abdc3335d
https://github.com/python/cpython/pull/24215/files#diff-4cebe6df5185cf2ebe9799ee15c1d84d0152462b1f79969d36e0e72abdc3335d
https://github.com/python/cpython/pull/24215/files#diff-4cebe6df5185cf2ebe9799ee15c1d84d0152462b1f79969d36e0e72abdc3335d
https://github.com/python/cpython/pull/24215/files#diff-4cebe6df5185cf2ebe9799ee15c1d84d0152462b1f79969d36e0e72abdc3335d
https://github.com/python/cpython/pull/24215/files#diff-4cebe6df5185cf2ebe9799ee15c1d84d0152462b1f79969d36e0e72abdc3335d
https://github.com/python/cpython/pull/24215/files#diff-4cebe6df5185cf2ebe9799ee15c1d84d0152462b1f79969d36e0e72abdc3335d
https://github.com/python/cpython/pull/24215/files#diff-4cebe6df5185cf2ebe9799ee15c1d84d0152462b1f79969d36e0e72abdc3335d
Please reload this pagehttps://github.com/python/cpython/pull/24215/files
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.