GeezerVison is showing github.com — gh-109096: Deprecate `http.server.CGIHTTPRequestHandler` by gpshead · Pull Request #109387 · python/cpython
Conversation
gpshead
commented
Sep 13, 2023
•
edited by github-actions
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
So far I haven't found any practical users of this 1990s era functionality. Given we don't encourage the use of http.server as anyones main serving stack and that using the old CGI child process and environment method fell out of favor ages ago... Lets see if we can deprecate it.
📚 Documentation preview 📚: https://cpython-previews--109387.org.readthedocs.build/
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Since the cgi module was removed in Python 3.13, it makes sense to deprecate CGIHTTPRequestHandler.
wsgiref has BaseCGIHandler, CGIHandler and IISCGIHandler classes. Are they still relevant nowadays? WSGI isn't suppose to replace CGI?
wsgiref.simple_ref uses env['GATEWAY_INTERFACE'] = 'CGI/1.1'. Is it WSGI or CGI? I'm confused :-(
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple of wording suggestions. Deprecating CGI sounds like a good idea
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
gpshead reacted with thumbs up emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
gpshead reacted with thumbs up emoji
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I dislike the _self hack in the test but it's not a big deal.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
JelleZijlstra and gpshead reacted with thumbs up emoji
I dislike the _self hack in the test but it's not a big deal.
Agreed. If it weren't in test code set to be deleted in two years I'd have refactored further.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️
Hi! The buildbot s390x RHEL7 3.x has failed when building commit 59073c9.
What do you need to do:
- Don't panic.
- Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
- Go to the page of the buildbot that failed (https://buildbot.python.org/all/#builders/179/builds/5489) and take a look at the build logs.
- Check if the failure is related to this commit (59073c9) or if it is a false positive.
- 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/179/builds/5489
Failed tests:
Failed subtests:
- test_freeze_simple_script - test.test_tools.test_freeze.TestFreeze.test_freeze_simple_script
Summary of the results of the build (if available):
==
Click to see traceback logs
Traceback (most recent call last):
File "<frozen importlib._bootstrap>", line 1354, in _find_and_load
File "<frozen importlib._bootstrap>", line 1325, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 929, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 1004, in exec_module
File "<frozen importlib._bootstrap_external>", line 1100, in get_code
File "<frozen importlib._bootstrap_external>", line 1199, in get_data
TypeError: descriptor 'close' for '_io.BufferedReader' objects doesn't apply to a '_io.FileIO' object
Traceback (most recent call last):
File "/home/dje/cpython-buildarea/3.x.edelsohn-rhel-z/build/Lib/threading.py", line 1059, in _bootstrap_inner
self.run()
File "/home/dje/cpython-buildarea/3.x.edelsohn-rhel-z/build/Lib/threading.py", line 996, in run
self._target(*self._args, **self._kwargs)
File "/home/dje/cpython-buildarea/3.x.edelsohn-rhel-z/build/Lib/test/test_interpreters.py", line 483, in task
interp = interpreters.create()
^^^^^^^^^^^^^^^^^^^^^
File "/home/dje/cpython-buildarea/3.x.edelsohn-rhel-z/build/Lib/test/support/interpreters.py", line 25, in create
id = _interpreters.create(isolated=isolated)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: interpreter creation failed
k
Traceback (most recent call last):
File "/home/dje/cpython-buildarea/3.x.edelsohn-rhel-z/build/Lib/test/test_tools/test_freeze.py", line 28, in test_freeze_simple_script
outdir, scriptfile, python = helper.prepare(script, outdir)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/dje/cpython-buildarea/3.x.edelsohn-rhel-z/build/Tools/freeze/test/freeze.py", line 146, in prepare
copy_source_tree(srcdir, SRCDIR)
File "/home/dje/cpython-buildarea/3.x.edelsohn-rhel-z/build/Tools/freeze/test/freeze.py", line 95, in copy_source_tree
shutil.copytree(oldroot, newroot, ignore=ignore_non_src)
File "/home/dje/cpython-buildarea/3.x.edelsohn-rhel-z/build/Lib/shutil.py", line 588, in copytree
return _copytree(entries=entries, src=src, dst=dst, symlinks=symlinks,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/dje/cpython-buildarea/3.x.edelsohn-rhel-z/build/Lib/shutil.py", line 542, in _copytree
raise Error(errors)
shutil.Error: [('/home/dje/cpython-buildarea/3.x.edelsohn-rhel-z/build/build/test_python_16368æ/@test_16368_tmpæ-tardir/extractall_ctrl/ustar/fifotype', '/tmp/test_python_f41cjpzy/tmp92oau7y2/cpython/build/test_python_16368æ/@test_16368_tmpæ-tardir/extractall_ctrl/ustar/fifotype', '`/home/dje/cpython-buildarea/3.x.edelsohn-rhel-z/build/build/test_python_16368æ/@test_16368_tmpæ-tardir/extractall_ctrl/ustar/fifotype` is a named pipe'), ('/home/dje/cpython-buildarea/3.x.edelsohn-rhel-z/build/build/test_python_16368æ/@test_16368_tmpæ-tardir/extractall_none/ustar/fifotype', '/tmp/test_python_f41cjpzy/tmp92oau7y2/cpython/build/test_python_16368æ/@test_16368_tmpæ-tardir/extractall_none/ustar/fifotype', '`/home/dje/cpython-buildarea/3.x.edelsohn-rhel-z/build/build/test_python_16368æ/@test_16368_tmpæ-tardir/extractall_none/ustar/fifotype` is a named pipe')]
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️
Hi! The buildbot s390x RHEL8 3.x has failed when building commit 59073c9.
What do you need to do:
- Don't panic.
- Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
- Go to the page of the buildbot that failed (https://buildbot.python.org/all/#builders/509/builds/4921) and take a look at the build logs.
- Check if the failure is related to this commit (59073c9) or if it is a false positive.
- 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/509/builds/4921
Failed tests:
- test.test_asyncio.test_subprocess
Failed subtests:
- test_subprocess_consistent_callbacks - test.test_asyncio.test_subprocess.SubprocessThreadedWatcherTests.test_subprocess_consistent_callbacks
Summary of the results of the build (if available):
==
Click to see traceback logs
Traceback (most recent call last):
File "/home/dje/cpython-buildarea/3.x.edelsohn-rhel8-z/build/Lib/test/test_asyncio/test_subprocess.py", line 788, in test_subprocess_consistent_callbacks
self.loop.run_until_complete(main())
File "/home/dje/cpython-buildarea/3.x.edelsohn-rhel8-z/build/Lib/asyncio/base_events.py", line 664, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/home/dje/cpython-buildarea/3.x.edelsohn-rhel8-z/build/Lib/test/test_asyncio/test_subprocess.py", line 780, in main
self.assertEqual(events, [
AssertionError: Lists differ: ['process_exited', ('pipe_data_received', 1, b'stdout')] != [('pipe_data_received', 1, b'stdout'), ('p[95 chars]ted']
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️
Hi! The buildbot PPC64LE Fedora Stable LTO + PGO 3.x has failed when building commit 59073c9.
What do you need to do:
- Don't panic.
- Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
- Go to the page of the buildbot that failed (https://buildbot.python.org/all/#builders/101/builds/3754) and take a look at the build logs.
- Check if the failure is related to this commit (59073c9) or if it is a false positive.
- 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/101/builds/3754
Failed tests:
Failed subtests:
- test_zippath_from_non_installed_posix - test.test_venv.BasicTest.test_zippath_from_non_installed_posix
Summary of the results of the build (if available):
==
Click to see traceback logs
Traceback (most recent call last):
File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-ppc64le.lto-pgo/build/Lib/test/test_venv.py", line 580, in test_zippath_from_non_installed_posix
shutil.copytree(fn, os.path.join(libdir, name))
File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-ppc64le.lto-pgo/build/Lib/shutil.py", line 588, in copytree
return _copytree(entries=entries, src=src, dst=dst, symlinks=symlinks,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-ppc64le.lto-pgo/build/Lib/shutil.py", line 542, in _copytree
raise Error(errors)
shutil.Error: [('/home/buildbot/buildarea/3.x.cstratak-fedora-stable-ppc64le.lto-pgo/build/Lib/test/test_json/__pycache__/test_float.cpython-313.pyc.140735984064752', '/tmp/test_python_jv6l7pxc/tmpviaat877/lib/python3.13/test/test_json/__pycache__/test_float.cpython-313.pyc.140735984064752', "[Errno 2] No such file or directory: '/home/buildbot/buildarea/3.x.cstratak-fedora-stable-ppc64le.lto-pgo/build/Lib/test/test_json/__pycache__/test_float.cpython-313.pyc.140735984064752'")]
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Only just came across this. As a teacher of Python, where I usually only have access to core Python (no internet access), I have found the CGIHTTPRequestHandler really useful for teaching basic web processes. I can't go to a fully-fledged web framework. CGI is really useful for students to get the whole POST/run/output process with minimal effort and maximal engagement.
Disappointed about this deprecation.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Only just came across this. As a teacher of Python, where I usually only have access to core Python (no internet access)
You can provide Python with a old (non deprecated) copy of CGIHTTPRequestHandler to your students.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Yes, that would work. But often I can't bring any external code in either; they've got core Python and that's all I can work with.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Reviewers
vstinner
vstinner approved these changes
Uh oh!
There was an error while loading. Please reload this page.
Labels
3.13
only security fixes
docs
Documentation in the Doc dir
stdlib
Standard Library Python modules in the Lib/ directory
tests
Tests in the Lib/test dir
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.
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.
|