Skip to content

[SPARK-56247][PYTHON] Fix the fall back behavior and type hint of inheritable_thread_target#55043

Closed
gaogaotiantian wants to merge 2 commits intoapache:masterfrom
gaogaotiantian:fix-inheritable-thread-target
Closed

[SPARK-56247][PYTHON] Fix the fall back behavior and type hint of inheritable_thread_target#55043
gaogaotiantian wants to merge 2 commits intoapache:masterfrom
gaogaotiantian:fix-inheritable-thread-target

Conversation

@gaogaotiantian
Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

  • Removed None from the possible input type hint
  • When f is a session, return a decorator instead of f if pinned thread mode is off

Why are the changes needed?

Th input f can't be None - we have no logic to deal with it. Also as a decorator, the way it works is to deal with

@inheritable_thread_target()
def f():
    ...

but we need special logic for this - we don't have that.

When pinned-thread mode is off (legacy, we don't care much, but still nice to have it right), we need @inheritable_thread_target(session) to be a no-op, instead of return session directly, which will raise an exception when we do session(f).

Does this PR introduce any user-facing change?

Not really, we are fixing an unexpected behavior.

How was this patch tested?

CI should pass. We don't really care too much about the legacy behavior though.

Was this patch authored or co-authored using generative AI tooling?

No.

@zhengruifeng
Copy link
Copy Markdown
Contributor

merged to master

@gaogaotiantian gaogaotiantian deleted the fix-inheritable-thread-target branch April 2, 2026 20:16
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.

2 participants