Skip to content

fix(utils): preserve staticmethod wrappers - #2141

Open
stussysenik wants to merge 1 commit into
langfuse:mainfrom
stussysenik:fix/staticmethod-auto-decorate
Open

stussysenik wants to merge 1 commit into
langfuse:mainfrom
stussysenik:fix/staticmethod-auto-decorate

Conversation

@stussysenik

@stussysenik stussysenik commented Nov 19, 2026 •

Copy link
Copy Markdown

What does this PR do?

auto_decorate_methods_with() replaced @staticmethod descriptors with plain
functions because staticmethod is callable on Python 3.10+. Instance access
then bound self into a zero-self method and the decorator swallowed the
resulting TypeError. The callable guard now excludes staticmethod so the
existing staticmethod branch re-wraps __func__ and keeps the descriptor.

No issue: langfuse/langfuse-python restricts issue creation to
collaborators (GraphQL CreateIssue permission error, REST POST 404). The bug
and a runnable repro are reproduced in this PR body.

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Refactor
  • Documentation update
  • Tooling, CI, or repo maintenance

Verification

uv run --frozen ruff check .
uv run --frozen ruff format --check .
uv run --frozen mypy langfuse --no-error-summary
uv run --frozen pytest tests/unit/test_error_logging.py -q

Targeted: 3 passed. Ruff: pass. Mypy: exit 0. Full unit suite: 1012 passed /
26 errors, the same 26 test_prompt.py errors present on clean main.

Checklist

  • I self-reviewed the diff using code_review.md.
  • I added or updated tests for behavior changes.
  • I updated docs, examples, or .env.template if needed.
  • I did not hand-edit generated files; if generated files changed, I used the upstream regeneration path.
  • I did not commit secrets or credentials.

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; no actionable issues were found.

Summary

Preserves static methods when a class is decorated, so calling them through an instance no longer adds an unwanted argument.

  • Decorated static methods keep their static behavior when called through an instance.

No actionable issues found.

Reviews (1) · Last reviewed commit: "fix(utils): preserve staticmethod wrappe..." · Reviewed by Greptile

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant