Fix encoding ref leak with non-English character#714
Fix encoding ref leak with non-English character#714bwoodsend merged 3 commits intoultrajson:mainfrom
Conversation
Avoid overwriting the default()-returned object when creating temporary UTF-8 bytes during string encoding. Signed-off-by: nhancdt2602 <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #714 +/- ##
==========================================
+ Coverage 91.35% 91.43% +0.07%
==========================================
Files 7 7
Lines 1979 1997 +18
==========================================
+ Hits 1808 1826 +18
Misses 171 171 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
bwoodsend
left a comment
There was a problem hiding this comment.
Nice one tracking that down.
Can we get some tests for it? Something like your reproducer that covers unicode, non-unicode as well as the default() function returning a structure containing more than one string? If you pass --leak-max-loops=10000 to pytest, it applies a loop + forced gc + tracemalloc auditing to each test so you don't need to do any of that yourself – just run the offending code paths.
Ofc, I'll be working on tests |
|
@bwoodsend I added 2 relevant test cases for this PR. Here is the test result Test ResultSetupRun command: Before FixAfter Fix |
|
Thanks for figuring that one out. |
Fixed #631