Skip to content

Conversation

@hovaesco
Copy link

Please answer these questions before submitting your pull requests. Thanks!

  1. What GitHub issue is this PR addressing? Make sure that there is an accompanying issue to your PR.

    No relevant GH issue.

  2. Fill out the following pre-review checklist:

    • I am adding a new automated test(s) to verify correctness of my new code
    • I am adding new logging messages
    • I am adding a new telemetry message
    • I am modifying authorization mechanisms
    • I am adding new credentials
    • I am modifying OCSP code
    • I am adding a new dependency
  3. Please describe how your code solves the related issue.

Fixes a TypeError that occurs on Python 3.13+ when performing PUT file operations. The storage client generates URLs as bytes, but the session manager (and vendored requests library) expects strings. Python 3.13's stricter type enforcement for string concatenation exposes this mismatch.

The fix decodes bytes URLs to UTF-8 strings before passing them to use_session(), ensuring type consistency across the request pipeline while maintaining backward compatibility with string URLs.

Note: This issue is specific to the LocalStack Snowflake emulator environment and is not reproducible with real Snowflake services. However, the fix improves type safety and ensures proper adherence to the use_session() type contract (which expects str, not bytes).

  1. (Optional) PR for stored-proc connector:

@hovaesco hovaesco requested a review from a team as a code owner November 28, 2025 09:32
@github-actions
Copy link

github-actions bot commented Nov 28, 2025

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@hovaesco
Copy link
Author

Related issue #2676

@sfc-gh-dszmolka sfc-gh-dszmolka changed the title Fix Python 3.13+ TypeError by decoding bytes URLs in storage client SNOW-2865839: Fix Python 3.13+ TypeError by decoding bytes URLs in storage client Nov 28, 2025
@sfc-gh-dszmolka sfc-gh-dszmolka changed the title SNOW-2865839: Fix Python 3.13+ TypeError by decoding bytes URLs in storage client Fix Python 3.13+ TypeError by decoding bytes URLs in storage client Nov 28, 2025
Copy link
Contributor

@sfc-gh-fpawlowski sfc-gh-fpawlowski left a comment

Choose a reason for hiding this comment

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

Hi, thanks for the PR!
Left one comment, but overall seems good.

logger.debug(f"retry #{self.retry_count[retry_id]}")
cur_timestamp = self.credentials.timestamp
url, rest_kwargs = get_request_args()
url = url.decode('utf-8') if isinstance(url, bytes) else url
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we move this check into the SessionManager.use_session? It should consistently accept both bytes and str as an input.

Copy link
Author

Choose a reason for hiding this comment

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

thanks, done!

@hovaesco
Copy link
Author

I have read the CLA Document and I hereby sign the CLA

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