Page MenuHomePhabricator

Rename TimeoutError exception to avoid collision with Python's built-in TimeoutError
Closed, ResolvedPublic

Description

Problem

Pywikibot defines its own TimeoutError exception in pywikibot.exceptions:

However, Python already provides the built-in TimeoutError exception. Using the same name can lead to ambiguity when reading code or writing exception handlers. Without additional context, it is unclear whether this refers to the built-in exception or pywikibot.exceptions.TimeoutError.

exception.TimeoutError was introduced with rPWBC956a903b (Pywikibot 3.0.20200508) but api.TimeoutError was introduced with a very first Pywikibot 2 release with rPWBCdcff6d3e.

Proposal

Rename` pywikibot.exceptions.TimeoutError` to a more specific name, for example:

  • RequestTimeoutError
  • ApiTimeoutError

Event Timeline

Xqt triaged this task as Low priority.Jul 4 2026, 10:55 AM
Prakhar0804 subscribed.

I'd like to work on this will propose ApiTimeoutError as the new name and keep TimeoutError as a deprecated alias for backward compatibility, following the project's existing deprecation conventions.

Change #1307599 had a related patch set uploaded (by Prakhar0804; author: Prakhar0804):

[pywikibot/core@master] Rename TimeoutError to ApiTimeoutError, keep old name as deprecated alias

https://gerrit.wikimedia.org/r/1307599

@Prakhar0804: Thanks a lot. Please add yourself to the AUTHORS.rst file if not already done.

Change #1307599 merged by Xqt:

[pywikibot/core@master] Rename TimeoutError to ApiTimeoutError, keep old name as deprecated alias

https://gerrit.wikimedia.org/r/1307599