fix: replace co_filename with the correct filename when the file is moved - #14551
fix: replace co_filename with the correct filename when the file is moved#1455115r10nk wants to merge 1 commit into
Conversation
b6de9ee to
5940a4a
Compare
858b501 to
535f80f
Compare
Co-authored-by: copilot
535f80f to
44f84e0
Compare
RonnyPfannschmidt
left a comment
There was a problem hiding this comment.
Instead of patching we should treat it as stale
|
the problem is that the filename is used by other tools which can cause all sorts of problems later on. this was my original problem (the only way I found to make it work was to patch pytest) 15r10nk/inline-snapshot#371 cpython solves this problem in a similar way https://bugs.python.org/issue1180193 |
|
Let it be compiled fresh instead of patching code objects Else file content and runtime state diverge |
|
The state should not diverge because it is already checked by comparing the timestamps. What I would not do is compiling it again AND storing the new version on disk. The cpython issue mentioned cases where the same file might be stored on the network and mounted under different locations. Rewriting the file might cause cycles where multiple PCs might rewrite the file again and again ... . But not storing is also expensive because you would recompile it every time. I think the best solution here is to patch the filename like cpython does it too. |
|
as far as im concerned unless cpython itself provides a mapper for this - we as a testrunner (which is typically assumed to run in isolation) to recompile rather than managing mutated state my oppinion is that for pytest its most likely fine to just recompile and ensure stuff is in sync |
|
Ok, I will provide a different pr. |
|
@RonnyPfannschmidt I created #14989. can you review it. |
closes #14552