X Tutup
The Wayback Machine - https://web.archive.org/web/20260216070727/https://github.com/python/cpython/pull/1294
Skip to content

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

Merged
vstinner merged 1 commit intopython:masterfrom
vstinner:tm_zone_const
Apr 26, 2017
Merged

timemodule.c: Cast PyUnicode_AsUTF8() to char*#1294
vstinner merged 1 commit intopython:masterfrom
vstinner:tm_zone_const

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

X Tutup