classification
Title: Undefined behavior due to incorrect usage of %p in format strings
Type: Stage: patch review
Components: Extension Modules, Interpreter Core Versions: Python 3.8, Python 3.7, Python 2.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: ZackerySpytz, mark.dickinson, serhiy.storchaka, skrah
Priority: normal Keywords: patch

Created on 2019-04-11 00:10 by ZackerySpytz, last changed 2019-04-13 11:17 by skrah.

Pull Requests
URL Status Linked Edit
PR 12769 open ZackerySpytz, 2019-04-11 00:14
Messages (3)
msg339907 - (view) Author: Zackery Spytz (ZackerySpytz) * Date: 2019-04-11 00:14
The attached PR fixes incorrect usages of %p in format strings.
msg340151 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2019-04-13 11:01
Are not all pointer types (except pointers to functions) automatically converted to/from void*.
msg340152 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2019-04-13 11:17
gcc warns with -pedantic:

ptr.c: In function ‘main’:
ptr.c:5:13: warning: format ‘%p’ expects argument of type ‘void *’, but argument 2 has type ‘int *’ [-Wformat=]
     printf ("%p", &i);


It is pedantic indeed, I wonder if machines with different pointer sizes still exist.
History
Date User Action Args
2019-04-13 11:17:25skrahsetnosy: + skrah
messages: + msg340152
2019-04-13 11:01:43serhiy.storchakasetmessages: + msg340151
2019-04-13 10:57:50serhiy.storchakasetnosy: + mark.dickinson
2019-04-11 00:21:17xtreaksetnosy: + serhiy.storchaka
2019-04-11 00:14:26ZackerySpytzsetmessages: + msg339907
2019-04-11 00:14:02ZackerySpytzsetkeywords: + patch
stage: patch review
pull_requests: + pull_request12698
2019-04-11 00:10:57ZackerySpytzcreate