Skip to content

Fix argument type check in classical ciphers - #42939

Merged
vbraun merged 1 commit into
sagemath:developfrom
EliNaig:fix-cipher-message-typecheck
Oct 18, 2026
Merged

vbraun merged 1 commit into
sagemath:developfrom
EliNaig:fix-cipher-message-typecheck

Conversation

@EliNaig

@EliNaig EliNaig commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #33658.

The input check in classical_cipher.py was written as
not isinstance(M, StringMonoidElement) and M.parent() == S, so it never raised
the TypeError. Passing a str gave an AttributeError instead. Fixed the condition
in all six ciphers and added two doctests.

📝 Checklist

  • The title is concise and informative.
  • The description explains in detail what this PR is about.
  • I have linked a relevant issue or discussion.
  • I have created tests covering the changes.
  • I have updated the documentation and checked the documentation preview.

⌛ Dependencies

None.

@vbraun
vbraun merged commit 73b924d into sagemath:develop Oct 18, 2026
2 checks passed
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.

Argument type checking in classical_cipher.py is buggy

2 participants