Skip to content

Forward modulus arguments in Float power methods - #691

Open
rudycelekli wants to merge 1 commit into
python-poetry:masterfrom
rudycelekli:fix/float-power-modulus-20261101
Open

rudycelekli wants to merge 1 commit into
python-poetry:masterfrom
rudycelekli:fix/float-power-modulus-20261101

Conversation

@rudycelekli

Copy link
Copy Markdown

Summary

Forward the modulus argument from Float.__pow__ and Float.__rpow__ to Python's native float methods.

Currently pow(item(2.0), 3, 3) returns 8.0, silently ignoring the modulus. The equivalent native-float call raises TypeError, because modular exponentiation is supported only for integers. Forwarding the argument preserves that native error rather than returning an unrelated numeric result. Two-argument powers and an explicit None modulus retain their existing behavior.

Duplicate Check

Validation

  • Native float methods provide the expected-result oracle.
  • Unchanged implementation: six new invalid-modulus cases fail; two None-modulus controls pass.
  • Corrected implementation: all 120 item tests pass; the complete suite passes 1,232 tests on Python 3.13.5, with the pinned toml-test submodule checked out.
  • Ruff check, Ruff format check, and git diff --check pass for the changed files.

Agent Drafting Metadata

  • Agent: OpenAI Codex
  • Model: inherited Codex subscription model; exact model identifier was not exposed to this worker.
  • Notes: AI-assisted implementation and tests. A separate agent inspected the diff and independently ran all eight power regressions. No human review or maintainer acceptance is claimed.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant