Repository navigation
zavod #53: Рукописные уроки 105–112 - #40
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HdAtUFHuCYJ3tWqyvJHqGt
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 89d54d248a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| _holds("pool_map(lambda x: x * 2, [1, 2, 3], 1) == [2, 4, 6]"), | ||
| _holds("pool_map(lambda x: x * 2, [], 2) == []"), | ||
| ], | ||
| "def pool_map(func, items, workers):\n return [func(item) for item in items]\n", |
There was a problem hiding this comment.
Make pool_map use its worker limit
When func performs slow or blocking work and workers > 1, this reference still invokes every item sequentially and never reads workers, so the exercise accepts an implementation with no thread pool or parallelism at all. The tests only compare returned values, allowing learners to pass the thread-pool lesson without satisfying the prompt's concurrency requirement; use a real pool (and enable the required module in the evaluator) or change the exercise contract.
Useful? React with 👍 / 👎.
| " if self.balance < amount:\n" | ||
| " return False\n" | ||
| " self.balance -= amount\n" |
There was a problem hiding this comment.
Guard withdraw with a real lock
When two threads call withdraw concurrently, both can pass the balance check before either debit completes, causing both calls to return True and potentially producing an overdrawn or lost-update balance. Merely placing the check and mutation in one method does not make them atomic, yet this is the reference answer for the locks lesson and the added tests exercise it only sequentially; initialize a lock and hold it across both operations.
Useful? React with 👍 / 👎.
Рукописные уроки 105–112
Круг: 1
Критерии
Изменённые файлы
app/handwritten/lessons_db_concurrency.pytests/test_handwritten_db_concurrency.py