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 — TimeoutError has errno and strerror attributes set to None · Issue #109601 · python/cpython

TimeoutError has errno and strerror attributes set to None #109601

New issue
Copy link
New issue
Copy link
Open
Open
TimeoutError has errno and strerror attributes set to None#109601
Copy link
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@aminalaee
aminalaee
opened on Sep 20, 2023
Issue body actions

Bug report

Bug description:

According to the docs OSError https://docs.python.org/3/library/exceptions.html#OSError has the attributes errno and strerror (integer and string respectively) set on this class and sub-classes like TimeoutError https://docs.python.org/3/library/exceptions.html#TimeoutError

And the TimeoutError is mapped to errno https://docs.python.org/3/library/errno.html#errno.ETIMEDOUT which has a default value depending on the OS.

Is this a bug in how the TimeoutError is raised? Or can the attributes be None which should be documented?

import socket

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.settimeout(0.1)

try:
    s.connect(("10.10.10.10", 22))
except OSError as ex:
    print(repr(ex))
    print(f"errno is {type(ex.errno)} - {ex.errno}")
    print(f"strerror is {type(ex.strerror)} - {ex.strerror}")


# But the `FileNotFoundError` has the correct attributes are set

import os

try:
    os.listdir("non_existing_path")
except OSError as ex:
    print(repr(ex))
    print(f"errno is {type(ex.errno)} - {ex.errno}")
    print(f"strerror is {type(ex.strerror)} - {ex.strerror}")

Ref: python/typeshed#9864

CPython versions tested on:

3.11

Operating systems tested on:

Linux

Reacted by Sebastian Rittau, Alex Waygood, Avasam and Jeffrey Bosboom

Activity

  1. aminalaee
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    on Sep 20, 2023
  2. iritkatriel
    added
    stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory
    on Dec 1, 2023
  3. StanFromIreland commented on Aug 24, 2026

    @StanFromIreland
    StanFromIreland
    on Aug 24, 2026
    Member
    More actions

    Partly a duplicate: #83854

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402520 — 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.