bpo-28269: Replace strcasecmp with system function stricmp by gongminmin · Pull Request #13095 · python/cpython (original) (raw)

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 andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation10 Commits4 Checks0 Files changed

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

gongminmin

The idea is from a comment in the issue. Replace strcasecmp in Python/dynload_win.c to posix stricmp,

  1. MinGW can compile this file,
  2. Don't need to maintain strcasecmp,
  3. No #ifdef/#endif. The code is converged between compilers.

https://bugs.python.org/issue28269

@gongminmin

@blurb-it

@serhiy-storchaka

Microsoft deprecated stricmp and recommends using _stricmp instead.

@gongminmin

@gongminmin

Just tried, MinGW also accept _stricmp. I'll use it instead. Thanks @serhiy-storchaka .

BoboTiG

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you @gongminmin :)

@skrah, do you think it is worth deleting those lines too?

#undef strcasecmp
#define strcasecmp _stricmp

And also update this comment to remove any occurrences of strcasecmp?

* Work around the behavior of tolower() and strcasecmp() in certain

@gongminmin @BoboTiG

Co-Authored-By: Mickaël Schoentgen contact@tiger-222.fr

@skrah

@skrah, do you think it is worth deleting those lines too?

No, vccompat.h intentionally translates MSVC functions to Unix functions. Also, libmpdec needs to stay in sync with upstream. But the current code organization is absolutely deliberate.

BoboTiG

@gongminmin

serhiy-storchaka

@miss-islington

Thanks @gongminmin for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 2.7, 3.7, 3.8.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

@bedevere-bot

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request

Jul 13, 2019

@gongminmin @miss-islington

…H-13095)

(cherry picked from commit 05f2d84)

Co-authored-by: Minmin Gong gongminmin@msn.com

@bedevere-bot

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request

Jul 13, 2019

@gongminmin @miss-islington

…H-13095)

(cherry picked from commit 05f2d84)

Co-authored-by: Minmin Gong gongminmin@msn.com

@miss-islington

Sorry, @gongminmin and @serhiy-storchaka, I could not cleanly backport this to 2.7 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker 05f2d84cae4ba1ff15b7a1d0347305393f4bdcc5 2.7

miss-islington added a commit that referenced this pull request

Aug 24, 2019

@miss-islington @gongminmin

(cherry picked from commit 05f2d84)

Co-authored-by: Minmin Gong gongminmin@msn.com

lisroach pushed a commit to lisroach/cpython that referenced this pull request

Sep 10, 2019

@gongminmin @lisroach

DinoV pushed a commit to DinoV/cpython that referenced this pull request

Jan 14, 2020

@gongminmin @DinoV

jcfr added a commit to python-cmake-buildsystem/cpython that referenced this pull request

Jan 18, 2022

@jcfr @davidsansome

This commit integrates changes originally added to the project as python-cmake-buildsystem/python-cmake-buildsystem@18d49757e (Mingw32 support, and add cmake options for disabling)

Note that in more recent version of Python, this patch is obsoleted by the following commits:

See python/cpython@589f89e2a (introduced in 3.3) Removed a Windows 9x trick used before LoadLibraryExW. Windows 9x has long been unsupported and the result of GetFullPathName was not even being used in the first place.

See python/cpython@05f2d84ca (introduced in 3.9) bpo-28269: Replace strcasecmp with system function _stricmp. (pythonGH-13095)

Co-authored-by: David Sansome me@davidsansome.com

jcfr added a commit to python-cmake-buildsystem/cpython that referenced this pull request

Jan 18, 2022

@jcfr @davidsansome

This commit integrates changes originally added to the project as python-cmake-buildsystem/python-cmake-buildsystem@18d49757e (Mingw32 support, and add cmake options for disabling)

Note that in more recent version of Python, this patch is obsoleted by the following commits:

See python/cpython@589f89e2a (introduced in 3.3) Removed a Windows 9x trick used before LoadLibraryExW. Windows 9x has long been unsupported and the result of GetFullPathName was not even being used in the first place.

See python/cpython@05f2d84ca (introduced in 3.9) bpo-28269: Replace strcasecmp with system function _stricmp. (pythonGH-13095)

Co-authored-by: David Sansome me@davidsansome.com

jcfr added a commit to python-cmake-buildsystem/cpython that referenced this pull request

Jan 18, 2022

@jcfr @davidsansome

This commit integrates changes originally added to the project as python-cmake-buildsystem/python-cmake-buildsystem@18d49757e (Mingw32 support, and add cmake options for disabling)

Note that in more recent version of Python, this patch is obsoleted by the following commits:

See python/cpython@589f89e2a (introduced in 3.3) Removed a Windows 9x trick used before LoadLibraryExW. Windows 9x has long been unsupported and the result of GetFullPathName was not even being used in the first place.

See python/cpython@05f2d84ca (introduced in 3.9) bpo-28269: Replace strcasecmp with system function _stricmp. (pythonGH-13095)

Co-authored-by: David Sansome me@davidsansome.com

jcfr added a commit to python-cmake-buildsystem/cpython that referenced this pull request

Jan 18, 2022

@jcfr @davidsansome

This commit integrates changes originally added to the project as python-cmake-buildsystem/python-cmake-buildsystem@18d49757e (Mingw32 support, and add cmake options for disabling)

Note that in more recent version of Python, this patch is obsoleted by the following commits:

See python/cpython@589f89e2a (introduced in 3.3) Removed a Windows 9x trick used before LoadLibraryExW. Windows 9x has long been unsupported and the result of GetFullPathName was not even being used in the first place.

See python/cpython@05f2d84ca (introduced in 3.9) bpo-28269: Replace strcasecmp with system function _stricmp. (pythonGH-13095)

Co-authored-by: David Sansome me@davidsansome.com