python / python/cpython

test_urllib2net fails in Python-3.13.11

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

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

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

説明

Bug report

Bug description:
======================================================================
ERROR: test_ftp_basic (test.test_urllib2net.TimeoutTest.test_ftp_basic)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/root/mohammed/python/Python-3.13.11/Lib/test/test_urllib2net.py", line 384, in test_ftp_basic
    self.assertIsNone(u.fp.fp.raw._sock.gettimeout())
                      ^^^^^^^
AttributeError: '_io.BufferedReader' object has no attribute 'fp'

======================================================================
ERROR: test_ftp_default_timeout (test.test_urllib2net.TimeoutTest.test_ftp_default_timeout)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/root/mohammed/python/Python-3.13.11/Lib/test/test_urllib2net.py", line 395, in test_ftp_default_timeout
    self.assertEqual(u.fp.fp.raw._sock.gettimeout(), 60)
                     ^^^^^^^
AttributeError: '_io.BufferedReader' object has no attribute 'fp'

======================================================================
ERROR: test_ftp_no_timeout (test.test_urllib2net.TimeoutTest.test_ftp_no_timeout)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/root/mohammed/python/Python-3.13.11/Lib/test/test_urllib2net.py", line 407, in test_ftp_no_timeout
    self.assertIsNone(u.fp.fp.raw._sock.gettimeout())
                      ^^^^^^^
AttributeError: '_io.BufferedReader' object has no attribute 'fp'

======================================================================
ERROR: test_ftp_timeout (test.test_urllib2net.TimeoutTest.test_ftp_timeout)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/root/mohammed/python/Python-3.13.11/Lib/test/test_urllib2net.py", line 414, in test_ftp_timeout
    self.assertEqual(u.fp.fp.raw._sock.gettimeout(), 60)
                     ^^^^^^^
AttributeError: '_io.BufferedReader' object has no attribute 'fp'

----------------------------------------------------------------------
Ran 16 tests in 31.503s

FAILED (errors=4, skipped=1)
test test_urllib2net failed
0:00:31 load avg: 2.49 [1/1/1] test_urllib2net failed (4 errors) in 31.7 sec

== Tests result: FAILURE ==

1 test failed:
    test_urllib2net

Total duration: 31.7 sec
Total tests: run=16 skipped=1
Total test files: run=1/1 failed=1
Result: FAILURE

I have built Python-3.13.11 from source and ran the test test_urllib2net in Linux ubuntu 6.8.0-53-generic. The test seems to fail because of typo in accessing fp from a HTTPResponse object. I have created a PR for the same

https://github.com/python/cpython/pull/143506

If this is a valid issue please merge the same.

CPython versions tested on:

3.13

Operating systems tested on:

Linux

Linked PRs
  • gh-143506

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

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

はじめの一歩

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

調査の方向性

Lib/test/test_urllib2net.py から始め、特に TimeoutTest.test_ftp_basic、test_ftp_default_timeout、test_ftp_no_timeout、test_ftp_timeout を確認してください。test_urllib2net を実行して 4 つのエラーを再現し、失敗している HTTPResponse へのアクセスをリンク先の PR gh-143506 と比較してください。これらのテストが Python 3.13 でパスすれば完了です。

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

評価

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

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

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