A class that raises on __qualname__ escapes the request type check as its own exception

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

メンテナーはふだん 1 日以内に返信

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

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
76/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
django, python
領域
api, backend

調査の方向性

Codec.sendの実装(mainではCodec.writeと呼ばれます)とそのdocstringを読み、リクエストの型チェックと関連するテストを見つけてください。__qualname__に対して例外を発生させる__getattribute__を持つメタクラスを使ったテストを追加し、結果のエラーが原因を保持するTypeErrorであることを確認してください。payloadにはテストファイル名が記載されていないため、既存のcodecテストを探してください。

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

説明

What happens. Codec.send (on main, Codec.write) promises a TypeError for a value that is not exactly the declared record. The message is built with type(value).__qualname__ outside any guard, so a value whose metaclass raises on __qualname__ surfaces as that exception, for example RuntimeError, at Pydantic 2.12.0 and 2.14.3.

Expected. A TypeError that keeps the cause, as the docstring says.

Impact. Minor: it fails closed, nothing is written or sent, and the class has to be built on purpose. Found while reviewing #43; main at 14309e7 behaves the same.

Fix. Build the wrong-type message with guarded name access, or turn any exception raised while building it into the TypeError. Test with a metaclass whose __getattribute__ raises for __qualname__.

主要言語
Python
スター
1
フォーク
0
平均マージ
5時間 30分
マージ済み PR(30日)
85

環境構築

はじめの一歩

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

stack314/django-neolith のほかの issue

stack314/django-neolith の issue をすべて見る

似ている issue

Python の issue をもっと見る

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

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