Skip to content
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 and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-28269: Replace strcasecmp with system function stricmp #13095

Merged
merged 4 commits into from
Jul 13, 2019

Conversation

gongminmin
Copy link
Contributor

@gongminmin gongminmin commented May 5, 2019

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

@serhiy-storchaka
Copy link
Member

Microsoft deprecated stricmp and recommends using _stricmp instead.

@gongminmin
Copy link
Contributor Author

gongminmin commented May 5, 2019

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

Copy link
Contributor

@BoboTiG BoboTiG left a comment

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

@skrah
Copy link
Contributor

skrah commented May 28, 2019

@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.

@gongminmin
Copy link
Contributor Author

Ping?

@miss-islington
Copy link
Contributor

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
Copy link

GH-14740 is a backport of this pull request to the 3.8 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.8 only security fixes label Jul 13, 2019
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jul 13, 2019
@bedevere-bot
Copy link

GH-14741 is a backport of this pull request to the 3.7 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jul 13, 2019
@miss-islington
Copy link
Contributor

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

@gongminmin gongminmin deleted the RemoveStrcasecmp branch July 14, 2019 01:53
miss-islington added a commit that referenced this pull request Aug 24, 2019
lisroach pushed a commit to lisroach/cpython that referenced this pull request Sep 10, 2019
DinoV pushed a commit to DinoV/cpython that referenced this pull request Jan 14, 2020
@serhiy-storchaka serhiy-storchaka removed their assignment Dec 29, 2020
jcfr added a commit to python-cmake-buildsystem/cpython that referenced this pull request Jan 18, 2022
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 <[email protected]>
jcfr added a commit to python-cmake-buildsystem/cpython that referenced this pull request Jan 18, 2022
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 <[email protected]>
jcfr added a commit to python-cmake-buildsystem/cpython that referenced this pull request Jan 18, 2022
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 <[email protected]>
jcfr added a commit to python-cmake-buildsystem/cpython that referenced this pull request Jan 18, 2022
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 <[email protected]>
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.

7 participants