René's URL Explorer Experiment


Title: gcurve/gdots constructor ignores size= (writes a dead _size; the derived property reports the default) · Issue #287 · vpython/vpython-jupyter · GitHub

Open Graph Title: gcurve/gdots constructor ignores size= (writes a dead _size; the derived property reports the default) · Issue #287 · vpython/vpython-jupyter

X Title: gcurve/gdots constructor ignores size= (writes a dead _size; the derived property reports the default) · Issue #287 · vpython/vpython-jupyter

Description: gcurve(size=…) / gdots(size=…) is silently ignored: the constructed object keeps the default radius and the browser is sent the default size of 6, whatever the caller asked for. Setting .size after construction works, and so does radius=...

Open Graph Description: gcurve(size=…) / gdots(size=…) is silently ignored: the constructed object keeps the default radius and the browser is sent the default size of 6, whatever the caller asked for. Setting .size after...

X Description: gcurve(size=…) / gdots(size=…) is silently ignored: the constructed object keeps the default radius and the browser is sent the default size of 6, whatever the caller asked for. Setting .size after...

Opengraph URL: https://github.com/vpython/vpython-jupyter/issues/287

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"gcurve/gdots constructor ignores size= (writes a dead _size; the derived property reports the default)","articleBody":"`gcurve(size=…)` / `gdots(size=…)` is silently ignored: the constructed object keeps the default radius and the browser is sent the default `size` of 6, whatever the caller asked for. Setting `.size` **after** construction works, and so does `radius=` in the constructor — only the constructor's `size=` is lost.\n\n```python\nfrom vpython import *\ng = graph()\nd = gdots(graph=g, size=8, color=color.blue)\nprint(d.size)      # 6   — expected 8\nd.size = 8\nprint(d.size)      # 8   — the setter is fine\n```\n\n### Cause\n\n`gobj.size` is a *derived* property backed by `_radius` (`vpython/vpython.py:2207-2212`):\n\n```python\n@property\ndef size(self): return 2*self._radius\n@size.setter\ndef size(self, val):\n    self._radius = val/2\n    self.addattr('radius')\n```\n\nBut `gobj.setup`'s scalar-argument loop (`vpython/vpython.py:2168-2174`) writes the private name directly, bypassing the property:\n\n```python\nfor a, val in args.items():\n    argsToSend.append(a)\n    if a == 'graph':\n        val = val.idx\n    setattr(self, '_' + a, val)          # size=8  ->  self._size = 8\n```\n\n`self._size` is a dead attribute — nothing in the package reads it. The send loop immediately below then reads back through the property:\n\n```python\nfor a in argsToSend:\n    ...\n    aval = getattr(self, a)              # getattr(self,'size') -> 2*self._radius -> 6\n    cmd[a] = aval\n```\n\nso `size: 6` goes on the wire and `_size` is never consulted again. Minimal demonstration:\n\n```python\nclass Fake:\n    def __init__(self): self._radius = 3\n    @property\n    def size(self): return 2*self._radius\n    @size.setter\n    def size(self, val): self._radius = val/2\n\no = Fake()\nsetattr(o, '_size', 8)        # what gobj.setup does\no._size                       # 8   (dead)\ngetattr(o, 'size')            # 6   \u003c-- what is sent\n```\n\n`radius=8` works for the same reason in reverse: `_radius` *is* the real backing attribute, so `setattr(self, '_radius', 8)` lands in the right slot and `getattr(self, 'radius')` reads it back.\n\n### Scope\n\nI swept every `@property` in the `gobj` class body (lines 2122-2338) for getters that are not simply `return self._\u003cname>`. **`size` is the only one**, so this looks like a single-attribute bug rather than a pattern — but the *mechanism* (`setattr(self, '_' + a, val)` against a derived property) would bite any future attribute defined the same way, which is the part worth guarding.\n\nNot verified beyond `gobj`: other classes have their own `setup` methods with the same `setattr(self, '_' + a, val)` idiom and their own derived `size`/`axis` properties (e.g. `vpython.py:815`, `:1205`, `:1322`, `:1623`), where size and axis interact. Those may be fine — the interaction is handled explicitly there — but they are the same shape.\n\n### Suggested fix\n\nIn `gobj.setup`'s scalar loop, route through the property when one exists, or special-case the derived name:\n\n```python\nfor a, val in args.items():\n    argsToSend.append(a)\n    if a == 'graph':\n        val = val.idx\n    if a == 'size':                       # derived: backed by _radius, not _size\n        self._radius = val/2\n    else:\n        setattr(self, '_' + a, val)\n```\n\nSetting `_radius` directly rather than calling the public setter is deliberate: the `size` setter also calls `addattr('radius')`, and `addattr` spins on `baseObj.sent` (`vpython.py:305-308`). During construction that is at best redundant — the value is already going out in this constructor's own `cmd` — and on a single-threaded host (Pyodide/wasm) a spin-wait inside a constructor is a deadlock rather than a delay.\n\nHappy to open a PR. Two questions if you have a preference:\n\n1. Special-case `size`, or make the loop property-aware in general (`if isinstance(getattr(type(self), a, None), property)`)? The general form guards the mechanism; the special case is smaller and cannot surprise anything else.\n2. Should the other `setup` implementations with derived `size`/`axis` get the same audit in the same change, or separately?\n\n### How it surfaced\n\nFound while adopting this package to run Web VPython under Pyodide in a Web Worker for [trinket](https://github.com/PICUP-Physics/trinket-oss). Trinket's existing bridge bypasses `gobj.setup` entirely (it forwards constructor kwargs straight to the GlowScript object), so `gdots(size=8)` works there today and stops working when the real package is used — which is how a long-standing bug turned up as an apparent regression. Nothing about the worker or the transport is involved; the wire package carries `size: 6` on the notebook path too.\n","author":{"url":"https://github.com/sspickle","@type":"Person","name":"sspickle"},"datePublished":"2026-08-10T21:59:46Z","url":"https://github.com/vpython/vpython-jupyter/issues/287"}

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:5634d934-0896-eef0-b644-e62a59ce5a40
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idE3BC:2E2180:61FC:8615:6B007D05
html-safe-nonce523d50a05c54c7295892aa4ccbb95dcb235dae604a444af334e42be6bc5a4c0c
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFM0JDOjJFMjE4MDo2MUZDOjg2MTU6NkIwMDdEMDUiLCJ2aXNpdG9yX2lkIjoiNjk0NDk1NDUzNDUxNDk0OTM4MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmaca053428c6618b5bbd9de8823f0917694f964a277a7b31332b2fd6bb93b8665ab
hovercard-subject-tagissue:5114708751
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/vpython/vpython-jupyter/287/issue_layout
twitter:imagehttps://opengraph.githubassets.com/cb4bc5ddb5bf8be5f83debd0202b1b6426e57e897f1ac077410bf6916a206fb3/vpython/vpython-jupyter/issues/287
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/cb4bc5ddb5bf8be5f83debd0202b1b6426e57e897f1ac077410bf6916a206fb3/vpython/vpython-jupyter/issues/287
og:image:altgcurve(size=…) / gdots(size=…) is silently ignored: the constructed object keeps the default radius and the browser is sent the default size of 6, whatever the caller asked for. Setting .size after...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamesspickle
hostnamegithub.com
expected-hostnamegithub.com
None82c186f13e104004ab7bdb779f3195e59dd38bfde531aaa74b76470fc2462b83
turbo-cache-controlno-preview
go-importgithub.com/vpython/vpython-jupyter git https://github.com/vpython/vpython-jupyter.git
octolytics-dimension-user_id1280757
octolytics-dimension-user_loginvpython
octolytics-dimension-repository_id187905226
octolytics-dimension-repository_nwovpython/vpython-jupyter
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id187905226
octolytics-dimension-repository_network_root_nwovpython/vpython-jupyter
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
released1bc2aa1939001689f5ce935982c10a6138f745c
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/vpython/vpython-jupyter/issues/287#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fvpython%2Fvpython-jupyter%2Fissues%2F287
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%2Fvpython%2Fvpython-jupyter%2Fissues%2F287
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=vpython%2Fvpython-jupyter
Reloadhttps://github.com/vpython/vpython-jupyter/issues/287
Reloadhttps://github.com/vpython/vpython-jupyter/issues/287
Reloadhttps://github.com/vpython/vpython-jupyter/issues/287
vpythonhttps://github.com/vpython
vpython-jupyterhttps://github.com/vpython/vpython-jupyter
Codehttps://github.com/vpython/vpython-jupyter
Issues26 (26)https://github.com/vpython/vpython-jupyter/issues
Pull requests4 (4)https://github.com/vpython/vpython-jupyter/pulls
Actionshttps://github.com/vpython/vpython-jupyter/actions
Projectshttps://github.com/vpython/vpython-jupyter/projects
Security and qualityhttps://github.com/vpython/vpython-jupyter/security
Insightshttps://github.com/vpython/vpython-jupyter/insights
https://github.com/vpython/vpython-jupyter
New issuehttps://github.com/login?return_to=https://github.com/vpython/vpython-jupyter/issues/287
New issuehttps://github.com/login?return_to=https://github.com/vpython/vpython-jupyter/issues/287
#290https://github.com/vpython/vpython-jupyter/pull/290
gcurve/gdots constructor ignores size= (writes a dead _size; the derived property reports the default)https://github.com/vpython/vpython-jupyter/issues/287#top
#290https://github.com/vpython/vpython-jupyter/pull/290
https://github.com/sspickle
sspicklehttps://github.com/sspickle
on Aug 10, 2026https://github.com/vpython/vpython-jupyter/issues/287#issue-5114708751
trinkethttps://github.com/PICUP-Physics/trinket-oss
sspicklehttps://github.com/sspickle
on Aug 15, 2026https://github.com/vpython/vpython-jupyter/issues/287#event-29498376523
fix(graph): gcurve/gdots constructor honours size= (#287)https://github.com/vpython/vpython-jupyter/commit/6bc244cd784b168d6a633c84b9b0f935d5359cca
#287https://github.com/vpython/vpython-jupyter/issues/287
6bc244chttps://github.com/vpython/vpython-jupyter/commit/6bc244cd784b168d6a633c84b9b0f935d5359cca
Merge pull request #290 from vpython/fix/gobj-size-derivedhttps://github.com/vpython/vpython-jupyter/commit/438adeeb047c8fe5b70824395553c12b97cb0cee
#290https://github.com/vpython/vpython-jupyter/pull/290
438adeehttps://github.com/vpython/vpython-jupyter/commit/438adeeb047c8fe5b70824395553c12b97cb0cee
sspicklehttps://github.com/sspickle
completedhttps://github.com/vpython/vpython-jupyter/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#290https://github.com/vpython/vpython-jupyter/pull/290
on Aug 15, 2026https://github.com/vpython/vpython-jupyter/issues/287#event-29501188434
Sign up for freehttps://github.com/signup?return_to=https://github.com/vpython/vpython-jupyter/issues/287
Sign in to commenthttps://github.com/login?return_to=https://github.com/vpython/vpython-jupyter/issues/287
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.