Merge lp://staging/~cjwatson/meliae/test-sys-getsizeof into lp://staging/meliae
Proposed by
Colin Watson
Status: | Merged |
---|---|
Approved by: | John A Meinel |
Approved revision: | 203 |
Merged at revision: | 202 |
Proposed branch: | lp://staging/~cjwatson/meliae/test-sys-getsizeof |
Merge into: | lp://staging/meliae |
Prerequisite: | lp://staging/~cjwatson/meliae/tox |
Diff against target: |
281 lines (+63/-81) 2 files modified
meliae/_scanner_core.c (+4/-4) meliae/tests/test__scanner.py (+59/-77) |
To merge this branch: | bzr merge lp://staging/~cjwatson/meliae/test-sys-getsizeof |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
John A Meinel | Approve | ||
Review via email:
|
Commit message
Test scanner.size_of against sys.getsizeof.
Description of the change
The exact details of object sizes are difficult to maintain across Python versions, and it's all too easy for bugs to go undetected due to parallel implementation bugs in the code under test and the test suite.
Python 2.6 introduced `sys.getsizeof`, so in all but a few special cases it makes more sense to test against that.
In the process of doing this, I found and fixed two bugs in `scanner.size_of`: the size of Unicode objects was off by one, and the size of statically-
To post a comment you must log in.
IIRC when this was written either sys.getsizeof was inaccurate or didn't exist. If it is strongly trusted now, then I'm not sure if we need scanner.size_of. Maybe it avoids allocating a PyLong to do the math?