This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: PyOS_mystricmp unused and no longer available
Type: compile error Stage: resolved
Components: Interpreter Core Versions: Python 3.3, Python 3.4, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Arfrever, benjamin.peterson, christian.heimes, georg.brandl, jwilk, larry, loewis, python-dev, vstinner
Priority: normal Keywords: 3.3regression, patch

Created on 2013-07-30 23:58 by christian.heimes, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
18603.patch christian.heimes, 2013-08-18 13:47 review
Messages (11)
msg193965 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2013-07-30 23:58
The two functions PyOS_strnicmp() and PyOS_stricmp() from Python/pystrcmp.c are no longer used by any function in the core. Because no module references any object from Python/pystrcmp.c the object file is not included in the Python binary:

$ nm -P python | grep ^PyOS | sort
PyOS_AfterFork T 000000000044040e 0000000000000036
PyOS_double_to_string T 00000000005da3de 0000000000000119
PyOS_FiniInterrupts T 0000000000440380 000000000000000b
PyOS_getsig T 0000000000423994 0000000000000041
PyOS_InitInterrupts T 00000000004402f5 000000000000008b
PyOS_InputHook B 000000000095d478 0000000000000008
PyOS_InterruptOccurred T 000000000044038b 000000000000003e
PyOS_ReadlineFunctionPointer B 000000000095d5c8 0000000000000008
PyOS_Readline T 000000000063ffb5 000000000000012e
PyOS_setsig T 00000000004239d5 0000000000000078
PyOS_snprintf T 000000000041c7bc 00000000000000b8
PyOS_StdioReadline T 000000000063fe1c 0000000000000199
PyOS_string_to_double T 00000000005d9b50 0000000000000146
PyOS_strtol T 00000000005d3ded 00000000000000d6
PyOS_strtoul T 00000000005d3a00 00000000000003ed
PyOS_vsnprintf T 000000000041c874 00000000000000c4

Neither Python 2.7 nor 3.3+ include the functions in their binaries. 2.6 and 3.2 are not affected. The functions are part of the documented and stable API but apparently they are not used very often.
msg195564 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2013-08-18 13:47
Here is a simple patch based on the approach in Objects/object.c
msg200759 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2013-10-21 12:16
ping RMs
msg200793 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2013-10-21 14:53
Uggg, can we just kill them if we've already released versions without them?
msg200795 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2013-10-21 14:56
Fine with me, however ...

Technically all our source releases still contain the code. AFAIK all shared library builds, too. Just standard builds of Python are lacking the object file.
msg200796 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2013-10-21 14:57
The function doesn't hurt, please don't touch stable versions: only remove it from 3.4. I don't understand the tag "keywords: 3.3regression". Is this issue a bug, or even a compile error??
msg200884 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2013-10-22 06:07
Well, if the functions are part of the stable ABI (which it seems they are, as they don't fall under some exclusion defined by PEP 384) they shouldn't be removed if we take PEP 384 seriously.
msg200888 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2013-10-22 07:52
The patch looks good to me. The stable ABI was originally intended for Windows only, where the functions are guaranteed to be included in python3.dll (as the .def file references them); they are included in python3X.dll as link.exe doesn't do the same object file omission that /bin/ld does. But I agree in principle that the proposed solution is better (and it is the only approach that works with /bin/ld).
msg200891 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-10-22 08:27
New changeset 4c4f31a1b706 by Christian Heimes in branch '3.3':
Issue #18603: Ensure that PyOS_mystricmp and PyOS_mystrnicmp are in the
http://hg.python.org/cpython/rev/4c4f31a1b706

New changeset b5cc822d5bf0 by Christian Heimes in branch 'default':
Issue #18603: Ensure that PyOS_mystricmp and PyOS_mystrnicmp are in the
http://hg.python.org/cpython/rev/b5cc822d5bf0

New changeset dc9f17f10899 by Christian Heimes in branch '2.7':
Issue #18603: Ensure that PyOS_mystricmp and PyOS_mystrnicmp are in the
http://hg.python.org/cpython/rev/dc9f17f10899
msg200895 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2013-10-22 08:39
Thanks for your input. I have applied the patch to 2.7, 3.3 and 3.4. A couple of 3rd party were bitten by the missing symbols. A Google search reveals a couple of them https://www.google.de/search?q=PyOS_mystricmp+missing
msg200958 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2013-10-22 14:25
Someone would have to be trying fairly hard to use those functions on Windows because this is in the header:

#ifdef MS_WINDOWS
#define PyOS_strnicmp strnicmp
#define PyOS_stricmp stricmp
#else
#define PyOS_strnicmp PyOS_mystrnicmp
#define PyOS_stricmp PyOS_mystricmp
#endif
History
Date User Action Args
2022-04-11 14:57:48adminsetgithub: 62803
2013-12-21 16:28:27jwilksetnosy: + jwilk
2013-10-22 14:25:38benjamin.petersonsetmessages: + msg200958
2013-10-22 08:39:09christian.heimessetstage: patch review -> resolved
2013-10-22 08:39:03christian.heimessetstatus: open -> closed
resolution: fixed
messages: + msg200895
2013-10-22 08:27:16python-devsetnosy: + python-dev
messages: + msg200891
2013-10-22 07:52:14loewissetmessages: + msg200888
2013-10-22 06:07:52georg.brandlsetnosy: + loewis
messages: + msg200884
2013-10-21 14:57:23vstinnersetnosy: + vstinner
messages: + msg200796
2013-10-21 14:56:27christian.heimessetmessages: + msg200795
2013-10-21 14:53:55benjamin.petersonsetmessages: + msg200793
2013-10-21 12:16:05christian.heimessetnosy: + georg.brandl, larry, benjamin.peterson
messages: + msg200759
2013-08-18 13:47:19christian.heimessetfiles: + 18603.patch
messages: + msg195564

components: + Interpreter Core
keywords: + patch
stage: patch review
2013-07-31 22:57:14Arfreversetnosy: + Arfrever
2013-07-30 23:58:45christian.heimescreate