Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-109096: Deprecatehttp.server.CGIHTTPRequestHandler#109387

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

Already on GitHub?Sign in to your account

Merged
gpshead merged 9 commits intopython:mainfromgpshead:deprecate/CGI
Sep 15, 2023

Conversation

gpshead
Copy link
Member

@gpsheadgpshead commentedSep 13, 2023
edited by github-actionsbot
Loading

So far I haven't found any practical users of this 1990s era functionality. Given we don't encourage the use ofhttp.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/

@gpsheadgpshead added 3.13bugs and security fixes testsTests in the Lib/test dir stdlibPython modules in the Lib dir labelsSep 13, 2023
@vstinner
Copy link
Member

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 usesenv['GATEWAY_INTERFACE'] = 'CGI/1.1'. Is it WSGI or CGI? I'm confused :-(

@gpshead
Copy link
MemberAuthor

WSGI used much of the original CGI web server to application interfaces to make migrating from old CGI scripts child processes to in-server-process WSGI calls easy.https://peps.python.org/pep-3333/#specification-details

@gpsheadgpshead added the docsDocumentation in the Doc dir labelSep 15, 2023
Copy link
Member

@JelleZijlstraJelleZijlstra left a 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

gpshead reacted with thumbs up emoji
gpsheadand others added3 commitsSeptember 15, 2023 12:49
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Copy link
Member

@vstinnervstinner left a comment

Choose a reason for hiding this comment

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

gpshead reacted with thumbs up emoji
@gpsheadgpshead marked this pull request as ready for reviewSeptember 15, 2023 20:32
@gpsheadgpshead self-assigned thisSep 15, 2023
Copy link
Member

@vstinnervstinner left a 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.

JelleZijlstra and gpshead reacted with thumbs up emoji
@gpshead
Copy link
MemberAuthor

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.

@gpsheadgpshead merged commit59073c9 intopython:mainSep 15, 2023
@gpsheadgpshead deleted the deprecate/CGI branchSeptember 15, 2023 21:26
@bedevere-bot
Copy link

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

Hi! The buildbots390x RHEL7 3.x has failed when building commit59073c9.

What do you need to do:

  1. Don't panic.
  2. Checkthe 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/179/builds/5489) and take a look at the build logs.
  4. Check if the failure is related to this commit (59073c9) 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/179/builds/5489

Failed tests:

  • test_tools

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>", line1354, in_find_and_load  File"<frozen importlib._bootstrap>", line1325, in_find_and_load_unlocked  File"<frozen importlib._bootstrap>", line929, in_load_unlocked  File"<frozen importlib._bootstrap_external>", line1004, inexec_module  File"<frozen importlib._bootstrap_external>", line1100, inget_code  File"<frozen importlib._bootstrap_external>", line1199, inget_dataTypeError:descriptor 'close' for '_io.BufferedReader' objects doesn't apply to a '_io.FileIO' objectTraceback (most recent call last):  File"/home/dje/cpython-buildarea/3.x.edelsohn-rhel-z/build/Lib/threading.py", line1059, in_bootstrap_innerself.run()  File"/home/dje/cpython-buildarea/3.x.edelsohn-rhel-z/build/Lib/threading.py", line996, inrunself._target(*self._args,**self._kwargs)  File"/home/dje/cpython-buildarea/3.x.edelsohn-rhel-z/build/Lib/test/test_interpreters.py", line483, intask    interp= interpreters.create()^^^^^^^^^^^^^^^^^^^^^  File"/home/dje/cpython-buildarea/3.x.edelsohn-rhel-z/build/Lib/test/support/interpreters.py", line25, increateid= _interpreters.create(isolated=isolated)^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^RuntimeError:interpreter creation failedkTraceback (most recent call last):  File"/home/dje/cpython-buildarea/3.x.edelsohn-rhel-z/build/Lib/test/test_tools/test_freeze.py", line28, intest_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", line146, inprepare    copy_source_tree(srcdir,SRCDIR)  File"/home/dje/cpython-buildarea/3.x.edelsohn-rhel-z/build/Tools/freeze/test/freeze.py", line95, incopy_source_tree    shutil.copytree(oldroot, newroot,ignore=ignore_non_src)  File"/home/dje/cpython-buildarea/3.x.edelsohn-rhel-z/build/Lib/shutil.py", line588, incopytreereturn _copytree(entries=entries,src=src,dst=dst,symlinks=symlinks,^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  File"/home/dje/cpython-buildarea/3.x.edelsohn-rhel-z/build/Lib/shutil.py", line542, in_copytreeraise 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')]

@bedevere-bot
Copy link

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

Hi! The buildbots390x RHEL8 3.x has failed when building commit59073c9.

What do you need to do:

  1. Don't panic.
  2. Checkthe 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/509/builds/4921) and take a look at the build logs.
  4. Check if the failure is related to this commit (59073c9) 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/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", line788, intest_subprocess_consistent_callbacksself.loop.run_until_complete(main())  File"/home/dje/cpython-buildarea/3.x.edelsohn-rhel8-z/build/Lib/asyncio/base_events.py", line664, inrun_until_completereturn future.result()^^^^^^^^^^^^^^^  File"/home/dje/cpython-buildarea/3.x.edelsohn-rhel8-z/build/Lib/test/test_asyncio/test_subprocess.py", line780, inmainself.assertEqual(events, [AssertionError:Lists differ: ['process_exited', ('pipe_data_received', 1, b'stdout')] != [('pipe_data_received', 1, b'stdout'), ('p[95 chars]ted']

@bedevere-bot
Copy link

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

Hi! The buildbotPPC64LE Fedora Stable LTO + PGO 3.x has failed when building commit59073c9.

What do you need to do:

  1. Don't panic.
  2. Checkthe 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/101/builds/3754) and take a look at the build logs.
  4. Check if the failure is related to this commit (59073c9) 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/101/builds/3754

Failed tests:

  • test_venv

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", line580, intest_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", line588, incopytreereturn _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", line542, in_copytreeraise 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'")]

csm10495 pushed a commit to csm10495/cpython that referenced this pull requestSep 28, 2023
…n#109387)Deprecate `http.server.CGIHTTPRequestHandler`.Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
@Peterl777
Copy link

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

@vstinner
Copy link
Member

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.

@Peterl777
Copy link

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.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@JelleZijlstraJelleZijlstraJelleZijlstra left review comments

@serhiy-storchakaserhiy-storchakaserhiy-storchaka left review comments

@vstinnervstinnervstinner approved these changes

Assignees

@gpsheadgpshead

Labels
3.13bugs and security fixesdocsDocumentation in the Doc dirstdlibPython modules in the Lib dirtestsTests in the Lib/test dir
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

6 participants
@gpshead@vstinner@bedevere-bot@Peterl777@JelleZijlstra@serhiy-storchaka

[8]ページ先頭

©2009-2025 Movatter.jp