← 返回 stripe 的题目列表Requests Library Debug (BugSquash)
类型:qbank
Debug (BugSquash) round on a checkout of the Python `requests` library. Run the failing tests, trace into library internals, and fix the planted bugs. A newer alternative to the Mako round on the same format.
Requirements
A BugSquash round on a checkout of the Python requests library (a starter archive is provided). Run the failing tests, locate the planted bugs in the library internals, and fix them.
One reported bug centers on the seekable concept (re-reading / rewinding a request body stream) — an unfamiliar corner of the library for most candidates.
Notes
Same format as the Mako debug round but on a different, less-practiced repo, so community knowledge is thin. The interviewer is typically familiar even if you are not.
A useful tactic: when a test like test_1 fails, read the adjacent passing tests (test_0, test_2) — the suite is often serialized, with neighbors differing only in input, which quickly narrows where the bug must be.
Time is tight; prioritize tracing from the failing test's assertion back into the library over reading the whole codebase.
Preparation
Step through requests internals (models.py, sessions.py, prepared-request body handling) with an IDE debugger before the interview.
Practice the failing-test-first workflow: run the suite, pick one red test, set a breakpoint at its assertion, and trace inward.
Read up on how requests handles re-sending a body (the seekable / rewind path) so the reported bug class isn't new to you.