Closed jakkdl closed 1 week ago
from contextvars import ContextVar, copy_context cv: ContextVar[list[int]] = ContextVar("cv", default=[]) def append_to_cv_list(): cv.get().append(0) ctx = copy_context() ctx.run(append_to_cv_list) ctx.run(append_to_cv_list) print(cv.get())
This will print [0, 0] instead of the expected [], very similar to B006 and B008. Can either raise B006 & B008, or just reuse their machinery but raise a new error code.
[0, 0]
[]
This will print
[0, 0]
instead of the expected[]
, very similar to B006 and B008. Can either raise B006 & B008, or just reuse their machinery but raise a new error code.