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

Created on 2019-04-11 00:10 by ZackerySpytz, last changed 2019-05-14 03:55 by brett.cannon. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 12769 merged ZackerySpytz, 2019-04-11 00:14
Messages (4)
msg339907 - (view) Author: Zackery Spytz (ZackerySpytz) * (Python triager) 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.
msg341564 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2019-05-06 16:56
New changeset 1a2252ed39bc1b71cdaa935d7726d82909af93ab by Brett Cannon (Zackery Spytz) in branch 'master':
bpo-36594: Fix incorrect use of %p in format strings (GH-12769)
https://github.com/python/cpython/commit/1a2252ed39bc1b71cdaa935d7726d82909af93ab
History
Date User Action Args
2019-05-14 03:55:31brett.cannonsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2019-05-06 16:56:58brett.cannonsetnosy: + brett.cannon
messages: + msg341564
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