Skip to content

Compiler warnings when building Python 3.8 #82502

Closed

Description

@vstinner
BPO 38321
Nosy @vsajip, @vstinner, @animalize
PRs
  • bpo-38321: Fix PyCStructUnionType_update_stgdict() warning #16492
  • bpo-38321: Fix _asynciomodule.c compiler warning #16493
  • bpo-38321: Fix _testcapimodule.c warning #16494
  • bpo-38321: Fix compiler warning in _randommodule.c #16512
  • bpo-37802: Fix a compiler warning in longobject.c #16517
  • [3.8] bpo-3832: Fix compiler warnings #16518
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2019-10-01.11:55:21.297>
    created_at = <Date 2019-09-30.10:08:44.841>
    labels = ['interpreter-core', 'build', '3.8']
    title = 'Compiler warnings when building Python 3.8'
    updated_at = <Date 2019-10-01.11:55:21.296>
    user = 'https://github.com/vstinner'

    bugs.python.org fields:

    activity = <Date 2019-10-01.11:55:21.296>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2019-10-01.11:55:21.297>
    closer = 'vstinner'
    components = ['Interpreter Core']
    creation = <Date 2019-09-30.10:08:44.841>
    creator = 'vstinner'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 38321
    keywords = ['patch']
    message_count = 16.0
    messages = ['353560', '353562', '353574', '353575', '353579', '353590', '353611', '353625', '353626', '353647', '353650', '353663', '353674', '353680', '353683', '353684']
    nosy_count = 3.0
    nosy_names = ['vinay.sajip', 'vstinner', 'malin']
    pr_nums = ['16492', '16493', '16494', '16512', '16517', '16518']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'compile error'
    url = 'https://bugs.python.org/issue38321'
    versions = ['Python 3.8']

    Activity

    1. vstinner commented on Sep 30, 2019

      @vstinner
      MemberAuthor

      c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winbase.h(103): warning C4005: 'Yield': macro redefinition

      c:\vstinner\python\3.8\modules\_asynciomodule.c(2667): warning C4102: 'set_exception': unreferenced label

      c:\vstinner\python\3.8\modules\_ctypes\stgdict.c(704): warning C4244: 'initializing': conversion from 'Py_ssize_t' to 'int', possible loss of data

    2. added
      interpreter-core(Objects, Python, Grammar, and Parser dirs)
      buildThe build process and cross-build
      on Sep 30, 2019
    3. vstinner commented on Sep 30, 2019

      @vstinner
      MemberAuthor

      Warnings on Linux with gcc -O3:

      /home/vstinner/python/master/Modules/_randommodule.c:546:17: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
      546 | {Py_tp_doc, random_doc},
      | ^~~~~~~~~~

      /home/vstinner/python/master/Modules/_asynciomodule.c: In function ‘task_step_impl’:
      /home/vstinner/python/master/Modules/_asynciomodule.c:2660:1: warning: label ‘set_exception’ defined but not used [-Wunused-label]
      2660 | set_exception:
      | ^~~~~~~~~~~~~

      In function ‘getsockaddrarg’,
      inlined from ‘sock_bind’ at /home/vstinner/python/master/Modules/socketmodule.c:3113:10:
      /home/vstinner/python/master/Modules/socketmodule.c:2331:9: warning: ‘memset’ offset [17, 88] from the object at ‘addrbuf’ is out of the bounds of referenced subobject ‘sa’ with type ‘struct sockaddr’ at offset 0 [-Warray-bounds]
      2331 | memset(sa, 0, sizeof(*sa));
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~

      For socketmodule: I already created bpo-38282.

    4. changed the title [-]Windows: compiler warnings when building Python 3.8[/-] [+]Compiler warnings when building Python 3.8[/+] on Sep 30, 2019
    5. vstinner commented on Sep 30, 2019

      @vstinner
      MemberAuthor

      Other warnings:

      c:\vstinner\python\master\objects\longobject.c(420): warning C4244: 'function': conversion from 'unsigned __int64' to 'sdigit', possible loss of data

      c:\vstinner\python\master\objects\longobject.c(428): warning C4267: 'function': conversion from 'size_t' to 'sdigit', possible loss of data

    6. vstinner commented on Sep 30, 2019

      @vstinner
      MemberAuthor

      And more:

      c:\vstinner\python\master\modules\_testcapimodule.c(6409): warning C4146: unary minus operator applied to unsigned type, result still unsigned

    7. vstinner commented on Sep 30, 2019

      @vstinner
      MemberAuthor

      New changeset efe74b6 by Victor Stinner in branch 'master':
      bpo-38321: Fix _asynciomodule.c compiler warning (GH-16493)
      efe74b6

    8. vsajip commented on Sep 30, 2019

      @vsajip
      Member

      New changeset c9a413e by Vinay Sajip (Victor Stinner) in branch 'master':
      bpo-38321: Fix PyCStructUnionType_update_stgdict() warning (GH-16492)
      c9a413e

    9. vstinner commented on Sep 30, 2019

      @vstinner
      MemberAuthor

      New changeset aca8c40 by Victor Stinner in branch 'master':
      bpo-38321: Fix _testcapimodule.c warning (GH-16494)
      aca8c40

    10. animalize commented on Oct 1, 2019

      animalizemannequin
      Mannequin

      On my Windows, some non-ASCII characters cause this warning:

      d:\dev\cpython\modules\expat\xmltok.c : warning C4819: 
      The file contains a character that cannot be represented in
      the current code page (936). Save the file in Unicode format
      to prevent data loss.
      

      This patch fixes the warnings, it's applicable to master/3.8 branches.
      https://github.com/animalize/cpython/commit/daced7575ec70ef1f888c6854760e230cda5ea64

      Maybe this trivial problem is not worth a new commit, it can be fixed along with other warnings.

    11. animalize commented on Oct 1, 2019

      animalizemannequin
      Mannequin

      Other warnings:

      c:\vstinner\python\master\objects\longobject.c(420): warning C4244: 'function': conversion from 'unsigned __int64' to 'sdigit', possible loss of data

      c:\vstinner\python\master\objects\longobject.c(428): warning C4267: 'function': conversion from 'size_t' to 'sdigit', possible loss of data
      -----------------
      These warnings only appear in master branch, I will fix it at some point.
      (https://bugs.python.org/issue35696#msg352903)

    12. vstinner commented on Oct 1, 2019

      @vstinner
      MemberAuthor

      d:\dev\cpython\modules\expat\xmltok.c

      This file is copied directly from https://github.com/libexpat/libexpat/ project. Would you mind to propose your patch there?

    13. animalize commented on Oct 1, 2019

      animalizemannequin
      Mannequin

      This file is copied directly from https://github.com/libexpat/libexpat/ > project. Would you mind to propose your patch there?

      ok, I will report to there.

    14. vstinner commented on Oct 1, 2019

      @vstinner
      MemberAuthor

      New changeset 2f90261 by Victor Stinner in branch 'master':
      bpo-38321: Fix compiler warning in _randommodule.c (GH-16512)
      2f90261

    15. vstinner commented on Oct 1, 2019

      @vstinner
      MemberAuthor

      New changeset 6314abc by Victor Stinner in branch 'master':
      bpo-37802: Fix a compiler warning in longobject.c (GH-16517)
      6314abc

    16. vstinner commented on Oct 1, 2019

      @vstinner
      MemberAuthor

      New changeset bfe1f74 by Victor Stinner in branch '3.8':
      [3.8] bpo-3832: Fix compiler warnings (GH-16518)
      bfe1f74

    17. vstinner commented on Oct 1, 2019

      @vstinner
      MemberAuthor

      New changeset bfe1f74 by Victor Stinner in branch '3.8':
      [3.8] bpo-3832: Fix compiler warnings (GH-16518)
      bfe1f74

      (oops, I made a typo in the bpo number in the commit title.)

    18. vstinner commented on Oct 1, 2019

      @vstinner
      MemberAuthor

      Ok, most warnings have been fixed in 3.8 and master. I close the issue.

    19. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      3.8 (EOL)end of lifebuildThe build process and cross-buildinterpreter-core(Objects, Python, Grammar, and Parser dirs)

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions