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

pyconfig.h macro "timezone" name clashes with user source are likely #78838

Closed
mikofski mannequin opened this issue Sep 13, 2018 · 2 comments
Closed

pyconfig.h macro "timezone" name clashes with user source are likely #78838

mikofski mannequin opened this issue Sep 13, 2018 · 2 comments
Labels
3.7 (EOL) end of life 3.8 only security fixes OS-windows type-feature A feature request or enhancement

Comments

@mikofski
Copy link
Mannequin

mikofski mannequin commented Sep 13, 2018

BPO 34657
Nosy @pfmoore, @tjguk, @zware, @zooba, @mikofski
Superseder
  • bpo-24643: VS 2015 pyconfig.h #define timezone _timezone conflicts with timeb.h
  • 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 2018-09-13.14:40:35.355>
    created_at = <Date 2018-09-13.06:10:52.349>
    labels = ['3.8', 'type-feature', '3.7', 'OS-windows']
    title = 'pyconfig.h macro "timezone" name clashes with user source are likely'
    updated_at = <Date 2018-09-13.14:40:35.353>
    user = 'https://github.com/mikofski'

    bugs.python.org fields:

    activity = <Date 2018-09-13.14:40:35.353>
    actor = 'zach.ware'
    assignee = 'none'
    closed = True
    closed_date = <Date 2018-09-13.14:40:35.355>
    closer = 'zach.ware'
    components = ['Windows']
    creation = <Date 2018-09-13.06:10:52.349>
    creator = 'bwanamarko'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 34657
    keywords = []
    message_count = 2.0
    messages = ['325235', '325249']
    nosy_count = 5.0
    nosy_names = ['paul.moore', 'tim.golden', 'zach.ware', 'steve.dower', 'bwanamarko']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = 'resolved'
    status = 'closed'
    superseder = '24643'
    type = 'enhancement'
    url = 'https://bugs.python.org/issue34657'
    versions = ['Python 3.5', 'Python 3.6', 'Python 3.7', 'Python 3.8']

    @mikofski
    Copy link
    Mannequin Author

    mikofski mannequin commented Sep 13, 2018

    TL;DR: if PC user compiles source which defines "timezone" in a header, and includes Python.h after the header, then the macro also called "timezone" in pyconfig.h will redefine the users source, yielding unexpected results.

    see Cython google group for an actual use case where this occurred:
    https://groups.google.com/forum/#!topic/cython-users/pjbhYrpl_rU

    trying to compile NREL SPA code which has a header file with a struct with a timezone field fails with the following traceback:
    spa.h(88): error C2032: '__timezone': function cannot be member of struct '<anonymous-tag>'

    here's the macro in PC/pyconfig.h in master as of 5489bda

    #define timezone _timezone

    /* VS 2015 defines these names with a leading underscore */
    #if _MSC_VER >= 1900
    #define timezone _timezone
    #define daylight _daylight
    #define tzname _tzname
    #endif

    @mikofski mikofski mannequin added build The build process and cross-build 3.7 (EOL) end of life 3.8 only security fixes type-feature A feature request or enhancement labels Sep 13, 2018
    @ned-deily ned-deily added OS-windows and removed build The build process and cross-build labels Sep 13, 2018
    @zware
    Copy link
    Member

    zware commented Sep 13, 2018

    This is a duplicate of bpo-24643.

    @zware zware closed this as completed Sep 13, 2018
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life 3.8 only security fixes OS-windows type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants