Employer interviews
Interviews are private. Sign in to see your group interviews.
Sign in…
This interview was not found. Maybe the data in this browser was cleared.
Interviews dashboardEasy questions are at the top, and harder ones sit under their basic question. If a basic question gets a weak score, the questions under it fade.
1. Default arguments in the cart helper
Question: In our online shop, every new visitor gets a cart from this helper. The service runs for days without a restart. Here is the code:
from datetime import datetime
def create_cart(
customer_id: int,
items: list[str] = [],
created_at: datetime = datetime.now(),
) -> dict:
return {
"customer_id": customer_id,
"items": items,
"created_at": created_at,
}
def add_to_cart(cart: dict, sku: str) -> None:
cart["items"].append(sku)
You see this in code review. What do you think? Is there a problem?
Short answer: Both default values are created once, when Python runs the def line, not on every call. So every cart made without an items argument shares one list, and every cart gets the same created_at time: the time the module was imported. The fix is None as the default, and a new value inside the function.
Hint (if the candidate says there is no problem): Customer A adds shoes. Then customer B opens the site for the first time, and her cart already has shoes. Also, every cart in the database has the same created_at time, the time the server started.
Why does this happen? (step by step)
- When the module is imported, Python runs the def line. At that moment it evaluates the default values: it makes one empty list and calls datetime.now one time.
- Python stores these two objects on the function object (in its defaults attribute).
- The call for customer A gets no items argument, so items is that stored list. The add_to_cart function appends “shoes” to it.
- The call for customer B also gets no items argument. It gets the same list, which now has “shoes”.
- The time has the same story. It was computed once, so all carts get the start time of the server. A datetime is immutable, so it does not “fill up”, but it is still the wrong value.
The fix:
from datetime import datetime, timezone
def create_cart(
customer_id: int,
items: list[str] | None = None,
created_at: datetime | None = None,
) -> dict:
return {
"customer_id": customer_id,
# a new list on every call
"items": list(items) if items is not None else [],
"created_at": created_at or datetime.now(timezone.utc),
}
- None is immutable and is a clear signal for “not given”.
- The list function also makes a copy when the caller passes a list. So the cart does not share the caller’s list either.
- Use a time zone aware time (UTC) for stored times. A naive datetime has no time zone, and that causes bugs between servers.
- Linters catch this. Ruff, with its flake8-bugbear rules, warns about mutable defaults and about function calls in defaults. Pylint warns about mutable defaults. Turn these rules on in CI.
Follow-up question: Is a mutable default always a bug? Have you seen it used on purpose?
Follow-up answer:
- It is sometimes used on purpose as a tiny cache, because the default lives as long as the function. For example, a dict default that keeps results between calls.
- But this is hidden state. It is not thread-safe, and it is hard for the next reader to see. A clear tool is better: functools.lru_cache, functools.cache, or a module-level dict with a name that says what it is.
- A default of an immutable value, like a tuple or a frozenset, is safe.
Red flag: Says “Python creates a new list on every call”, or fixes only the list and does not see the same problem in the created_at default.
Show answer
2. The daily sales report
Question: Every night, our shop builds a small sales report from the orders of the day (a few thousand orders). A developer wrote a helper to “save memory” and used it in the report:
def paid_orders(orders: list[dict]):
return (o for o in orders if o["status"] == "paid")
def daily_report(orders: list[dict]) -> dict:
paid = paid_orders(orders)
total = sum(o["amount"] for o in paid)
biggest = max((o["amount"] for o in paid), default=0)
count = len(list(paid))
return {"total": total, "biggest": biggest, "count": count}
You see this in code review. What do you think? Is there a problem?
Short answer: The paid_orders function returns a generator, and a generator can be read only once. The sum line reads all of it. After that, the generator is empty, so biggest is always 0 and count is always 0. There is no error, only wrong numbers. The fix: keep the paid orders in a list, or compute all three values in one loop.
Hint (if the candidate says there is no problem): The report for yesterday says: total 12,400 euros, biggest order 0, number of paid orders 0.
Why does this happen? (step by step)
- The expression in parentheses with for inside is a generator expression. It does not build a list. It makes an iterator that gives one order each time someone asks.
- The sum line asks for items until the generator says “no more” (StopIteration). Now the generator is at the end.
- The max line asks the same generator for items. It is already at the end, so it gives nothing. The default option hides this and returns 0.
- The list call also gets nothing, so count is 0.
- Nothing raises an error. Without the default option, max would raise a ValueError, and the bug would be easier to see. Here it was hidden.
The fix:
def daily_report(orders: list[dict]) -> dict:
# a list can be read many times
paid = [o for o in orders if o["status"] == "paid"]
amounts = [o["amount"] for o in paid]
return {
"total": sum(amounts),
"biggest": max(amounts, default=0),
"count": len(amounts),
}
- A few thousand orders are already in memory as a list. A second small list costs almost nothing. The generator saved no real memory here.
- If the helper should stay, its name and type hint must say what it returns, for example Iterator of dict. Then the reader knows it is single-use.
- A test with two or three orders would have found this bug at once. A report function needs at least one test with known numbers.
Follow-up question: Now the report must run over 50 million orders that are streamed from the database. They do not fit in memory. What do you do?
Follow-up answer:
- Then a generator is the right tool, but read it only once, and compute everything in that one loop:
def daily_report(orders) -> dict:
total, biggest, count = 0, 0, 0
for o in orders: # one pass over the stream
if o["status"] != "paid":
continue
total += o["amount"]
biggest = max(biggest, o["amount"])
count += 1
return {"total": total, "biggest": biggest, "count": count}
- Even better, let the database do it with one SQL query that has SUM, MAX and COUNT. Then 50 million rows never travel over the network.
- The itertools.tee function can split one iterator into several. But if one copy runs ahead, tee must keep all the items in between in memory, so it does not help here.
Red flag: Says “a generator is just a lazy list, you can loop over it again”, or blames the data (“maybe there were no paid orders”) instead of reading the code.
Show answer
3. Cart lines in a set
Question: This is the cart model of our online shop. A cart line is one product and its quantity. The developer wanted no duplicate lines, so the cart keeps them in a set:
from dataclasses import dataclass
@dataclass(unsafe_hash=True)
class CartLine:
sku: str
quantity: int
class Cart:
def __init__(self) -> None:
self.lines: set[CartLine] = set()
def add(self, sku: str) -> None:
for line in self.lines:
if line.sku == sku:
line.quantity += 1
return
self.lines.add(CartLine(sku, 1))
def remove(self, sku: str, quantity: int) -> None:
self.lines.discard(CartLine(sku, quantity))
You see this in code review. What do you think? Is there a problem?
Short answer: The hash of a CartLine is made from sku and quantity, and quantity changes while the line is inside the set. A set puts each object in a slot chosen by its hash when it is added. After the quantity changes, the set looks in the wrong slot. So remove does nothing, the in operator says False, and “duplicate” lines can appear. Objects in a set (or keys in a dict) must not change the fields their hash uses.
Hint (if the candidate says there is no problem): A customer adds shoes twice, then presses “remove”. The shoes stay in the cart. Then she adds shoes again from another page, and now the cart shows two lines that both say “shoes, 2”.
Why does this happen? (step by step)
- Without the option, a dataclass with eq (the default) sets hash to None, and adding it to a set fails with “unhashable type”. That is probably why the developer added unsafe_hash. It forces a hash made from all fields. The name of the option is a warning.
- The first add makes the line shoes and 1. The set computes the hash of the pair shoes and 1, and stores the object in the slot for that hash.
- The second add changes quantity to 2 in place. The object is still in the old slot, but its hash is now the hash of the pair shoes and 2.
- The remove call makes a new line shoes and 2, and looks in the slot for its hash. The old object is not there. The discard method finds nothing and quietly does nothing.
- The add method of the set has the same problem: it looks in the new slot, finds nothing equal there, and adds a second object, even though an equal one is already inside.
The fix: key the cart by the thing that does not change, and keep the changing value as the value:
class Cart:
def __init__(self) -> None:
self.quantities: dict[str, int] = {} # sku -> quantity
def add(self, sku: str, quantity: int = 1) -> None:
self.quantities[sku] = self.quantities.get(sku, 0) + quantity
def remove(self, sku: str) -> None:
self.quantities.pop(sku, None)
- The key (sku) is a string, and strings are immutable. Its hash never changes.
- The add method is now one dict lookup, not a loop over every line.
- If you need a value object in a set, make it a frozen dataclass. Then changing a field raises an error instead of silently breaking the set.
- The rule to remember: equal objects must have equal hashes, and the hash must not change while the object is in a set or is a dict key.
Follow-up question: When is the unsafe_hash option, or a hand-written hash on a mutable class, acceptable?
Follow-up answer:
- When the hash uses only fields that never change after the object is created, for example an id. Then the object can change other fields safely.
- A common pattern for entities: eq and hash use only the id. Two objects with the same id are the same entity.
- The dataclass field function has a hash option and a compare option, so you can leave a field out of the hash.
- If none of this is true, the object should not be in a set or be a dict key.
Red flag: “The set takes care of duplicates”, or a fix that removes the line by looping over the set and comparing sku, which hides the problem but keeps the broken set.
Show answer
4. Making the nightly scoring job faster
Concurrency in Python· in roadmap
Question: Every night, our shop computes a “loyalty score” for 2 million customers. The code is pure Python: loops and math over each customer’s orders. Today the job takes about 40 minutes. It runs on a server with 16 cores and the normal CPython 3.14 build. A developer opened this pull request. The description says: “Use 16 threads, so it should be about 16 times faster.”
from concurrent.futures import ThreadPoolExecutor
def score_customer(customer: dict) -> float:
score = 0.0
for order in customer["orders"]:
age_days = order["age_days"]
score += order["amount"] * (0.5 ** (age_days / 90))
return round(score, 2)
def score_all(customers: list[dict]) -> dict[int, float]:
with ThreadPoolExecutor(max_workers=16) as pool:
scores = list(pool.map(score_customer, customers))
return {c["id"]: s for c, s in zip(customers, scores)}
You review this pull request. What do you think? Is there a problem?
Short answer: The work is CPU-bound pure Python. In the normal CPython build, the GIL lets only one thread run Python bytecode at a time. So 16 threads take turns on one core, and the job will take about the same 40 minutes, maybe a bit more because of switching. For CPU work, use processes (ProcessPoolExecutor), send big chunks, and measure.
Hint (if the candidate says there is no problem): After the merge, the job still takes 41 minutes. The monitoring shows the process at about 100% CPU, which is one core, not 1600%.
Why does this happen? (step by step)
- A thread must hold the GIL to run Python code. There is one GIL for each interpreter.
- The score_customer function never waits for I/O. It only computes. So no thread lets go of the GIL to wait.
- The interpreter makes the running thread let go of the GIL after a short time slice (the switch interval), so the threads take turns. But at any moment only one of them runs.
- Total CPU work is the same, but it now runs on one core with extra switching. No speed-up.
- Threads would help if each customer needed a network call or a database query, because a thread lets go of the GIL while it waits.
The fix:
from concurrent.futures import ProcessPoolExecutor
def score_batch(batch: list[dict]) -> list[tuple[int, float]]:
return [(c["id"], score_customer(c)) for c in batch]
def batches(items: list, size: int):
for start in range(0, len(items), size):
yield items[start:start + size]
def score_all(customers: list[dict]) -> dict[int, float]:
result: dict[int, float] = {}
# one process per core by default
with ProcessPoolExecutor() as pool:
for part in pool.map(score_batch, batches(customers, 20_000)):
result.update(part)
return result
if __name__ == "__main__":
...
- Each process has its own interpreter and its own GIL, so 16 processes really use 16 cores.
- Arguments and results are pickled and copied between processes. Batches of thousands of customers make this cost small compared to the work. One customer per call would make the copying the slow part.
- Send only the data the function needs (amounts and ages), not whole customer objects with names and addresses.
- Functions must be at the top level of a module, so they can be pickled. The main guard is needed because worker processes import the main module again (spawn and forkserver start methods).
- Measure before and after. Also ask if Python is the right place: maybe one SQL query, or NumPy on columns, does this in seconds.
Follow-up question: Python 3.14 has an officially supported free-threaded build. Would the thread version be fine there?
Follow-up answer:
- In the free-threaded build (for example, the interpreter named python3.14t), threads can run Python code on several cores at the same time, so this kind of code can get faster with threads.
- But it is an optional, separate build. The normal build that most servers and Docker images use still has the GIL.
- Every C extension the job uses must support the free-threaded build. Single-threaded code is somewhat slower there.
- Shared changing data then needs locks even more, because there is no GIL that makes some races rare.
- So today: processes for CPU work in production, and test the free-threaded build with real measurements before you depend on it.
Red flag: “Threads always make things faster on a multi-core machine”, or the opposite myth: “Python cannot use more than one core at all.”
Show answer
5. Stock reservation in a thread pool
Concurrency in Python· in roadmap
Question: A small service of our shop reserves stock during a sale. It is one Python process. It reads order messages from a queue and handles them on a pool of 32 threads, because each order also calls the payment service. Stock is kept in memory and saved to the database every minute. Here is the reservation code:
from concurrent.futures import ThreadPoolExecutor
stock: dict[str, int] = {"shoes": 10}
def reserve(sku: str, quantity: int) -> bool:
# The GIL makes this safe, we do not need a lock
if stock[sku] >= quantity:
stock[sku] -= quantity
return True
return False
def handle(order: dict) -> None:
if reserve(order["sku"], order["quantity"]):
charge_payment(order) # network call, about 200 ms
pool = ThreadPoolExecutor(max_workers=32)
for order in read_orders():
pool.submit(handle, order)
You see this in code review. What do you think? Is there a problem?
Short answer: The comment is wrong. The GIL protects the interpreter, not this logic. The check (is there enough stock?) and the change (take it away) are separate steps, and a thread can be switched out between them. Two threads can both see 1 pair left and both reserve it. The minus-equals line itself is also several steps (read, subtract, write). The whole check-and-change must be one atomic step, with a lock. Also, the futures are never read, so errors in handle disappear.
Hint (if the candidate says there is no problem): After the sale, 12 orders for shoes were paid, but there were only 10 pairs. In load tests it happened only sometimes, and in normal days never.
Why does this happen? (step by step)
- Stock is 1. Thread A runs the if line and sees that 1 is at least 1. The condition is true.
- Before thread A runs the next line, the interpreter switches to thread B. Switches can happen between bytecodes, so this is allowed.
- Thread B also checks the stock. It is still 1, so its condition is true too.
- Both threads subtract. Stock becomes -1, and two customers got the last pair.
- The bug is rare because the window is tiny. So tests pass, and it shows up on the busiest day, when many threads run this code at the same time.
The fix:
import logging
import threading
from concurrent.futures import ThreadPoolExecutor, Future
stock: dict[str, int] = {"shoes": 10}
stock_lock = threading.Lock()
def reserve(sku: str, quantity: int) -> bool:
# check and change as one step
with stock_lock:
if stock[sku] >= quantity:
stock[sku] -= quantity
return True
return False
def log_error(future: Future) -> None:
if (error := future.exception()) is not None:
logging.error("order failed", exc_info=error)
with ThreadPoolExecutor(max_workers=32) as pool:
for order in read_orders():
pool.submit(handle, order).add_done_callback(log_error)
- The lock covers both the check and the change. No thread can see the stock between them.
- Keep the lock short. The payment call is outside the lock. Holding a lock during a 200 ms network call would make all 32 threads wait in line.
- If payment fails, the stock must go back, with the same lock. Reservations and releases must both be atomic.
- Read the result or the exception of each future, or the errors are lost.
Follow-up question: Next month we run 4 copies of this service on Kubernetes. Does the lock still protect the stock?
Follow-up answer:
- No. A threading lock works only inside one process. Each pod has its own dict and its own lock, so each pod thinks it has 10 pairs.
- The stock must live in one shared place that can do the check and change atomically. For example, one conditional UPDATE in the database: UPDATE products SET stock = stock - quantity WHERE sku = given sku AND stock >= quantity. Then check that one row changed.
- Or use an atomic command in Redis (for example DECRBY, or a Lua script for check-and-change).
- Saving in-memory stock “every minute” also loses reservations on a crash. The database should be the source of truth.
Red flag: “Python has a GIL, so dict operations are thread-safe, so this is safe.” Single dict operations are atomic in CPython, but a check and a change in two lines are not one operation.
Show answer
6. The shipping price endpoint
Async Python with asyncio· in roadmapWeb APIs with FastAPI· in roadmap
Question: Our shop API runs with FastAPI on 4 pods, one Uvicorn worker per pod. A new endpoint returns the shipping price from a carrier API. The carrier sometimes answers slowly, so the developer added a simple retry:
import time
import requests
from fastapi import FastAPI
app = FastAPI()
CARRIER_URL = "https://carrier.example/price"
@app.get("/shipping-price")
async def shipping_price(country: str, weight_kg: float):
for attempt in range(3):
try:
response = requests.get(
CARRIER_URL,
params={"country": country, "kg": weight_kg},
timeout=5,
)
return response.json()
except requests.RequestException:
time.sleep(2 ** attempt) # wait 1, 2, 4 seconds
return {"price": None}
You see this in code review. What do you think? Is there a problem?
Short answer: The endpoint is async def, so it runs on the event loop. But requests and time.sleep are blocking. While one request waits for the carrier (up to 5 seconds per try) or sleeps, the worker cannot run anything else. Every other endpoint on that pod waits too. Fix: make it a normal def endpoint (FastAPI runs it in a thread pool), or use an async client like httpx with await and asyncio.sleep.
Hint (if the candidate says there is no problem): On the day the carrier is slow, the p99 latency of all endpoints goes up, even the product list and the health check. Kubernetes restarts some pods because the liveness probe times out.
Why does this happen? (step by step)
- FastAPI calls an async def endpoint directly on the event loop of the worker. One worker has one event loop in one thread.
- The requests library waits for the network inside that thread. It never gives control back to the loop.
- The time.sleep function stops the whole thread, not only this request. With three tries, one request can hold the loop for up to 5 + 1 + 5 + 2 + 5 seconds.
- During that time, the loop cannot accept or answer other requests: product pages, health checks, everything.
- With one worker per pod, a few slow carrier calls are enough to freeze the pod. The health check fails and Kubernetes restarts it. So a slow partner becomes an outage of the whole API.
The fix (option 1, async all the way):
import asyncio
import httpx
client = httpx.AsyncClient(timeout=5) # one client, reused
@app.get("/shipping-price")
async def shipping_price(country: str, weight_kg: float):
params = {"country": country, "kg": weight_kg}
for attempt in range(3):
try:
response = await client.get(CARRIER_URL, params=params)
response.raise_for_status()
return response.json()
except httpx.HTTPError:
await asyncio.sleep(2 ** attempt) # only this task waits
return {"price": None}
The fix (option 2, keep the sync library): write def instead of async def, and keep requests. FastAPI runs def endpoints in a thread pool, so the loop stays free. The limit is the size of the thread pool.
- With await, the request pauses and the loop serves other requests in the meantime.
- Reuse one client. It keeps a connection pool. Creating a new client per request opens new connections every time.
- The old code also never checked the status code. A 500 page from the carrier would be parsed as JSON, or fail with an error that is not a RequestException.
- Set a total time budget for the endpoint too (for example with asyncio.timeout), so three tries cannot take 20 seconds.
Follow-up question: How would you find this kind of problem in production, if you did not know which endpoint causes it?
Follow-up answer:
- The asyncio debug mode logs callbacks that take longer than a set time (slow_callback_duration). It shows which code blocks the loop.
- Since Python 3.14, the command “python -m asyncio ps” (with the process id) shows the running tasks and where each one waits.
- Tracing (for example OpenTelemetry) shows that all requests on one pod slow down at the same time, which points to a blocked loop and not to a slow database.
- A linter rule can help too: Ruff has rules that flag blocking calls like time.sleep and sync HTTP calls inside async functions.
Red flag: “async def is always faster, so every endpoint should be async def”, without checking whether the code inside is really async.
Show answer
7. A retry loop for order events
Async Python with asyncio· in roadmap
Question: After an order is saved, our async checkout service publishes an “order created” event to the message broker. The broker is sometimes unavailable for a few seconds, so the developer wrote a retry loop. The checkout request gives it at most 3 seconds:
import asyncio
import logging
logger = logging.getLogger(__name__)
async def publish_order_event(event: dict) -> None:
while True:
try:
await broker.publish("orders", event)
return
except: # retry on any problem
logger.warning("publish failed, retrying")
await asyncio.sleep(1)
async def finish_checkout(order: dict) -> None:
async with asyncio.timeout(3):
await publish_order_event({"order_id": order["id"]})
You see this in code review. What do you think? Is there a problem?
Short answer: The bare except catches everything, including asyncio.CancelledError. A timeout and a shutdown both work by cancelling the task, and the cancel arrives as a CancelledError at the await where the task waits, usually inside broker.publish. The loop catches it, logs a warning, and tries again. So the 3-second timeout often does not work, and the service cannot shut down cleanly. Catch only Exception (or the broker’s error types), limit the number of tries, and never swallow CancelledError.
Hint (if the candidate says there is no problem): When the broker is down for 10 minutes, checkout requests hang for minutes instead of 3 seconds. During a deploy, old pods do not stop. Kubernetes kills them after the grace period, and some orders are lost.
Why does this happen? (step by step)
- After 3 seconds, the asyncio.timeout block cancels the current task.
- Cancelling means: asyncio raises CancelledError inside the task, at the await where it is waiting now. Most of the time this is the publish call, which is inside the try.
- The bare except catches every exception, also BaseException types like CancelledError (and KeyboardInterrupt and SystemExit).
- The loop logs “publish failed” and tries again. The cancel was delivered once and is now gone. The task keeps running forever while the broker is down.
- The timeout block raises TimeoutError only when a CancelledError comes out of it. It never does, so the request just hangs. On shutdown the same thing happens: the task ignores the cancel, and the process waits until it is killed.
The fix:
import asyncio
import logging
logger = logging.getLogger(__name__)
async def publish_order_event(event: dict, tries: int = 3) -> None:
for attempt in range(1, tries + 1):
try:
await broker.publish("orders", event)
return
except ConnectionError: # only errors we can retry
if attempt == tries:
raise
logger.warning("publish failed", extra={"try": attempt})
await asyncio.sleep(0.5 * 2 ** attempt)
- Catch only the errors you know how to handle. Exception also works, but an exact type is better. CancelledError is a BaseException since Python 3.8, so neither catches it.
- Limit the tries, and raise at the end. The caller decides what happens next.
- If you really must catch CancelledError (for cleanup), do the cleanup and then raise it again.
- A better design for this case is the outbox pattern: save the event in the same database transaction as the order, and let a separate worker publish it. Then the request does not wait for the broker at all, and no event is lost.
Follow-up question: What happens with a TaskGroup if one task in it swallows CancelledError like this?
Follow-up answer:
- When one task in a TaskGroup fails, the group cancels the other tasks and waits for them to finish.
- A task that swallows the cancel never finishes. So the async with block of the group never exits, and the error of the first task is never raised to the caller.
- The same is true for asyncio.run at shutdown: it cancels the remaining tasks and waits for them.
- So one bare except can freeze a whole group or a whole program. Linters warn about a bare except (for example, the rule E722 in Ruff and pycodestyle).
Red flag: “A bare except is fine in a retry loop, because we want to retry everything”, or a candidate who does not know that timeouts in asyncio work by cancellation.
Show answer
8. One database session for the whole API
Web APIs with FastAPI· in roadmapTransactions and isolation levels· in roadmap
Question: This is the database setup of our shop API (FastAPI and SQLAlchemy 2, sync driver, PostgreSQL). The developer wrote: “Creating a session is slow, so we make one at startup and reuse it.”
from fastapi import FastAPI, HTTPException
from sqlalchemy import create_engine, select
from sqlalchemy.orm import Session
engine = create_engine("postgresql+psycopg://shop@db/shop")
db = Session(engine) # one session for the app
app = FastAPI()
@app.post("/orders/{order_id}/pay")
def pay_order(order_id: int):
order = db.get(Order, order_id)
if order is None:
raise HTTPException(status_code=404)
order.status = "paid"
db.commit()
return {"id": order.id, "status": order.status}
@app.get("/products")
def list_products():
rows = db.scalars(select(Product).limit(50))
return [{"id": p.id, "name": p.name} for p in rows]
You see this in code review. What do you think? Is there a problem?
Short answer: One global Session is shared by all requests. FastAPI runs def endpoints in a thread pool, so several requests use this Session at the same time, but a Session is not thread-safe. Requests also share one transaction and one identity map: one request can commit another request’s half-done changes, a failed query breaks the session for everyone, and old cached objects are returned. Use one Session per request with a yield dependency. Only the engine (and its connection pool) is shared.
Hint (if the candidate says there is no problem): Under load, the logs show errors like “This Session’s transaction has been rolled back due to a previous exception during flush” or “Can’t reconnect until invalid transaction is rolled back”. After one failed payment, every request fails until the pod restarts.
Why does this happen? (step by step)
- Each def endpoint runs on a thread from FastAPI’s thread pool. Ten requests at once means ten threads.
- All of them call methods on the same Session object. A Session keeps internal state (the current transaction, the list of changed objects) without locks. Two threads changing it at the same time give broken state and random errors.
- A Session holds one transaction. Request A changes an order, request B calls commit, and A’s change is saved before A decided to save it.
- If one query fails (for example a constraint error), the transaction is broken until someone calls rollback. Nobody does, so every next request on this session fails too.
- The Session also caches loaded objects (the identity map). Long-lived, it grows and returns stale data.
- And “creating a session is slow” is not true. A Session is cheap. The slow part is a new database connection, and the engine’s pool already reuses connections.
The fix:
from collections.abc import Iterator
from typing import Annotated
from fastapi import Depends
from sqlalchemy.orm import sessionmaker
engine = create_engine(
"postgresql+psycopg://shop@db/shop",
pool_size=10,
pool_pre_ping=True,
)
SessionLocal = sessionmaker(engine, expire_on_commit=False)
def get_db() -> Iterator[Session]:
with SessionLocal() as session: # closed after the request
yield session
DbSession = Annotated[Session, Depends(get_db)]
@app.post("/orders/{order_id}/pay")
def pay_order(order_id: int, db: DbSession):
with db.begin(): # commit, or rollback on error
order = db.get(Order, order_id)
if order is None:
raise HTTPException(status_code=404)
order.status = "paid"
return {"id": order.id, "status": order.status}
- Each request gets its own Session, so no threads share one.
- The begin block commits at the end, or rolls back if an error is raised. A failed request cannot break the next one.
- The engine is created once. Its pool_size should fit the number of threads and pods: 4 pods with a pool of 10 can open up to 40 connections (more with overflow), which must stay below the database limit.
- The paying itself has another problem: two requests can pay the same order at the same time. Use a conditional update (only if status is still “new”) or a row lock.
Follow-up question: We move to async def endpoints with an async SQLAlchemy session. Is a global AsyncSession fine now, because there is only one thread?
Follow-up answer:
- No. An AsyncSession is also not safe for concurrent use. Many tasks run on one thread, and they switch at every await, so two requests can still use one session in the middle of each other’s work.
- The same rule holds: one AsyncSession per request (or per task), from an async yield dependency.
- Also do not share one session between tasks of one TaskGroup. Give each task its own session, or run the queries one after another.
Red flag: “The GIL makes it thread-safe”, or “just add a lock around the session”. A lock would make the whole API handle one database request at a time.
Show answer
9. Creating an order from the request body
Web APIs with FastAPI· in roadmapSecurity· in roadmapAPI design· in roadmap
Question: This is the endpoint that creates an order in our shop API. The mobile app sends the cart lines, the shipping address and maybe a coupon. The developer said: “With a plain dict we never have to change the API when the app adds a field.”
class Order(Base):
__tablename__ = "orders"
id: Mapped[int] = mapped_column(primary_key=True)
customer_id: Mapped[int]
lines: Mapped[list] = mapped_column(JSON)
address: Mapped[str]
total: Mapped[Decimal]
status: Mapped[str] = mapped_column(default="new")
fraud_score: Mapped[float] = mapped_column(default=0)
def to_dict(self) -> dict:
return {c.name: getattr(self, c.name)
for c in self.__table__.columns}
@app.post("/orders")
def create_order(payload: dict, user: CurrentUser, db: DbSession):
order = Order(**payload)
order.customer_id = user.id
db.add(order)
db.commit()
return order.to_dict()
You see this in code review. What do you think? Is there a problem?
Short answer: This is mass assignment. Every key the client sends becomes a column value, so a client can send its own total (0.01 euros), status (“paid”) or fraud_score (0). Nothing is validated: quantities, types and the address can be anything. The answer also sends back every column, including the internal fraud_score. Fix: a Pydantic input model with only the fields the client may set, compute total and status on the server, and a separate output model.
Hint (if the candidate says there is no problem): A security researcher sends this body: lines with one TV, the address, and also “total”: 0.01 and “status”: “paid”. The order goes to the warehouse as paid.
Why does this happen? (step by step)
- The payload dict comes straight from the JSON body. FastAPI does not check anything inside a plain dict.
- Order(**payload) passes every key as a keyword argument to the model. SQLAlchemy sets every mapped column it gets.
- The client sends total and status. They are columns, so they are saved, and the server never computes the real total.
- A key that is not a column (a typo, or a new app field) makes the constructor raise a TypeError, which becomes a 500 error, not a clear 422.
- The to_dict method returns all columns. Today that leaks fraud_score. Tomorrow someone adds a column like internal_note or cost_price, and it leaks too, with no code review of the API.
The fix:
from decimal import Decimal
from pydantic import BaseModel, ConfigDict, Field
class OrderLineIn(BaseModel):
product_id: int
quantity: int = Field(gt=0, le=20)
class OrderIn(BaseModel):
model_config = ConfigDict(extra="forbid") # unknown keys: 422
lines: list[OrderLineIn] = Field(min_length=1, max_length=50)
address: str = Field(min_length=5, max_length=300)
coupon: str | None = None
class OrderOut(BaseModel):
model_config = ConfigDict(from_attributes=True)
id: int
total: Decimal
status: str
@app.post("/orders", response_model=OrderOut, status_code=201)
def create_order(order_in: OrderIn, user: CurrentUser,
db: DbSession):
total = price_lines(db, order_in.lines, order_in.coupon)
order = Order(
customer_id=user.id,
lines=[line.model_dump() for line in order_in.lines],
address=order_in.address,
total=total, # computed on the server
)
db.add(order)
db.commit()
return order
- The input model is an allow-list. The client can set only lines, address and coupon. With extra set to “forbid”, unknown keys get a clear 422. With the default (“ignore”), they are dropped silently.
- The server computes the total from the database prices, and the status starts as “new”.
- The output model is also an allow-list. A new column never leaks by accident.
- About “we never have to change the API”: that is the problem. An API is a contract. A new field should be a conscious change, with a new optional field in the model.
Follow-up question: The admin panel must be able to change the status of an order, but customers must not. How do you model that?
Follow-up answer:
- Use different input models for different roles and endpoints. For example, an OrderStatusUpdate model with only status, on an admin-only endpoint.
- Check the role in a dependency (for example require_admin), not inside the model.
- Validate the change itself: only allowed transitions (new to paid only from the payment webhook, paid to shipped from the warehouse).
- Log who changed what, because status changes have money behind them.
Red flag: “The app is ours, so we can trust the body”, or a fix that only removes total from the dict but keeps Order(**payload).
Show answer
10. A test for checkout with a mocked payment
Testing with pytest· in roadmap
Question: Our checkout module charges the card through the payments module. A developer wrote this test so that it does not call the real payment provider:
# shop/payments.py
def charge(card_token: str, amount: Decimal) -> str:
... # calls the payment provider over HTTPS
# shop/checkout.py
from shop.payments import charge
def checkout(card_token: str, total: Decimal) -> str:
payment_id = charge(card_token, total)
return f"order paid with {payment_id}"
# tests/test_checkout.py
from decimal import Decimal
from unittest.mock import patch
from shop.checkout import checkout
@patch("shop.payments.charge", return_value="pay_123")
def test_checkout_uses_payment_id(mock_charge):
result = checkout("tok_visa", Decimal("50.00"))
assert "pay_" in result
You see this in code review. What do you think? Is there a problem?
Short answer: The patch is on the wrong name. The import line in checkout copies the name charge into the shop.checkout module. Patching shop.payments.charge changes only the name in the payments module. The checkout function still looks up its own name and calls the real charge function. Patch “shop.checkout.charge”, the name where it is used. Also, the assert is so weak that it can pass with the real provider too, and the test never checks the mock was called.
Hint (if the candidate says there is no problem): The test passes on the developer’s laptop. In CI, it sometimes takes 3 seconds and sometimes fails with a connection error. The payment provider’s sandbox shows test charges from our CI.
Why does this happen? (step by step)
- When shop.checkout is imported, the line that imports charge runs once. It creates a name charge in the namespace of shop.checkout, pointing to the real function.
- The patch decorator replaces the attribute charge on the module shop.payments with a mock, for the time of the test.
- Inside checkout, Python looks up charge in the globals of shop.checkout. That name was never changed. It still points to the real function.
- The real function calls the sandbox. Its payment ids also start with “pay_”, so the weak assert passes. The test is green but tests nothing about the mock.
- With the network, the test is slow and flaky, and it may create real charges if someone points it at the wrong environment.
The fix:
from decimal import Decimal
from unittest.mock import patch
from shop.checkout import checkout
def test_checkout_uses_payment_id():
with patch("shop.checkout.charge", autospec=True,
return_value="pay_123") as mock_charge:
result = checkout("tok_visa", Decimal("50.00"))
assert result == "order paid with pay_123"
mock_charge.assert_called_once_with("tok_visa", Decimal("50.00"))
- Patch the name where it is looked up: the module under test.
- The exact assert proves that the value came from the mock.
- The call check proves the right card and amount were sent.
- The autospec option makes the mock have the same signature as the real function. A wrong number of arguments fails the test.
- To make the mistake impossible, block the network in tests (for example with a plugin like pytest-socket), so any real call fails loudly.
Follow-up question: Is there a design that avoids patching module names at all?
Follow-up answer:
- Yes: pass the dependency in. For example, checkout takes a payment client as a parameter, or a class gets it in its constructor.
- In tests you pass a small fake object with a charge method. No patch, no import path strings, and renaming a module does not break the test silently.
- In FastAPI, the payment client can be a dependency, and the test replaces it with the dependency_overrides dict of the app.
- Patching is still fine for edges you do not own, like the clock, but explicit dependencies make the code easier to test and to read.
Red flag: “Patch where the function is defined”, or “the test passes, so the mock works”. A green test is not proof that the mock was used.
Show answer
11. Fast database fixtures for the loyalty tests
Testing with pytest· in roadmap
Question: The loyalty tests of our shop were slow, so a developer made the fixtures “faster”. The tests use a real PostgreSQL test database in a container. Here are the fixtures and two of the tests:
# tests/conftest.py
@pytest.fixture(scope="session")
def db():
engine = create_engine(TEST_DATABASE_URL)
Base.metadata.create_all(engine)
with Session(engine) as session:
yield session
@pytest.fixture(scope="session")
def customer(db):
anna = Customer(email="anna@example.com", points=0)
db.add(anna)
db.commit()
return anna
# tests/test_loyalty.py
def test_first_order_gives_10_points(db, customer):
place_order(db, customer, total=Decimal("100"))
assert customer.points == 10
def test_new_customer_has_no_orders(db, customer):
count = db.scalar(select(func.count()).select_from(Order))
assert count == 0
You see this in code review. What do you think? Is there a problem?
Short answer: Both fixtures have session scope: one database session and one customer for the whole test run. Every test changes them (place_order adds an order and points, and commits), and nothing is undone. So the tests depend on each other and on their order. Keep the slow, unchanging thing (the engine and the schema) at session scope, and give each test its own session inside a transaction that is rolled back, plus its own customer.
Hint (if the candidate says there is no problem): Each test passes when you run it alone. The full suite fails: the “no orders” test sees one order. When a new test that also places an order runs first, the “10 points” test sees 20 points.
Why does this happen? (step by step)
- A session-scope fixture runs once. Every test that asks for customer gets the same Customer object, and every test that asks for db gets the same Session.
- The first test places an order. It commits, so the order and the 10 points are really in the database.
- The second test counts orders. It expects 0, but the order from the first test is still there.
- If the tests run in another order (a plugin like pytest-randomly, or a new test added above), different tests fail. The results depend on order, not on code.
- With parallel runs (pytest-xdist), each worker has its own session fixtures but all share the same database, so they also see each other’s rows.
The fix:
# tests/conftest.py
@pytest.fixture(scope="session")
def engine():
engine = create_engine(TEST_DATABASE_URL)
Base.metadata.create_all(engine) # once per run
yield engine
engine.dispose()
@pytest.fixture
def db(engine):
with engine.connect() as connection:
transaction = connection.begin()
session = Session(
bind=connection,
join_transaction_mode="create_savepoint",
)
yield session
session.close()
transaction.rollback() # undo everything
@pytest.fixture
def customer(db):
anna = Customer(email="anna@example.com", points=0)
db.add(anna)
db.flush() # gets an id, no commit
return anna
- The engine and the schema are slow to create and tests do not change them. They stay at session scope.
- Each test gets a new connection with an outer transaction. At the end it is rolled back, so the database is clean for the next test, even if the code under test called commit.
- The join_transaction_mode option (SQLAlchemy 2) makes a commit inside the code use a savepoint inside our outer transaction, instead of really committing.
- The customer fixture now has function scope, so every test gets a fresh customer with 0 points.
- Rolling back a transaction is fast. In most suites it is much faster than creating tables again, so the tests stay fast.
Follow-up question: Some tests really need committed data, for example code that opens its own connection, or a background worker. What do you do then?
Follow-up answer:
- Then the rollback trick does not work, because the other connection cannot see data that is not committed.
- Clean up by hand after each such test: truncate the tables the test used, in a yield fixture. Or create a new database (or schema) for each worker, for example by adding the xdist worker id to the database name.
- Mark these tests (for example with a mark named integration) so they can run apart from the fast unit tests.
- Use unique data (random emails, new ids) so even leftovers do not break other tests.
Red flag: “Tests should run in a fixed order anyway”, or making the scope wide again “for speed” without saying what is shared.
Show answer
12. System design: the nightly price import
Concurrency in Python· in roadmapAsync Python with asyncio· in roadmapSQL and indexes· in roadmapTransactions and isolation levels· in roadmap
Question: Every night, our suppliers upload a CSV file with new prices: about 5 million rows (sku, price, currency), about 1 GB. For each row we must convert the price to euros with an exchange-rate API (one HTTP call per currency per night is allowed), apply our margin rules (pure Python, a few microseconds per row), and update the products table in PostgreSQL (20 million products). The import must finish before 6 a.m., it must not slow down the shop, and if it crashes in the middle we must be able to run it again.
This is the first version a developer suggests:
import csv
import requests
def import_prices(path: str, db) -> None:
rows = list(csv.DictReader(open(path)))
for row in rows:
rate = requests.get(RATE_URL, params={
"from": row["currency"], "to": "EUR"}).json()["rate"]
price = apply_margin(float(row["price"]) * rate)
db.execute(
"UPDATE products SET price = %s WHERE sku = %s",
(price, row["sku"]),
)
db.commit()
What do you think? How would you design this import? Ask the candidate to describe the design and the main code parts. Questions before designing (is the sku column indexed? can prices go down to zero? is there a rate limit on the rate API?) are a plus.
Short answer: The first version reads the whole file into memory, makes 5 million HTTP calls (one per row) with no timeout, uses float for money, and commits 5 million times. A good design:
- Stream the file with a generator, in batches. Memory stays small.
- Fetch each exchange rate once at the start (a few calls, with a timeout and a retry), and keep them in a dict.
- Validate each row; send bad rows to a reject file instead of stopping.
- Write in batches: copy each batch into a staging table, then one UPDATE with a join, in one transaction per batch. Use Decimal for money.
- Make it restartable: record each finished batch, and make the update idempotent.
First, let’s see the main problems of the first version (step by step):
- Calling list on the reader loads all 5 million rows as dicts. That is several GB of memory, and the file is never closed.
- One HTTP call per row is 5 million calls. Even at 20 ms each, that is more than a day. It also breaks the “one call per currency” rule, and without a timeout one stuck call stops the whole import.
- The float type cannot store prices exactly. Rounding errors appear in prices that customers see.
- One commit per row means 5 million transactions. Each commit waits for the database to write its log to disk. It is very slow, and it keeps the database busy for the shop too.
- If it crashes at row 3 million, we do not know which rows are done. Running it again redoes everything. A half-updated catalog is also visible to customers.
A good design (step by step):
- Read lazily, in batches. A generator reads the CSV row by row and yields batches of, for example, 10,000 rows. Memory depends on the batch size, not on the file size.
import csv
from collections.abc import Iterator
from itertools import batched # Python 3.12+
def read_batches(path: str, size: int = 10_000) -> Iterator[tuple]:
with open(path, newline="", encoding="utf-8") as file:
yield from batched(csv.DictReader(file), size)
- Get the rates once. Before the loop, collect the list of currencies (or use a known list) and fetch each rate once, with a timeout and a few retries. With about 30 currencies, a small thread pool or asyncio with a TaskGroup fetches them in a second. This is I/O work, so threads or asyncio are the right tool.
- Compute in Python, with Decimal. Parse the price as Decimal, convert, apply margin rules, and round with quantize. This is CPU work, but only a few microseconds per row: 5 million rows is about tens of seconds in one process. Measure first. Only if it is too slow, split the batches over a ProcessPoolExecutor.
- Validate and reject. A bad row (unknown sku, negative price, unknown currency) goes to a reject file with the reason. A price change of more than, for example, 50 percent is also flagged for a human. One bad supplier row must not stop the import, and must not set a TV to 0 euros.
- Write in bulk. For each batch, use COPY into an unlogged or temporary staging table, then run one UPDATE products … FROM staging WHERE products.sku = staging.sku AND products.price IS DISTINCT FROM staging.price. The sku column must have a unique index, or every update scans 20 million rows. One transaction per batch keeps transactions short, so locks are held only briefly and the shop is not blocked.
- Restartable and idempotent. Give the import a run id. After each batch commits, store the batch number in an import_runs table in the same transaction. On restart, skip the batches that are done. Setting a price to a value is idempotent, so redoing a batch is safe.
- Do not slow down the shop. Run it at night, limit it to one process and a small number of database connections, and watch replication lag if there are read replicas. Pause between batches if lag grows.
- Observe it. Structured logs per batch (rows read, updated, rejected, time), a metric for the duration, and an alert if it has not finished by 5 a.m.
Follow-up question 1: Customers must never see half of the new prices (for example, a phone at the new price but its case at the old one). What changes?
Answer: Load everything into the staging table first (in batches, as above), validate it there, and then apply all changes in one final transaction with one UPDATE. That transaction is bigger, so test how long it locks rows. Another way is versioned prices: write the new prices with a valid_from time or a new price list id, and switch the active price list in one small update.
Follow-up question 2: Next year the file is 50 million rows and arrives every hour. What do you change?
Answer: Then a single nightly script is not enough. Split the file and process parts in parallel (several workers, each with its own database connection), or ask suppliers for only the changed rows. Move the margin rules close to the data (SQL, or vectorized code with a dataframe library) if Python per row becomes the bottleneck. Keep the same ideas: batches, staging, idempotent updates, and progress records.
Red flag: The candidate keeps one HTTP call per row (“we will just add threads”), or loads the whole file into memory, or does not think about what happens when the job crashes in the middle.
Show answer
13. A sync worker whose memory never stops growing
How Python works inside· in roadmap
Question: Our order-sync worker starts with 300 MB of memory. After one day it uses 2 GB and is killed. Calling gc.collect() every minute did not help. This is the main part of the code:
from functools import lru_cache
class BatchSync:
def __init__(self, db, orders: list[dict]):
self.db = db
self.orders = orders # about 5,000 orders per batch
@lru_cache(maxsize=None)
def rate(self, currency: str) -> float:
return self.db.fetch_rate(currency)
def run(self) -> None:
for o in self.orders:
o["total_eur"] = o["total"] * self.rate(o["currency"])
self.db.save(self.orders)
def main(db, queue) -> None:
while True:
BatchSync(db, queue.next_batch()).run()
You see this in code review. What do you think? Why does memory grow?
Short answer: The lru_cache is created once, on the class function, and it is shared by every object. Its keys include self, so the cache holds a strong reference to every BatchSync ever created, and each one holds its full list of 5,000 orders. maxsize=None means nothing is ever removed. These objects are still reachable, so reference counting and gc.collect() cannot free them. The fix: cache a plain function on the currency only, with a size and a time limit, or keep a small dict inside each object.
Hint (if the candidate does not see it): Look at the arguments that lru_cache uses as the key. What is the first argument of a method?
Why does this happen? (step by step)
- @lru_cache wraps the function rate once, when the class is defined. There is one cache for the whole class.
- Each call self.rate(“EUR”) stores the key (self, “EUR”) in that cache.
- The key keeps a reference to self. self keeps self.orders. So every batch stays alive.
- A new batch every few seconds means thousands of objects per day, each with its orders.
- gc.collect() frees only objects that nobody can reach. The cache can reach all of them, so nothing is freed.
- tracemalloc would show the growth at the line that builds the order dicts, and gc.get_referrers on an old batch would show the cache.
The fix:
import time
from functools import lru_cache
@lru_cache(maxsize=64)
def _rate(db, currency: str, hour: int) -> float:
return db.fetch_rate(currency)
def rate(db, currency: str) -> float:
return _rate(db, currency, int(time.time() // 3600))
class BatchSync:
def __init__(self, db, orders: list[dict]):
self.db = db
self.orders = orders
def run(self) -> None:
for o in self.orders:
o["total_eur"] = o["total"] * rate(self.db, o["currency"])
self.db.save(self.orders)
- The key is only the db object (one for the whole worker), the currency and the hour. No batch is kept.
- maxsize=64 sets a limit, and the hour in the key makes old rates expire. A real exchange rate should not be cached forever.
- Another good fix is a small dict inside each batch: it is freed with the batch.
- Check the result: run 1,000 batches and compare two tracemalloc snapshots. The memory should stay flat.
Follow-up question: After the fix, memory is flat, but the process still shows 1.2 GB in the OS after a big batch. Is it still leaking?
Follow-up answer:
- Probably not. CPython keeps freed memory in its own pools (pymalloc arenas) and gives an arena back to the OS only when it is fully empty.
- A leak means memory keeps growing under the same load. A high but stable number is normal.
- To lower the peak, process orders as a stream (generators, smaller batches) instead of holding all of them in memory at once.
Red flag: Says “Python has a garbage collector, so it cannot leak”, or suggests restarting the worker every hour as the fix.
Show answer
14. A shared library that nobody can install
Python packaging and dependencies· in roadmap
Question: Three services use our internal library shop-common. This is its pyproject.toml:
[project]
name = "shop-common"
version = "2.4.0"
dependencies = [
"httpx==0.27.0",
"pydantic==2.7.1",
"python-dateutil==2.9.0",
]
And this is the requirements.txt of the orders service, used in its Dockerfile with pip install -r:
shop-common
fastapi
sqlalchemy
Last week the payments team could not install shop-common next to their code. On Friday the orders service broke after a rebuild, but nobody changed its code. What do you think? What is wrong, and how should it be set up?
Short answer: The roles are mixed up. The library pins exact versions, which belong in an application lock file, and the application has no versions at all, which is what a library would do. shop-common must declare ranges it works with, like httpx>=0.27,<1, so pip can find one version that fits every package. The orders service must lock every package, also the indirect ones, with exact versions and hashes (uv.lock, or pip-tools with –generate-hashes) and install only from that lock. Then a rebuild installs exactly what was tested.
Hint (if the candidate only talks about one problem): There are two problems here, and they are opposites. Which project is installed next to code it does not control, and which project is the final product?
Why does this happen? (step by step)
- Payments needs httpx 0.28 for a new feature. shop-common says httpx==0.27.0. No version fits both, so pip stops with a conflict.
- The orders requirements.txt has no versions. Each Docker build asks the index for the newest versions that fit.
- On Friday, a new major version of a package came out. The rebuild picked it, and an API that orders used was gone.
- Nothing in git changed, so the bug looked like it came from nowhere. The real change was on the index.
The fix:
# shop-common/pyproject.toml (a library: ranges)
[project]
name = "shop-common"
version = "2.5.0"
requires-python = ">=3.12"
dependencies = [
"httpx>=0.27,<1",
"pydantic>=2.6,<3",
"python-dateutil>=2.8",
]
# orders service (an application: a lock)
uv add shop-common fastapi sqlalchemy # writes pyproject.toml and uv.lock
uv sync --frozen --no-dev # in the Dockerfile
- The library gives pip room to choose. The upper limit is only on the next major version.
- The service writes every exact version and hash into uv.lock, and the lock goes into git.
- The Dockerfile installs with –frozen, so it fails if the lock is out of date instead of picking new versions.
- A bot like Renovate opens a pull request to update the lock every week. CI tests the new versions before they reach production.
- shop-common runs its own CI with the lowest and the newest allowed versions, so its ranges are true.
Follow-up question: The team says “let us pin exact versions in the library too, to be safe”. What do you answer?
Follow-up answer:
- Exact pins in a library do not make the application safer: the application lock already fixes the versions.
- They only make conflicts likely and block security fixes. Users of the library must wait for a new library release for every patch.
- If a version is known to be broken, exclude only that one, like httpx>=0.27,!=0.27.1,<1.
Red flag: Suggests deleting the version numbers everywhere, or adding –no-deps to pip install to “skip the conflict”.
Show answer
Not saved in this browser.