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-148292: Update ssl._SSLSocket for OpenSSL 4 by vstinner · Pull Request #149102 · python/cpython

Conversation

@vstinner

@vstinner vstinner commented Apr 28, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

The _SSLSocket object now remembers if it gets an EOF error. In this case, read(), sendfile(), write() and do_handshake() method calls fail with SSLEOFError without calling the underlying OpenSSL function.

  • Issue: 3.15.0a8 fails test_urllib2_localnet with OpenSSL 4.0.0beta1 #148292

Sorry, something went wrong.

Uh oh!

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

All reactions
@vstinner
pythongh-148292: Update ssl._SSLSocket for OpenSSL 4
a05a9ce
The _SSLSocket object now remembers if it gets an EOF error. In this
case, read(), sendfile() and write() method calls fail with
SSLEOFError without calling the underlying OpenSSL function.
@vstinner
vstinner requested review from gpshead and picnixz as code owners April 28, 2026 15:58
@bedevere-app bedevere-app Bot added the awaiting core review label Apr 28, 2026
@bedevere-app bedevere-app Bot mentioned this pull request Apr 28, 2026
3.15.0a8 fails test_urllib2_localnet with OpenSSL 4.0.0beta1 #148292
Closed
@vstinner vstinner mentioned this pull request Apr 28, 2026
gh-148292: Update SSLSocket.read() for OpenSSL 4 #148602
Closed
vstinner added 5 commits April 28, 2026 18:05
@vstinner
Fix doc formatting (NEWS entry)
f803408
@vstinner
Skip sendfile() test if the SSL socket has no sendfile() method
cac2565
@vstinner
Use also got_eof_error in do_handshake()
ec5bb40
* Add more tests.
* Move set_eof_error() calls.
@vstinner
Update comment
43ef40c
@vstinner
Fix shutdown() test on OpenSSL 1.1.1
b852eef
@read-the-docs-community

read-the-docs-community Bot commented Apr 28, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #32472356 | 📁 Comparing 0f650cc against main (2b6a137)

  🔍 Preview build  

2 files changed
± download.html
± whatsnew/changelog.html
All reactions

Sorry, something went wrong.

Uh oh!

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

gpshead
gpshead reviewed Apr 28, 2026
View reviewed changes
Comment thread Modules/_ssl.c Resolved

Uh oh!

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

Comment thread Lib/test/test_ssl.py Resolved

Uh oh!

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

Comment thread Lib/test/test_ssl.py Resolved

Uh oh!

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

Comment thread Lib/test/test_ssl.py Resolved

Uh oh!

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

Comment thread Misc/NEWS.d/next/Library/2026-04-28-17-47-55.gh-issue-148292.oIq3ml.rst Resolved

Uh oh!

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

Comment thread Misc/NEWS.d/next/Library/2026-04-28-17-47-55.gh-issue-148292.oIq3ml.rst Outdated
@@ -0,0 +1,7 @@
:mod:`ssl`: Update :class:`ssl.SSLSocket` for OpenSSL 4. The class now
remembers if it gets a :exc:`ssl.SSLEOFError`. In this case, following
:meth:`~ssl.SSLSocket.read`, :meth:`!sendfile`, :meth:`~ssl.SSLSocket.write`,

@gpshead gpshead Apr 28, 2026

Copy link
Copy Markdown
Member

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.

:meth:~ssl.SSLSocket.sendfile ?

Sorry, something went wrong.

Uh oh!

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

All reactions

@vstinner vstinner Apr 29, 2026

Copy link
Copy Markdown
Member Author

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.

Using :meth:~ssl.SSLSocket.sendfile makes the documentation fails to build. It doesn't work since SSLSocket.sendfile() has no anchor at https://docs.python.org/dev/library/ssl.html#ssl.SSLSocket, but SSLSocket.sendfile() method is documented

Sorry, something went wrong.

Uh oh!

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

All reactions
vstinner and others added 3 commits April 29, 2026 12:59
@vstinner
Fix fill_and_set_sslerror() for NULL sslsock
49a1209
@vstinner @gpshead
Enhance test
278cefd
Co-authored-by: Gregory P. Smith <[email protected]>
@vstinner
Mention ssl.SSLObject in the NEWS entry
66db041
@vstinner

vstinner commented Apr 29, 2026

Copy link
Copy Markdown
Member Author

@gpshead: Please review the updated PR.

Note: Before, I didn't want to use self.addCleanup(server.join) in the test since the server could hang. I added the timeout that you suggested on the socket and so the server should no longer hang on error.

All reactions

Sorry, something went wrong.

Uh oh!

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

vstinner
vstinner commented Apr 29, 2026
View reviewed changes
Comment thread Misc/NEWS.d/next/Library/2026-04-28-17-47-55.gh-issue-148292.oIq3ml.rst Resolved

Uh oh!

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

Comment thread Lib/test/test_ssl.py Resolved

Uh oh!

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

@vstinner
Apply suggestions from code review
0f650cc
Co-authored-by: Victor Stinner <[email protected]>
@vstinner

vstinner commented Apr 30, 2026

Copy link
Copy Markdown
Member Author

@picnixz: Would you mind to review this change?

It would be nice to have OpenSSL 4 support in Python 3.15 beta1 (feature freeze is next Tuesday).

All reactions

Sorry, something went wrong.

Uh oh!

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

@vstinner
vstinner merged commit 7b7fa3f into python:main May 4, 2026
54 checks passed

Uh oh!

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

@vstinner
vstinner deleted the ssl_got_eof_error branch May 4, 2026 11:53
@bedevere-app bedevere-app Bot removed the awaiting core review label May 4, 2026
@HiassofT HiassofT mentioned this pull request May 6, 2026
OpenSSL: update to 4.0.x LibreELEC/LibreELEC.tv#11104
Open
vstinner added a commit to vstinner/cpython that referenced this pull request May 13, 2026
@vstinner @gpshead
pythongh-148292: Update _ssl._SSLSocket for OpenSSL 4 (python#149102)
3c2a301
The _SSLSocket object now remembers if it gets an EOF error. In this
case, read(), sendfile(), write() and do_handshake method calls fail
with SSLEOFError without calling the underlying OpenSSL function.

Co-authored-by: Gregory P. Smith <[email protected]>
(cherry picked from commit 7b7fa3f)
@xnox xnox mentioned this pull request Sep 12, 2026
Add support for OpenSSL 4.0.0 final #148600
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@gpshead gpshead gpshead left review comments
@picnixz picnixz Awaiting requested review from picnixz picnixz 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 @gpshead
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.