René's URL Explorer Experiment


Title: Handle Enum when making QVariant by f03el · Pull Request #1 · MeVisLab/pythonqt · GitHub

Open Graph Title: Handle Enum when making QVariant by f03el · Pull Request #1 · MeVisLab/pythonqt

X Title: Handle Enum when making QVariant by f03el · Pull Request #1 · MeVisLab/pythonqt

Description: Moved here from https://sourceforge.net/p/pythonqt/discussion/631392/thread/bf34b51907/ Background When running some Python code from PythonQt the other day, I got a segfault in PythonQtConversion.cpp. It turned out that when an Enum based class is processed by PyObjToQVariant, it's recognised as a sequence (since it's possible to iterate over an Enum in Python), but PySequence_GetItem returns nullptr when the loop gets the value to add to the QVariantList, causing the segfault when calling PyObjToVariant with a null pointer. Unless Enums should be treated in a special way, I assume that the best is to handle them as "normal" classes. In order to do that I created a small patch that checks if val->ob_type->tp_name is "EnumMeta". I'm not sure if this is an acceptable solution, so I'm open for better ways to fix it. Python 2.7 (with enum34 installed) and 3.6 behave the same. Files Supplied files: enumtest.zip: pythonqt_run_enum_test.cpp: Minimal application that shows the problem enumtest.py: Python module with an Enum for use with the test program Minimal example Building Building the test application (very manual – I ran this on Xubuntu 18.10): g++ -fPIC -c `pkg-config --cflags Qt5Core python-3.6 PythonQt-Qt5-Python3` -o pythonqt_run_enum_test.o pythonqt_run_enum_test.cpp g++ -o pythonqt_run_enum_test pythonqt_run_enum_test.o `pkg-config --libs Qt5Core python-3.6 PythonQt-Qt5-Python3` ./pythonqt_run_enum_test Expected output Without the patch, there is a segfault when running the minimal example. With the patch applied, it outputs this: QVariant(QVariantList, (QVariant(QVariantList, (QVariant(QString, "Color"), QVariant(PythonQtObjectPtr, ))), QVariant(QVariantList, (QVariant(QString, "Enum"), QVariant(PythonQtObjectPtr, ))))) Links regarding Enum Python doc: How are Enums different? Source code of Enum

Open Graph Description: Moved here from https://sourceforge.net/p/pythonqt/discussion/631392/thread/bf34b51907/ Background When running some Python code from PythonQt the other day, I got a segfault in PythonQtConversion....

X Description: Moved here from https://sourceforge.net/p/pythonqt/discussion/631392/thread/bf34b51907/ Background When running some Python code from PythonQt the other day, I got a segfault in PythonQtConversion....

Opengraph URL: https://github.com/MeVisLab/pythonqt/pull/1

X: @github

direct link

Domain: patch-diff.githubusercontent.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:4c0136a1-3231-647a-d7ab-8cdfe89928c7
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id8328:168170:42BE29:573393:697654C7
html-safe-nonce3471a3bec2e4da63b00ef3bdf318da67d4d1eb60bd3c96eefcf279cd9604fb0a
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MzI4OjE2ODE3MDo0MkJFMjk6NTczMzkzOjY5NzY1NEM3IiwidmlzaXRvcl9pZCI6IjgyMDE0NDU2OTIyMjA1Mjc4MTUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmacd57d3a91b4ab06f1a9bd8077a3ea52e27d8d4dd77af4ae79b164a6a75c425ea0
hovercard-subject-tagpull_request:292049212
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/MeVisLab/pythonqt/pull/1/files
twitter:imagehttps://avatars.githubusercontent.com/u/1366789?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/1366789?s=400&v=4
og:image:altMoved here from https://sourceforge.net/p/pythonqt/discussion/631392/thread/bf34b51907/ Background When running some Python code from PythonQt the other day, I got a segfault in PythonQtConversion....
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None032152924a283b83384255d9489e7b93b54ba01da8d380b05ecd3953b3212411
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/MeVisLab/pythonqt git https://github.com/MeVisLab/pythonqt.git
octolytics-dimension-user_id15028021
octolytics-dimension-user_loginMeVisLab
octolytics-dimension-repository_id193056137
octolytics-dimension-repository_nwoMeVisLab/pythonqt
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id193056137
octolytics-dimension-repository_network_root_nwoMeVisLab/pythonqt
turbo-body-classeslogged-out env-production page-responsive
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release5b577f6be6482e336e3c30e8daefa30144947b17
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://patch-diff.githubusercontent.com/MeVisLab/pythonqt/pull/1/files#start-of-content
https://patch-diff.githubusercontent.com/
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2FMeVisLab%2Fpythonqt%2Fpull%2F1%2Ffiles
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%2FMeVisLab%2Fpythonqt%2Fpull%2F1%2Ffiles
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%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=MeVisLab%2Fpythonqt
Reloadhttps://patch-diff.githubusercontent.com/MeVisLab/pythonqt/pull/1/files
Reloadhttps://patch-diff.githubusercontent.com/MeVisLab/pythonqt/pull/1/files
Reloadhttps://patch-diff.githubusercontent.com/MeVisLab/pythonqt/pull/1/files
MeVisLab https://patch-diff.githubusercontent.com/MeVisLab
pythonqthttps://patch-diff.githubusercontent.com/MeVisLab/pythonqt
Notifications https://patch-diff.githubusercontent.com/login?return_to=%2FMeVisLab%2Fpythonqt
Fork 110 https://patch-diff.githubusercontent.com/login?return_to=%2FMeVisLab%2Fpythonqt
Star 291 https://patch-diff.githubusercontent.com/login?return_to=%2FMeVisLab%2Fpythonqt
Code https://patch-diff.githubusercontent.com/MeVisLab/pythonqt
Issues 18 https://patch-diff.githubusercontent.com/MeVisLab/pythonqt/issues
Pull requests 3 https://patch-diff.githubusercontent.com/MeVisLab/pythonqt/pulls
Discussions https://patch-diff.githubusercontent.com/MeVisLab/pythonqt/discussions
Actions https://patch-diff.githubusercontent.com/MeVisLab/pythonqt/actions
Security 0 https://patch-diff.githubusercontent.com/MeVisLab/pythonqt/security
Insights https://patch-diff.githubusercontent.com/MeVisLab/pythonqt/pulse
Code https://patch-diff.githubusercontent.com/MeVisLab/pythonqt
Issues https://patch-diff.githubusercontent.com/MeVisLab/pythonqt/issues
Pull requests https://patch-diff.githubusercontent.com/MeVisLab/pythonqt/pulls
Discussions https://patch-diff.githubusercontent.com/MeVisLab/pythonqt/discussions
Actions https://patch-diff.githubusercontent.com/MeVisLab/pythonqt/actions
Security https://patch-diff.githubusercontent.com/MeVisLab/pythonqt/security
Insights https://patch-diff.githubusercontent.com/MeVisLab/pythonqt/pulse
Sign up for GitHub https://patch-diff.githubusercontent.com/signup?return_to=%2FMeVisLab%2Fpythonqt%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://patch-diff.githubusercontent.com/login?return_to=%2FMeVisLab%2Fpythonqt%2Fissues%2Fnew%2Fchoose
f03elhttps://patch-diff.githubusercontent.com/f03el
MeVisLab:masterhttps://patch-diff.githubusercontent.com/MeVisLab/pythonqt/tree/master
f03el:handle-enum-when-making-qvarianthttps://patch-diff.githubusercontent.com/f03el/pythonqt/tree/handle-enum-when-making-qvariant
Conversation 4 https://patch-diff.githubusercontent.com/MeVisLab/pythonqt/pull/1
Commits 1 https://patch-diff.githubusercontent.com/MeVisLab/pythonqt/pull/1/commits
Checks 0 https://patch-diff.githubusercontent.com/MeVisLab/pythonqt/pull/1/checks
Files changed https://patch-diff.githubusercontent.com/MeVisLab/pythonqt/pull/1/files
Please reload this pagehttps://patch-diff.githubusercontent.com/MeVisLab/pythonqt/pull/1/files
Handle Enum when making QVariant https://patch-diff.githubusercontent.com/MeVisLab/pythonqt/pull/1/files#top
Show all changes 1 commit https://patch-diff.githubusercontent.com/MeVisLab/pythonqt/pull/1/files
1d8c105 Handle Enum when making QVariant Jun 26, 2019 https://patch-diff.githubusercontent.com/MeVisLab/pythonqt/pull/1/commits/1d8c10501946f1bf16e342253a0a54742d3accad
Clear filters https://patch-diff.githubusercontent.com/MeVisLab/pythonqt/pull/1/files
Please reload this pagehttps://patch-diff.githubusercontent.com/MeVisLab/pythonqt/pull/1/files
Please reload this pagehttps://patch-diff.githubusercontent.com/MeVisLab/pythonqt/pull/1/files
src/PythonQtConversion.cpphttps://patch-diff.githubusercontent.com/MeVisLab/pythonqt/pull/1/files#diff-ed50abd612067bd826960bcb0f69890ec789e646dd43a2ad8cdc0fd496fd89c7
View file https://patch-diff.githubusercontent.com/f03el/pythonqt/blob/1d8c10501946f1bf16e342253a0a54742d3accad/src/PythonQtConversion.cpp
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://patch-diff.githubusercontent.com/MeVisLab/pythonqt/pull/1/{{ revealButtonHref }}
https://patch-diff.githubusercontent.com/MeVisLab/pythonqt/pull/1/files#diff-ed50abd612067bd826960bcb0f69890ec789e646dd43a2ad8cdc0fd496fd89c7
https://patch-diff.githubusercontent.com/MeVisLab/pythonqt/pull/1/files#diff-ed50abd612067bd826960bcb0f69890ec789e646dd43a2ad8cdc0fd496fd89c7
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.