Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

sentry_sdk/integrations/pymongo.py:151: BytesWarning: str() on a bytes instance

オープン 初心者向け
#4,782 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
74/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
mongodb, python
領域
backend, databases

調査の方向性

sentry_sdk/integrations/pymongo.py:151 の started エントリポイントから始め、可能であれば BytesWarning を有効にして Python を実行しながら lsid の変換を確認してください。このパスで PyMongo 統合が BytesWarning を出力しなくなれば完了です。リポジトリに該当する回帰テストが用意されている場合は、それを追加または更新してください。

索引モデルが issue の本文から書いたものです。

説明

good first issue Improvement Integration: MongoDB Python Waiting for: Product Owner
How do you use Sentry?

Sentry Saas (sentry.io)

Version

2.37.0

Steps to Reproduce

From Discord:

If run Python with the BytesWarning mode (using the -b flag), i see this messages in my logs. This probably highlights a bug. If "b'...........'" string should be there, it should probably be replaced with repr() for better readability. Otherwise, we should use decode here.
https://github.com/getsentry/sentry-python/blob/master/sentry_sdk/integrations/pymongo.py#L151

Currently, I cannot provide a small code sample that reproduces this warning, but I can provide a part of stack trace that I generated.

  <.....>
  <.....>
  File "<***>/lib/python3.9/site-packages/pymongo/database.py", line 1005, in collection_names
    for result in self.list_collections(session=session, nameOnly=True, **kws)
  File "<***>/lib/python3.9/site-packages/pymongo/database.py", line 943, in list_collections
    return self.__client._retryable_read(_cmd, read_pref, session)
  File "<***>/lib/python3.9/site-packages/pymongo/mongo_client.py", line 1617, in _retryable_read
    return func(session, server, sock_info, secondary_ok)
  File "<***>/lib/python3.9/site-packages/pymongo/database.py", line 939, in _cmd
    return self._list_collections(
  File "<***>/lib/python3.9/site-packages/pymongo/database.py", line 880, in _list_collections
    cursor = self._command(
  File "<***>/lib/python3.9/site-packages/pymongo/database.py", line 703, in _command
    return sock_info.command(
  File "<***>/lib/python3.9/site-packages/pymongo/pool.py", line 740, in command
    return command(
  File "<***>/lib/python3.9/site-packages/pymongo/network.py", line 155, in command
    listeners.publish_command_start(
  File "<***>/lib/python3.9/site-packages/pymongo/monitoring.py", line 1412, in publish_command_start
    subscriber.started(event)
  File "<***>/lib/python3.9/site-packages/sentry_sdk/integrations/pymongo.py", line 151, in started
    data["operation_ids"]["session"] = str(lsid)

My versions:
Python 3.9.21
pymongo==3.13.0
sentry-sdk==2.37.0

Expected Result

No BytesWarning

Actual Result

BytesWarning

主要言語
Python
スター
2.2k
フォーク
672
平均マージ
22時間 47分
マージ済み PR(30日)
224

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

getsentry/sentry-python のほかの issue

getsentry/sentry-python の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。