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

gh-108765: Python.h no longer includes <ctype.h> #108831

Merged
merged 1 commit into from
Sep 3, 2023

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Sep 2, 2023

Remove <ctype.h> in C files which don't use it; only sre.c and _decimal.c still use it.

Remove _PY_PORT_CTYPE_UTF8_ISSUE code from pyport.h:

  • Code added by commit b5047fd in 2004 for MacOSX and FreeBSD.
  • Test removed by commit 52ddaef in 2007, since Python str type now uses locale independent functions like Py_ISALPHA() and Py_TOLOWER() and the Unicode database.

Modules/_sre/sre.c replaces _PY_PORT_CTYPE_UTF8_ISSUE with new functions:

  • sre_isalnum()
  • sre_tolower()
  • sre_toupper()

Remove unused includes:

  • _localemodule.c: remove <stdio.h>.
  • getargs.c: remove <float.h>.
  • dynload_win.c: remove <direct.h>, it no longer calls _getcwd() since commit fb1f68e (in 2001).

📚 Documentation preview 📚: https://cpython-previews--108831.org.readthedocs.build/

@vstinner vstinner force-pushed the remove_ctype branch 2 times, most recently from c8078fa to 3664daf Compare September 3, 2023 07:32
Remove <ctype.h> in C files which don't use it; only sre.c and
_decimal.c still use it.

Remove _PY_PORT_CTYPE_UTF8_ISSUE code from pyport.h:

* Code added by commit b5047fd
  in 2004 for MacOSX and FreeBSD.
* Test removed by commit 52ddaef
  in 2007, since Python str type now uses locale independent
  functions like Py_ISALPHA() and Py_TOLOWER() and the Unicode
  database.

Modules/_sre/sre.c replaces _PY_PORT_CTYPE_UTF8_ISSUE with new
functions:

* sre_isalnum()
* sre_tolower()
* sre_toupper()

Remove unused includes:

* _localemodule.c: remove <stdio.h>.
* getargs.c: remove <float.h>.
* dynload_win.c: remove <direct.h>, it no longer calls _getcwd()
  since commit fb1f68e (in 2001).
@vstinner vstinner marked this pull request as ready for review September 3, 2023 15:38
@vstinner vstinner merged commit 03c4080 into python:main Sep 3, 2023
@vstinner vstinner deleted the remove_ctype branch September 3, 2023 16:54
@vstinner
Copy link
Member Author

vstinner commented Sep 3, 2023

I merged my PR.

If it causes too many trouble in 3rd party C extensions (require to update too many C extensions before Python 3.13 beta1), I can make this change conditional only in the limited C API version 3.13.

See also my PR removing <unistd.h>: PR #108783.

@bedevere-bot
Copy link

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot AMD64 Windows11 Non-Debug 3.x has failed when building commit 03c4080.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/all/#builders/914/builds/2761) and take a look at the build logs.
  4. Check if the failure is related to this commit (03c4080) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/all/#builders/914/builds/2761

Failed tests:

  • test.test_concurrent_futures.test_shutdown
  • test.test_concurrent_futures.test_deadlock

Summary of the results of the build (if available):

==

Click to see traceback logs
Traceback (most recent call last):
  File "b:\uildarea\3.x.ware-win11.nondebug\build\Lib\test\support\os_helper.py", line 480, in temp_dir
    yield path
  File "b:\uildarea\3.x.ware-win11.nondebug\build\Lib\test\support\os_helper.py", line 533, in temp_cwd
    yield cwd_dir
  File "b:\uildarea\3.x.ware-win11.nondebug\build\Lib\test\libregrtest\main.py", line 802, in main
    self._main(tests, kwargs)
  File "b:\uildarea\3.x.ware-win11.nondebug\build\Lib\test\libregrtest\main.py", line 861, in _main
    sys.exit(0)
SystemExit: 0


Traceback (most recent call last):
  File "b:\uildarea\3.x.ware-win11.nondebug\build\Lib\test\support\__init__.py", line 207, in _force_run
    return func(*args)
           ^^^^^^^^^^^
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'B:\\uildarea\\3.x.ware-win11.nondebug\\build\\build\\test_python_4856�\\test_python_worker_13508�'

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.

2 participants