[issue30513] getrusage returns platform-dependent value
New submission from sam-s: `resource.getrusage(resource.RUSAGE_SELF).ru_maxrss` returns the peak memory usage, in *bytes* on BSD (including Mac OS X) and in *kilobytes* on Linux. This means that to get a cross-platform value, the user has to check `sys.platform`, which is fairly inconvenient. It would seem like a good idea to return a platform-independent value (e.g., multiply the Linux return value by 1000 - or is it 1024?!) Please see also * https://bugs.python.org/issue20468 * https://stackoverflow.com/a/7669482/850781 Thank you! -- components: Library (Lib) messages: 294768 nosy: sam-s priority: normal severity: normal status: open title: getrusage returns platform-dependent value type: behavior versions: Python 2.7, Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7 ___ Python tracker <http://bugs.python.org/issue30513> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30513] getrusage returns platform-dependent value
sam-s added the comment: Experiment shows that the Linux multiplier is 1024 (not 1000). -- ___ Python tracker <http://bugs.python.org/issue30513> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30515] unittest: assertAlmostEqual rounding error
New submission from sam-s: I get this `unittest` failure: ``` Traceback (most recent call last): File "zzz.py", line 348, in test_opposite self.assertAlmostEqual(a, b, places=2) AssertionError: 1.1036640046288428 != 1.0986122886681098 within 2 places ``` This seems incorrect: 1.1036640046288428 rounded off to 2 places is 1.10 and so is 1.0986122886681098. E.g., in Lisp: ``` > (round 1.1036640046288428d0 0.01) 110 ; 0.0036640292157588336d0 > (round 1.0986122886681098d0 0.01) 110 ; -0.001387686744974238d0 ``` -- components: Library (Lib) messages: 294772 nosy: sam-s priority: normal severity: normal status: open title: unittest: assertAlmostEqual rounding error versions: Python 2.7 ___ Python tracker <http://bugs.python.org/issue30515> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30515] unittest: assertAlmostEqual rounding error
sam-s added the comment: you are right, sorry. -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker <http://bugs.python.org/issue30515> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com