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-105059: Fix MSCV compiler warning on PyObject union by vstinner · Pull Request #107239 · python/cpython

Conversation

@vstinner

@vstinner vstinner commented Jul 25, 2023 •
edited by bedevere-bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

Use pragma to ignore the MSCV compiler warning on the PyObject nameless union.

  • Issue: object.h uses an anonymous union in a struct (older C incompatible) #105059

Sorry, something went wrong.

Uh oh!

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

All reactions
@vstinner
pythongh-105059: Fix MSCV compiler warning on PyObject union
996c372
Use pragma to ignore the MSCV compiler warning on the PyObject
nameless union.
@bedevere-bot bedevere-bot mentioned this pull request Jul 25, 2023
object.h uses an anonymous union in a struct (older C incompatible) #105059
Closed
@bedevere-bot bedevere-bot added the awaiting core review label Jul 25, 2023
@vstinner vstinner added skip news needs backport to 3.12 only security fixes and removed awaiting core review labels Jul 25, 2023
@vstinner

vstinner commented Jul 25, 2023

Copy link
Copy Markdown
Member Author

@zooba: Would you be able to check if this change fix the compiler warning for you? These warnings: #105059 (comment)

All reactions

Sorry, something went wrong.

Uh oh!

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

@vstinner

vstinner commented Jul 25, 2023

Copy link
Copy Markdown
Member Author

I managed to reproduce the issue with this repro.c file:

#include <Python.h>
int main () {
    return 0;
}

I open the "Developer Command Prompt", go Python source code directory, and type cl /c /I Include /I PC /W4 repro.c.

Output on the main branch:

Microsoft (R) C/C++ Optimizing Compiler Version 19.36.32537 for x86
Copyright (C) Microsoft Corporation.  All rights reserved.

repro.c
C:\victor\python\main\Include\object.h(178): warning C4201: nonstandard extension used: nameless struct/union
C:\victor\python\main\Include\cpython/unicodeobject.h(199): warning C4100: '_unused_op': unreferenced formal parameter
C:\victor\python\main\Include\cpython/unicodeobject.h(387): warning C4100: '_unused_op': unreferenced formal parameter

=> The warning C4201: nonstandard extension used: nameless struct/union warning is there.

Output with my PR:

Microsoft (R) C/C++ Optimizing Compiler Version 19.36.32537 for x86
Copyright (C) Microsoft Corporation.  All rights reserved.

repro.c
C:\victor\python\main\Include\cpython/unicodeobject.h(199): warning C4100: '_unused_op': unreferenced formal parameter
C:\victor\python\main\Include\cpython/unicodeobject.h(387): warning C4100: '_unused_op': unreferenced formal parameter

=> The waning is gone!

All reactions

Sorry, something went wrong.

Uh oh!

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

@vstinner
vstinner merged commit 1c8fe9b into python:main Jul 25, 2023
@vstinner
vstinner deleted the incref_pragram branch July 25, 2023 14:45
@miss-islington

miss-islington commented Jul 25, 2023

Copy link
Copy Markdown
Contributor

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

All reactions

Sorry, something went wrong.

Uh oh!

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

@bedevere-bot

bedevere-bot commented Jul 25, 2023

Copy link
Copy Markdown

GH-107248 is a backport of this pull request to the 3.12 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.12 only security fixes label Jul 25, 2023
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jul 25, 2023
@vstinner @miss-islington
pythongh-105059: Fix MSCV compiler warning on PyObject union (pythonG…
28447e3
…H-107239)

Use pragma to ignore the MSCV compiler warning on the PyObject
nameless union.
(cherry picked from commit 1c8fe9b)

Co-authored-by: Victor Stinner <[email protected]>
@bedevere-bot

bedevere-bot commented Jul 25, 2023

Copy link
Copy Markdown

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot x86 Gentoo Installed with X 3.x has failed when building commit 1c8fe9b.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/all/#builders/464/builds/5113) and take a look at the build logs.
  4. Check if the failure is related to this commit (1c8fe9b) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/all/#builders/464/builds/5113

Failed tests:

  • test.test_asyncio.test_subprocess

Failed subtests:

  • test_subprocess_consistent_callbacks - test.test_asyncio.test_subprocess.SubprocessThreadedWatcherTests.test_subprocess_consistent_callbacks

Summary of the results of the build (if available):

== Tests result: FAILURE then FAILURE ==

429 tests OK.

1 test failed:
test.test_asyncio.test_subprocess

17 tests skipped:
test.test_asyncio.test_windows_events
test.test_asyncio.test_windows_utils test_asdl_parser test_clinic
test_devpoll test_gdb test_generated_cases test_ioctl test_kqueue
test_launcher test_perf_profiler test_startfile test_winconsoleio
test_winreg test_winsound test_wmi test_zipfile64

1 re-run test:
test.test_asyncio.test_subprocess

Total duration: 8 min 58 sec

Click to see traceback logs
Traceback (most recent call last):
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.installed/build/target/lib/python3.13/test/test_asyncio/test_subprocess.py", line 788, in test_subprocess_consistent_callbacks
    self.loop.run_until_complete(main())
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.installed/build/target/lib/python3.13/asyncio/base_events.py", line 664, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.installed/build/target/lib/python3.13/test/test_asyncio/test_subprocess.py", line 780, in main
    self.assertEqual(events, [
AssertionError: Lists differ: ['process_exited', ('pipe_data_received', 1, b'stdout')] != [('pipe_data_received', 1, b'stdout'), ('p[95 chars]ted']

All reactions

Sorry, something went wrong.

Uh oh!

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

@vstinner vstinner mentioned this pull request Jul 25, 2023
Implement Py_UNUSED() for Windows MSVC compiler #107249
Closed
vstinner added a commit that referenced this pull request Jul 25, 2023
@miss-islington @vstinner
[3.12] gh-105059: Fix MSCV compiler warning on PyObject union (GH-107239
9c31d94
) (#107248)

gh-105059: Fix MSCV compiler warning on PyObject union (GH-107239)

Use pragma to ignore the MSCV compiler warning on the PyObject
nameless union.
(cherry picked from commit 1c8fe9b)

Co-authored-by: Victor Stinner <[email protected]>
jtcave pushed a commit to jtcave/cpython that referenced this pull request Jul 27, 2023
@vstinner @jtcave
pythongh-105059: Fix MSCV compiler warning on PyObject union (python#…
ae56016
…107239)

Use pragma to ignore the MSCV compiler warning on the PyObject
nameless union.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

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

Assignees

No one assigned

Labels

skip news

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.

3 participants

@vstinner @miss-islington @bedevere-bot
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.