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 — Preserve zero UNIX cutoffs in `CallbackDataCache.clear_callback_data` by CLCK0622 · Pull Request #5383 · python-telegram-bot/python-telegram-bot

Conversation

@CLCK0622

@CLCK0622 CLCK0622 commented Oct 20, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown

Fixes #5382

Passing 0 or 0.0 to clear_callback_data currently clears all cached keyboard data, although the equivalent UTC epoch datetime applies the documented "older than" cutoff. This can discard keyboards that are newer than the supplied cutoff.

Check time_cutoff is None before clearing the entire mapping. Numeric zero then follows the existing timestamp comparison path. The public API, datetime conversion, and clear_callback_queries() behavior remain unchanged.

Add a parametrized regression test for integer zero, float zero, UTC epoch datetime, explicit None, and a future timestamp. The fixture includes entries before, exactly at, and after the epoch, and checks that callback-query IDs are preserved. Existing tests continue covering omitted cutoffs, query-ID clearing, and positive timestamp/timezone conversion.

Validation on CPython 3.12.13, with sockets disabled:

python -m pytest tests/ext/test_callbackdatacache.py --disable-socket -vv

Original tests on original source: 47 passed, 2 skipped
Regression tests on original source: 2 failed, 50 passed, 2 skipped
Regression tests on patched source: 52 passed, 2 skipped

The two expected failures on the original source are the integer-zero and float-zero regression cases. The skipped tests concern running without the optional callback-data dependency, which is installed for this run. No Telegram requests are needed.

Changed-file checks also pass using the versions pinned in .pre-commit-config.yaml: Ruff 0.16.8 lint and formatting, Mypy 1.20.2, and Pylint 4.1.3 (the latter on CPython 3.14.6, as required by its hook). These tools were invoked directly; no hooks were installed.

Checklist:

  • Added regression tests and ran the affected test file.
  • Restored the existing documented contract without adding or changing public APIs.
  • Kept existing datetime, no-cutoff, and query-ID clearing behavior.

The repository's Chango workflow creates the changelog fragment for a PR. Suggested bug-fix note: "Fixed CallbackDataCache.clear_callback_data treating a zero UNIX timestamp cutoff as a request to clear all keyboard data."

AI disclosure: Codex assisted with part of the code and this description.

Sorry, something went wrong.

Uh oh!

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

All reactions
@CLCK0622
Preserve zero UNIX cutoffs in CallbackDataCache.clear_callback_data
0db39b1
Copilot AI balanced review requested due to automatic review settings October 20, 2026 16:33
Copilot AI reviewed Oct 20, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

Sorry, something went wrong.

Uh oh!

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

All reactions

This branch has not been deployed

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

Reviewers

Copilot code review Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments

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.

clear_callback_data treats a zero UNIX cutoff as a request to clear all data

Uh oh!

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

2 participants

@CLCK0622
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.