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

timemodule.c: Cast PyUnicode_AsUTF8() to char* #1294

Merged
merged 1 commit into from
Apr 26, 2017
Merged

timemodule.c: Cast PyUnicode_AsUTF8() to char* #1294

merged 1 commit into from
Apr 26, 2017

Conversation

vstinner
Copy link
Member

bpo-28769 changed PyUnicode_AsUTF8() return type from const char* to char* in Python 3.7, but tm_zone field type of the tm structure is char* on FreeBSD.

Cast PyUnicode_AsUTF8() to char* in gettmarg() to fix the warning:

Modules/timemodule.c:443:20: warning: assigning to 'char *'
from 'const char *' discards qualifiers

See http://bugs.python.org/issue28769

bpo-28769 changed PyUnicode_AsUTF8() return type from const char* to
char* in Python 3.7, but tm_zone field type of the tm structure is
char* on FreeBSD.

Cast PyUnicode_AsUTF8() to char* in gettmarg() to fix the warning:

    Modules/timemodule.c:443:20: warning: assigning to 'char *'
    from 'const char *' discards qualifiers
@mention-bot
Copy link

@Haypo, thanks for your PR! By analyzing the history of the files in this pull request, we identified @abalkin, @loewis and @benjaminp to be potential reviewers.

@vstinner
Copy link
Member Author

Note: I tested manually this PR on FreeBSD: it fixes the warning, timemodule.c compilation doesn't emit any warning anymore.

@serhiy-storchaka
Copy link
Member

tm_zone is const char* in GNU libc, but this field is defined only when _BSD_SOURCE was set.

@vstinner vstinner merged commit 6e67695 into python:master Apr 26, 2017
@vstinner vstinner deleted the tm_zone_const branch April 26, 2017 11:51
@vstinner
Copy link
Member Author

Merged. Thanks for the review @serhiy-storchaka and @AraHaan ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants