René's URL Explorer Experiment


Title: Context variables shared between code don't work with greenlet > 0.4.17 · Issue #852 · bpython/bpython · GitHub

Open Graph Title: Context variables shared between code don't work with greenlet > 0.4.17 · Issue #852 · bpython/bpython

X Title: Context variables shared between code don't work with greenlet > 0.4.17 · Issue #852 · bpython/bpython

Description: greenlet 0.4.17 introduced support for ContextVars. It seems the result of this, is that the following code no longer works in bpython: >>> import contextvars >>> help = contextvars.ContextVar("helpme") >>> token = help.set("value") >>> ...

Open Graph Description: greenlet 0.4.17 introduced support for ContextVars. It seems the result of this, is that the following code no longer works in bpython: >>> import contextvars >>> help = contextvars.ContextVar("hel...

X Description: greenlet 0.4.17 introduced support for ContextVars. It seems the result of this, is that the following code no longer works in bpython: >>> import contextvars >>> help = contextva...

Opengraph URL: https://github.com/bpython/bpython/issues/852

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Context variables shared between code don't work with greenlet > 0.4.17","articleBody":"greenlet 0.4.17 introduced support for [ContextVars](https://github.com/python-greenlet/greenlet/blob/master/CHANGES.rst#0417-2020-09-22). \r\n\r\nIt seems the result of this, is that the following code no longer works in bpython:\r\n\r\n```\r\n>>> import contextvars\r\n>>> help = contextvars.ContextVar(\"helpme\")\r\n>>> token = help.set(\"value\")\r\n>>> help.reset(token)\r\nTraceback (most recent call last):\r\n  File \"\u003cinput>\", line 1, in \u003cmodule>\r\n    help.reset(token)\r\nValueError: \u003cToken var=\u003cContextVar name='helpme' at 0x10f84b770> at 0x10f603940> was created in a different Context\r\n```\r\n\r\nThe workaround is to put all this code in a single function\r\n\r\n```\r\n>>> def do_the_stuff():\r\n...     help = contextvars.ContextVar(\"helpme\")\r\n...     token = help.set(\"value\")\r\n...     help.reset(token)\r\n...     \r\n... \r\n>>> do_the_stuff()\r\n```\r\n\r\nI believe this might be caused because a [new greenlet is created](https://github.com/bpython/bpython/blob/3ae9b1084d4abf688d2ff659d4fbf96131029148/bpython/curtsiesfrontend/coderunner.py#L137) for each line of code in bpython. \r\nIs it possible for everything to run in the same context so that the repl behaviors similar to how a python script would run?\r\n","author":{"url":"https://github.com/c-py","@type":"Person","name":"c-py"},"datePublished":"2020-10-06T06:40:19Z","url":"https://github.com/bpython/bpython/issues/852"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:b0dd7e48-9a54-83a7-fb63-e182d0ef7f07
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idBBEA:3F8AB1:3F3613E:5041013:6B01FC93
html-safe-nonce35f81be25dd8084ea431bf0ae27ab440f1e1c37caeec2d19c2b37ef513802a12
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQkVBOjNGOEFCMTozRjM2MTNFOjUwNDEwMTM6NkIwMUZDOTMiLCJ2aXNpdG9yX2lkIjoiMzM0MTM0NzE1Nzc4NDUyNTk3MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac82cf2064c6b87e2bc491c5caf6b16e7a2ba7f80bb9bd1ccdbbd5a4391048ed4c
hovercard-subject-tagissue:715391203
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/bpython/bpython/852/issue_layout
twitter:imagehttps://opengraph.githubassets.com/1bffdbfce57aee4857d220b7fab1e6d9cfa4be26f9a9471e6dcd28fd19d09260/bpython/bpython/issues/852
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/1bffdbfce57aee4857d220b7fab1e6d9cfa4be26f9a9471e6dcd28fd19d09260/bpython/bpython/issues/852
og:image:altgreenlet 0.4.17 introduced support for ContextVars. It seems the result of this, is that the following code no longer works in bpython: >>> import contextvars >>> help = contextvars.ContextVar("hel...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamec-py
hostnamegithub.com
expected-hostnamegithub.com
None87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456
turbo-cache-controlno-preview
go-importgithub.com/bpython/bpython git https://github.com/bpython/bpython.git
octolytics-dimension-user_id8071396
octolytics-dimension-user_loginbpython
octolytics-dimension-repository_id21508865
octolytics-dimension-repository_nwobpython/bpython
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id21508865
octolytics-dimension-repository_network_root_nwobpython/bpython
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
release423dbb54c5e7bfecc838eb387c1435eb3d0e760d
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/bpython/bpython/issues/852#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fbpython%2Fbpython%2Fissues%2F852
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
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
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://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
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fbpython%2Fbpython%2Fissues%2F852
Sign uphttps://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=bpython%2Fbpython
Reloadhttps://github.com/bpython/bpython/issues/852
Reloadhttps://github.com/bpython/bpython/issues/852
Reloadhttps://github.com/bpython/bpython/issues/852
bpythonhttps://github.com/bpython
bpythonhttps://github.com/bpython/bpython
Codehttps://github.com/bpython/bpython
Issues126 (126)https://github.com/bpython/bpython/issues
Pull requests6 (6)https://github.com/bpython/bpython/pulls
Actionshttps://github.com/bpython/bpython/actions
Projectshttps://github.com/bpython/bpython/projects
Wikihttps://github.com/bpython/bpython/wiki
Security and qualityhttps://github.com/bpython/bpython/security
Insightshttps://github.com/bpython/bpython/insights
https://github.com/bpython/bpython
New issuehttps://github.com/login?return_to=https://github.com/bpython/bpython/issues/852
New issuehttps://github.com/login?return_to=https://github.com/bpython/bpython/issues/852
#1062https://github.com/bpython/bpython/pull/1062
Context variables shared between code don't work with greenlet > 0.4.17https://github.com/bpython/bpython/issues/852#top
#1062https://github.com/bpython/bpython/pull/1062
bughttps://github.com/bpython/bpython/issues?q=state%3Aopen%20label%3A%22bug%22
requires-separate-processhttps://github.com/bpython/bpython/issues?q=state%3Aopen%20label%3A%22requires-separate-process%22
https://github.com/c-py
c-pyhttps://github.com/c-py
on Oct 6, 2020https://github.com/bpython/bpython/issues/852#issue-715391203
ContextVarshttps://github.com/python-greenlet/greenlet/blob/master/CHANGES.rst#0417-2020-09-22
new greenlet is createdhttps://github.com/bpython/bpython/blob/3ae9b1084d4abf688d2ff659d4fbf96131029148/bpython/curtsiesfrontend/coderunner.py#L137
sebastinashttps://github.com/sebastinas
bughttps://github.com/bpython/bpython/issues?q=state%3Aopen%20label%3A%22bug%22
requires-separate-processhttps://github.com/bpython/bpython/issues?q=state%3Aopen%20label%3A%22requires-separate-process%22
on Oct 6, 2020https://github.com/bpython/bpython/issues/852#event-3845177867
https://github.com/nhairs
nhairshttps://github.com/nhairs
on Oct 20, 2023https://github.com/bpython/bpython/issues/852#issuecomment-1772314813
https://greenlet.readthedocs.io/en/latest/contextvars.htmlhttps://greenlet.readthedocs.io/en/latest/contextvars.html
goransh-waliahttps://github.com/goransh-walia
on Nov 14, 2026https://github.com/bpython/bpython/issues/852#event-36114723603
fix: Context variables shared between code don't work with greenl (bp…https://github.com/goransh-walia/bpython/commit/d613024bf1db204dfef2e1d06de8eb2f06fa82c5
bp…https://github.com/bpython/bpython/issues/852
d613024https://github.com/goransh-walia/bpython/commit/d613024bf1db204dfef2e1d06de8eb2f06fa82c5
sebastinashttps://github.com/sebastinas
on Nov 14, 2026https://github.com/bpython/bpython/issues/852#event-36140371259
fix: Context variables shared between code don't work with greenl (#852)https://github.com/bpython/bpython/commit/f6e4b405ea0b02a0fbf40bed06fec795619f63be
#852https://github.com/bpython/bpython/issues/852
f6e4b40https://github.com/bpython/bpython/commit/f6e4b405ea0b02a0fbf40bed06fec795619f63be
sebastinashttps://github.com/sebastinas
completedhttps://github.com/bpython/bpython/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#1062https://github.com/bpython/bpython/pull/1062
on Nov 14, 2026https://github.com/bpython/bpython/issues/852#event-36140371941
Sign up for freehttps://github.com/signup?return_to=https://github.com/bpython/bpython/issues/852
Sign in to commenthttps://github.com/login?return_to=https://github.com/bpython/bpython/issues/852
bughttps://github.com/bpython/bpython/issues?q=state%3Aopen%20label%3A%22bug%22
requires-separate-processhttps://github.com/bpython/bpython/issues?q=state%3Aopen%20label%3A%22requires-separate-process%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.