Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
zoridan6845yI remember some time ago working with delphi (definetly not an expert) and the IDE was amazingly broken. Jus try to compile and it give you an error on X line...
- "hmmm but this was fine a minute ago..."
Hit compile again, other error on other line...
- "I swear I didn't touch this"
Hit compile a few times, same random errors...
- "WtF man!?
Hit again... and everithing was ok.
Like I said, not an expert on delphi, but that happened a lot, weird... -
Kasonnara725yTo conclude this, in the end it seems to be a tricky shared vars and local scopes problem.
I have 2 thread, one writing an array the second reading it.
What seems to be happening is that without the prints, each thread have it's own var (just pointing to the same array at first) and when the writer thread change it it doesn't affect the other.
But with the prints python compiler correctly interpret both as the same variable. -
Kasonnara725y@joas Not really there is no timing issue. Always the same result. Python makes atomic assignments.
The problem was that when the writing thread create a new array and affect a pointer to it in the variable, it only changes its own variable. The other thread keeps the pointer of the initial array and thus isn't affected.
But strangely with the prints it correctly affect the new array in the other thread variable.
Related Rants
Got a weird bug today...
A new feature I just implemented works but outputs nothing.
So I start printing its inputs early in the code, fine no problem here. Then I print out the supposed results a little bit later, fine too. But now the full program work perfectly.
I find out that if I remove one of those two prints then suddenly my function start outputing empty arrays! WTF?
I think I find a quantum bug, you can observe the bug or the internal values but not both!
rant
python
quantum bug