python / python/cpython

test_urllib2net fails in Python-3.13.11

Open
#143,507 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

tests type-bug
Dominant language
Python
Stars
77.2k
Forks
35.9k
PR merge metrics
PR metrics pending

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with Lib/test/test_urllib2net.py, especially TimeoutTest.test_ftp_basic, test_ftp_default_timeout, test_ftp_no_timeout, and test_ftp_timeout. Run test_urllib2net to reproduce the four errors and compare the failing HTTPResponse access with the linked PR gh-143506. Done means these tests pass on Python 3.13.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
networking
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.