René's URL Explorer Experiment


Title: Instances of subclasses of PyLong_Type created in C extensions use Java object handles, possibly causing segmentation faults · Issue #595 · oracle/graalpython · GitHub

Open Graph Title: Instances of subclasses of PyLong_Type created in C extensions use Java object handles, possibly causing segmentation faults · Issue #595 · oracle/graalpython

X Title: Instances of subclasses of PyLong_Type created in C extensions use Java object handles, possibly causing segmentation faults · Issue #595 · oracle/graalpython

Description: With GraalPy 3.12.8 on Linux, built from source at f466f8d , subclasses of PyLong_Type created using the C API return Java handles from __new__ instead of real PyObject pointers. When an extension attempts to access an instance of the Py...

Open Graph Description: With GraalPy 3.12.8 on Linux, built from source at f466f8d , subclasses of PyLong_Type created using the C API return Java handles from __new__ instead of real PyObject pointers. When an extension ...

X Description: With GraalPy 3.12.8 on Linux, built from source at f466f8d , subclasses of PyLong_Type created using the C API return Java handles from __new__ instead of real PyObject pointers. When an extension ...

Opengraph URL: https://github.com/oracle/graalpython/issues/595

X: @github

direct link

Domain: patch-diff.githubusercontent.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Instances of subclasses of PyLong_Type created in C extensions use Java object handles, possibly causing segmentation faults","articleBody":"With GraalPy 3.12.8 on Linux, built from source at f466f8d5d9 , subclasses of `PyLong_Type` created using the C API return Java handles from `__new__` instead of real `PyObject` pointers. When an extension attempts to access an instance of the `PyLong_Type` subclass as a `PyObject`, it tries to dereference the Java handle, possibly causing a segmentation fault.\n\nA real example of code that can expose this bug can be seen in `boost::python`'s [`enum.cpp`](https://github.com/boostorg/python/blob/develop/src/object/enum.cpp). In the `enum_base::add_value` method, `boost::python` needs to access the `name` member of the `enum_object` `struct` it uses for the instances of the `enum_type_object`, but this fails on GraalPy. Similarly, the C example extension below attempts to access the `member` member of the `custom_object` `struct` in its `set_member` function.\n\n```c\n/* custom_pyobject.c */\n#define PY_SSIZE_T_CLEAN\n#include \u003cPython.h\u003e\n#include \u003cstddef.h\u003e\n\ntypedef struct custom_object {\n  PyLongObject base_object;\n  PyObject* member;\n} custom_object;\n\nstatic PyMemberDef custom_members[] = {\n  {\"member\", Py_T_OBJECT_EX, offsetof(custom_object, member), Py_READONLY, 0},\n  {0, 0, 0, 0, 0}\n};\n\nstatic void custom_dealloc(custom_object* self) {\n  Py_XDECREF(self-\u003emember);\n  Py_TYPE(self)-\u003etp_free((PyObject*)self);\n}\n\nstatic PyObject* custom_repr(PyObject* self_) {\n  custom_object* self = (custom_object*)self_;\n  return PyUnicode_FromFormat(\"custom_object(%S)\", PyObject_Repr(self-\u003emember));\n}\n\nstatic PyTypeObject custom_type_object = {\n  PyObject_HEAD_INIT(NULL)\n  \"custom_object\",                          /* tp_name */\n  sizeof(custom_object),                    /* tp_basicsize */\n  0,                                        /* tp_itemsize */\n  (destructor) custom_dealloc,              /* tp_dealloc */\n  0,                                        /* tp_print */\n  0,                                        /* tp_getattr */\n  0,                                        /* tp_setattr */\n  0,                                        /* tp_compare */\n  custom_repr,                              /* tp_repr */\n  0,                                        /* tp_as_number */\n  0,                                        /* tp_as_sequence */\n  0,                                        /* tp_as_mapping */\n  0,                                        /* tp_hash */\n  0,                                        /* tp_call */\n  0,                                        /* tp_str */\n  0,                                        /* tp_getattro */\n  0,                                        /* tp_setattro */\n  0,                                        /* tp_as_buffer */\n  Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */\n  0,                                        /* tp_doc */\n  0,                                        /* tp_traverse */\n  0,                                        /* tp_clear */\n  0,                                        /* tp_richcompare */\n  0,                                        /* tp_weaklistoffset */\n  0,                                        /* tp_iter */\n  0,                                        /* tp_iternext */\n  0,                                        /* tp_methods */\n  custom_members,                           /* tp_members */\n  0,                                        /* tp_getset */\n  \u0026PyLong_Type,                             /* tp_base */\n  0,                                        /* tp_dict */\n  0,                                        /* tp_descr_get */\n  0,                                        /* tp_descr_set */\n  0,                                        /* tp_dictoffset */\n  0,                                        /* tp_init */\n  0,                                        /* tp_alloc */\n  0,                                        /* tp_new */\n  0,                                        /* tp_free */\n  0,                                        /* tp_is_gc */\n  0,                                        /* tp_bases */\n  0,                                        /* tp_mro */\n  0,                                        /* tp_cache */\n  0,                                        /* tp_subclasses */\n  0,                                        /* tp_weaklist */\n  0                                         /* tp_del */\n};\n\nint custom_pyobject_mod_exec(PyObject* module) {\n  PyModule_AddType(module, \u0026custom_type_object);\n  return 0;\n}\n\nstatic PyModuleDef_Slot custom_pyobject_slots[] = {\n  {Py_mod_exec, custom_pyobject_mod_exec},\n  {0, NULL}\n};\n\nPyObject* set_member(PyObject* self, PyObject* args) {\n  PyObject* inner1;\n  PyObject* inner2;\n  if (!PyArg_ParseTuple(args, \"OO\", \u0026inner1, \u0026inner2)) {\n    return NULL;\n  }\n  custom_object* obj = (custom_object*)inner1;\n  obj-\u003emember = inner2;\n  return Py_None;\n}\n\nstatic PyMethodDef custom_pyobject_methods[] = {\n  {\"set_member\", set_member, METH_VARARGS, \"Set name.\"},\n  {NULL, NULL, 0, NULL}\n};\n\nstatic struct PyModuleDef custom_pyobject_module = {\n  .m_base = PyModuleDef_HEAD_INIT,\n  .m_name = \"custom_pyobject\",\n  .m_size = 0,\n  .m_methods = custom_pyobject_methods,\n  .m_slots = custom_pyobject_slots\n};\n\nPyMODINIT_FUNC PyInit_custom_pyobject(void) {\n  return PyModuleDef_Init(\u0026custom_pyobject_module);\n}\n```\n\nIf the code above is compiled to `custom_pyobject.so`, then the Python code below fails with a segmentation fault on GraalPy:\n\n```python\nimport custom_pyobject\nobj = custom_pyobject.custom_object(10)\ncustom_pyobject.set_member(obj, \"foo\")\nprint(obj)\n```\n\nWith CPython, the code prints `custom_object('foo')`.\n\nThe relevant discussion on Slack can be found at https://graalvm.slack.com/archives/CNA7PDH2N/p1768011927297709 .","author":{"url":"https://github.com/actapia","@type":"Person","name":"actapia"},"datePublished":"2026-01-15T20:54:38.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/595/graalpython/issues/595"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:a3ea1fcd-8602-119e-09ec-731ee2b54bc9
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id97CA:20D11F:3807B1:4F7857:696F7F5D
html-safe-nonce2f615b085e14cd984475743426a353cb2d46b85c2c0c5582e381a0559a6347c9
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5N0NBOjIwRDExRjozODA3QjE6NEY3ODU3OjY5NkY3RjVEIiwidmlzaXRvcl9pZCI6IjgyMDI3MzUxNzAyNTEzNTgwNDUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac56ec84f78921708cfdc65be2d912eb8ff7aeec23c7cd2cfefc1bf1d7c81bc655
hovercard-subject-tagissue:3819127396
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/oracle/graalpython/595/issue_layout
twitter:imagehttps://opengraph.githubassets.com/84fe4c1903b5e2f77a997021dbfc0c8dcb436eedc8589154862992933061d191/oracle/graalpython/issues/595
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/84fe4c1903b5e2f77a997021dbfc0c8dcb436eedc8589154862992933061d191/oracle/graalpython/issues/595
og:image:altWith GraalPy 3.12.8 on Linux, built from source at f466f8d , subclasses of PyLong_Type created using the C API return Java handles from __new__ instead of real PyObject pointers. When an extension ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameactapia
hostnamegithub.com
expected-hostnamegithub.com
None759c36b32159cc867ba926786bbd5ac69b0804c9cfc86536a67b3567e8bbbb5c
turbo-cache-controlno-preview
go-importgithub.com/oracle/graalpython git https://github.com/oracle/graalpython.git
octolytics-dimension-user_id4430336
octolytics-dimension-user_loginoracle
octolytics-dimension-repository_id129883600
octolytics-dimension-repository_nwooracle/graalpython
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id129883600
octolytics-dimension-repository_network_root_nwooracle/graalpython
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
release08632b85cc9aa97742e56978eb25cc43ca37e51b
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://patch-diff.githubusercontent.com/oracle/graalpython/issues/595#start-of-content
https://patch-diff.githubusercontent.com/
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Foracle%2Fgraalpython%2Fissues%2F595
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
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
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
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/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://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Foracle%2Fgraalpython%2Fissues%2F595
Sign up https://patch-diff.githubusercontent.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=oracle%2Fgraalpython
Reloadhttps://patch-diff.githubusercontent.com/oracle/graalpython/issues/595
Reloadhttps://patch-diff.githubusercontent.com/oracle/graalpython/issues/595
Reloadhttps://patch-diff.githubusercontent.com/oracle/graalpython/issues/595
oracle https://patch-diff.githubusercontent.com/oracle
graalpythonhttps://patch-diff.githubusercontent.com/oracle/graalpython
Notifications https://patch-diff.githubusercontent.com/login?return_to=%2Foracle%2Fgraalpython
Fork 140 https://patch-diff.githubusercontent.com/login?return_to=%2Foracle%2Fgraalpython
Star 1.5k https://patch-diff.githubusercontent.com/login?return_to=%2Foracle%2Fgraalpython
Code https://patch-diff.githubusercontent.com/oracle/graalpython
Issues 55 https://patch-diff.githubusercontent.com/oracle/graalpython/issues
Pull requests 5 https://patch-diff.githubusercontent.com/oracle/graalpython/pulls
Discussions https://patch-diff.githubusercontent.com/oracle/graalpython/discussions
Actions https://patch-diff.githubusercontent.com/oracle/graalpython/actions
Projects 1 https://patch-diff.githubusercontent.com/oracle/graalpython/projects
Security Uh oh! There was an error while loading. Please reload this page. https://patch-diff.githubusercontent.com/oracle/graalpython/security
Please reload this pagehttps://patch-diff.githubusercontent.com/oracle/graalpython/issues/595
Insights https://patch-diff.githubusercontent.com/oracle/graalpython/pulse
Code https://patch-diff.githubusercontent.com/oracle/graalpython
Issues https://patch-diff.githubusercontent.com/oracle/graalpython/issues
Pull requests https://patch-diff.githubusercontent.com/oracle/graalpython/pulls
Discussions https://patch-diff.githubusercontent.com/oracle/graalpython/discussions
Actions https://patch-diff.githubusercontent.com/oracle/graalpython/actions
Projects https://patch-diff.githubusercontent.com/oracle/graalpython/projects
Security https://patch-diff.githubusercontent.com/oracle/graalpython/security
Insights https://patch-diff.githubusercontent.com/oracle/graalpython/pulse
New issuehttps://patch-diff.githubusercontent.com/login?return_to=https://github.com/oracle/graalpython/issues/595
New issuehttps://patch-diff.githubusercontent.com/login?return_to=https://github.com/oracle/graalpython/issues/595
Instances of subclasses of PyLong_Type created in C extensions use Java object handles, possibly causing segmentation faultshttps://patch-diff.githubusercontent.com/oracle/graalpython/issues/595#top
https://github.com/actapia
https://github.com/actapia
actapiahttps://github.com/actapia
on Jan 15, 2026https://github.com/oracle/graalpython/issues/595#issue-3819127396
f466f8dhttps://github.com/oracle/graalpython/commit/f466f8d5d9a057c21a9a4b821970e92a29de1b9a
enum.cpphttps://github.com/boostorg/python/blob/develop/src/object/enum.cpp
https://graalvm.slack.com/archives/CNA7PDH2N/p1768011927297709https://graalvm.slack.com/archives/CNA7PDH2N/p1768011927297709
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.