python / python/cpython

Prevent CO_FUTURE_BARRY_AS_BDFL from being applied with PyCF_MASK

オープン
#123,234 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

interpreter-core type-bug
主要言語
Python
スター
77.2k
フォーク
35.9k
PR マージ指標
PR 指標を取得中

説明

Bug report

Bug description:

When compiling Python strings with the PyCF_MASK, the CO_FUTURE_BARRY_AS_BDFL is included and will be applied to the statement. It would be preferable if the PEP 401 easter egg was not applied to code compiled with the PyCF_MASK compiler flag by default.

Example:

static const char code[] = "1 != 2";
static PyCompilerFlags compiler_flags = { PyCF_MASK | PyCF_SOURCE_IS_UTF8 };
PyObject* n = Py_CompileStringFlags(code, "<string>", Py_single_input, &compiler_flags);

Will result change the result to 1 <> 2.

CPython versions tested on:

CPython main branch

Operating systems tested on:

macOS, Windows

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

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

はじめの一歩

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

調査の方向性

Include/cpython/compile.h の CO_FUTURE_BARRY_AS_BDFL の定義から始め、Py_CompileStringFlags が PyCF_MASK をどのように処理するかを追跡します。提供された C の例を CPython main で再現し、その後、PyCF_MASK がデフォルトで PEP 401 の動作を適用しなくなるように、カバレッジを追加または更新します。

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

評価

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

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

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