Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-105059: Fix MSCV compiler warning on PyObject union #107239

Merged
merged 1 commit into from
Jul 25, 2023

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Jul 25, 2023

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

Use pragma to ignore the MSCV compiler warning on the PyObject
nameless union.
@vstinner
Copy link
Member Author

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

@vstinner
Copy link
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!

@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
Copy link
Contributor

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

@bedevere-bot
Copy link

GH-107248 is a backport of this pull request to the 3.12 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.12 bug and security fixes label Jul 25, 2023
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jul 25, 2023
…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
Copy link

⚠️⚠️⚠️ 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']

vstinner added a commit that referenced this pull request Jul 25, 2023
) (#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
…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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants