GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-108765: Python.h no longer includes <ctype.h> by vstinner · Pull Request #108831 · python/cpython

Conversation

@vstinner

@vstinner vstinner commented Sep 2, 2023 •
edited by github-actions Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

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).
  • Issue: C API: Cleanup header files #108765

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-bot bedevere-bot mentioned this pull request Sep 2, 2023
C API: Cleanup header files #108765
Closed
@vstinner
vstinner force-pushed the remove_ctype branch 2 times, most recently from c8078fa to 3664daf Compare September 3, 2023 07:32
@vstinner
pythongh-108765: Python.h no longer includes <ctype.h>
729b785
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 force-pushed the remove_ctype branch from 3664daf to 729b785 Compare September 3, 2023 07:39
@vstinner
vstinner marked this pull request as ready for review September 3, 2023 15:38
@vstinner
vstinner requested review from abalkin, markshannon and pganssle as code owners September 3, 2023 15:38
@bedevere-bot bedevere-bot added the awaiting core review label Sep 3, 2023
@vstinner
vstinner merged commit 03c4080 into python:main Sep 3, 2023
@vstinner
vstinner deleted the remove_ctype branch September 3, 2023 16:54
@bedevere-bot bedevere-bot removed the awaiting core review label Sep 3, 2023
@vstinner

vstinner commented Sep 3, 2023

Copy link
Copy Markdown
Member Author

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot

bedevere-bot commented Sep 3, 2023

Copy link
Copy Markdown

⚠️⚠️⚠️ 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�'
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner vstinner mentioned this pull request Nov 13, 2023
gh-112026: Add again <unistd.h> include in Python.h #112046
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@pganssle pganssle Awaiting requested review from pganssle pganssle is a code owner
@abalkin abalkin Awaiting requested review from abalkin
@markshannon markshannon Awaiting requested review from markshannon markshannon is a code owner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@vstinner @bedevere-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.