GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-94731: Revert to C-style casts for _Py_CAST by encukou · Pull Request #94782 · python/cpython

Conversation

@encukou

@encukou encukou commented Jul 12, 2022 •
edited by bedevere-bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

This reverts some changes from #91321

  • Issue: _PyObject_CAST breaks code which assumed a static/dynamic casting #94731

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
encukou and others added 3 commits July 12, 2022 17:41
@encukou @da-woods
pythongh-94731: Add a failing test
f09b8c6
Co-Authored-By: da-woods <[email protected]>
@encukou
pythongh-94731: Use C-style casts for _Py_CAST, even in C++
3faf13d
@encukou
Add a blurb
b3b4ec8
@bedevere-bot bedevere-bot added the awaiting core review label Jul 12, 2022
@encukou encukou mentioned this pull request Jul 12, 2022
gh-91321: Add _testcppext C++ extension #32175
Merged
@encukou encukou added the needs backport to 3.11 only security fixes label Jul 12, 2022
@encukou
Also allow the -Wzero-as-null-pointer-constant warning
498e8bb
@encukou encukou mentioned this pull request Jul 13, 2022
_PyObject_CAST breaks code which assumed a static/dynamic casting #94731
Closed
@encukou encukou added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Jul 13, 2022
@bedevere-bot

bedevere-bot commented Jul 13, 2022

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @encukou for commit 498e8bb 🤖

If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Jul 13, 2022
@encukou
Workaround for C++ compilers that don't support designated initializers
b13e464
We have buildbots like that...
@encukou encukou added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Jul 13, 2022
@bedevere-bot

bedevere-bot commented Jul 13, 2022

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @encukou for commit b13e464 🤖

If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Jul 13, 2022
da-woods
da-woods reviewed Jul 13, 2022
View reviewed changes
Comment thread Lib/test/_testcppext.cpp Outdated
Comment on lines +170 to +175
PyObject *ipotype = PyType_FromSpec(&VirtualPyObject_Spec);
// no good way to signal failure from a C++ constructor, so use assert
// for error handling
assert(ipotype);
assert(PyObject_Init(this, (PyTypeObject *)ipotype));
Py_DECREF(ipotype);

@da-woods da-woods Jul 13, 2022

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
PyObject *ipotype = PyType_FromSpec(&VirtualPyObject_Spec);
// no good way to signal failure from a C++ constructor, so use assert
// for error handling
assert(ipotype);
assert(PyObject_Init(this, (PyTypeObject *)ipotype));
Py_DECREF(ipotype);
PyObject *vpotype = PyType_FromSpec(&VirtualPyObject_Spec);
// no good way to signal failure from a C++ constructor, so use assert
// for error handling
assert(vpotype);
assert(PyObject_Init(this, (PyTypeObject *)vpotype));
Py_DECREF(vpotype);

Just suggesting changing the name slightly here to match the name you used from the class. I think the i from ipotype was a hold-over from the name I used.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

encukou reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

@encukou encukou Jul 13, 2022

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! It's a local variable now so I'll just name it type :)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
encukou added 3 commits July 13, 2022 14:37
@encukou
Rename the type variable (ipotype was a hold-over from the original r…
c6945f1
…eproducer)
@encukou
Punt on C++ sanitizing builds for now
713bf7d
@encukou
Make the skip work if PY_CFLAGS is not set
021c03d
@encukou encukou added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Jul 13, 2022
@bedevere-bot

bedevere-bot commented Jul 13, 2022

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @encukou for commit 021c03d 🤖

If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Jul 13, 2022
@encukou
encukou merged commit 6cbb57f into python:main Jul 14, 2022
@bedevere-bot bedevere-bot removed the awaiting core review label Jul 14, 2022
@miss-islington

miss-islington commented Jul 14, 2022

Copy link
Copy Markdown
Contributor

Thanks @encukou for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11.
🐍🍒⛏🤖

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@encukou
encukou deleted the c-style-cast branch July 14, 2022 09:57
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jul 14, 2022
@encukou @miss-islington
pythongh-94731: Revert to C-style casts for _Py_CAST (pythonGH-94782)
426166c
Co-authored-by: da-woods <[email protected]>
(cherry picked from commit 6cbb57f)

Co-authored-by: Petr Viktorin <[email protected]>
@bedevere-bot

bedevere-bot commented Jul 14, 2022

Copy link
Copy Markdown

GH-94849 is a backport of this pull request to the 3.11 branch.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot bedevere-bot removed the needs backport to 3.11 only security fixes label Jul 14, 2022
encukou pushed a commit that referenced this pull request Jul 15, 2022
@miss-islington @da-woods
gh-94731: Revert to C-style casts for _Py_CAST (GH-94782) (#94849)
d9107aa
Co-authored-by: da-woods <[email protected]>
(cherry picked from commit 6cbb57f)
@vstinner vstinner mentioned this pull request Sep 22, 2022
PEP 670: Convert static inline functions to functions #97016
Closed
@vstinner vstinner mentioned this pull request Sep 17, 2026
Py_CLEAR/Py_SETREF() regression on the main branch with C++: SEGV with simple numpy program #157649
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

1 more reviewer
@da-woods da-woods da-woods left review comments
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@encukou @bedevere-bot @miss-islington @da-woods
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.