On 2012/06/21 19:13:54, larry wrote:
> http://bugs.python.org/review/15118/diff/5171/Modules/posixmodule.c
> File Modules/posixmodule.c (right):
>
>
http://bugs.python.org/review/15118/diff/5171/Modules/posixmodule.c#newcode3603
> Modules/posixmodule.c:3603: PyObject *o = PyUnicode_DecodeASCII(field,
> strlen(field), NULL); \
> On 2012/06/21 14:10:35, storchaka wrote:
> > PyUnicode_FromString(field)
> Why is that better? The string isn't UTF-8, it's ASCII.
It is shorter and special designed for such cases. Py_BuildValue("(sssss)"...)
uses UTF-8 decoder. For long ASCII strings UTF-8 and ASCII encoders are almost
equal fast (both use same code). For short string there are no differences
between different decoders.
http://bugs.python.org/review/15118/diff/5217/Lib/test/test_sysconfig.py File Lib/test/test_sysconfig.py (right): http://bugs.python.org/review/15118/diff/5217/Lib/test/test_sysconfig.py#newcode28 Lib/test/test_sysconfig.py:28: self._set_uname(('',)*5) What is the reason for this change? http://bugs.python.org/review/15118/diff/5217/Lib/test/test_sysconfig.py#newcode70 ...
http://bugs.python.org/review/15118/diff/5217/Lib/test/test_sysconfig.py
File Lib/test/test_sysconfig.py (right):
http://bugs.python.org/review/15118/diff/5217/Lib/test/test_sysconfig.py#newc...
Lib/test/test_sysconfig.py:28: self._set_uname(('',)*5)
On 2012/06/24 08:52:07, storchaka wrote:
> What is the reason for this change?
It allows the test to actually run if "uname" is unavailable. It depends on
uname returning a valid object.
Y'see, I actually tested that branch--I changed the "if hasattr" above to "if
0"--and the test immediately crashed. Bit rot, I guess. (Maybe uname is always
available and it didn't used to be.)
http://bugs.python.org/review/15118/diff/5217/Lib/test/test_sysconfig.py#newc...
Lib/test/test_sysconfig.py:70: def _set_uname(self, uname):
On 2012/06/24 08:52:07, storchaka wrote:
> This function is only used in one place.
> I think that would be clearer if get
> rid of it and inline body.
Done.
Let me retract that last statement. http://bugs.python.org/review/15118/diff/5217/Lib/test/test_sysconfig.py File Lib/test/test_sysconfig.py (right): http://bugs.python.org/review/15118/diff/5217/Lib/test/test_sysconfig.py#newcode70 Lib/test/test_sysconfig.py:70: def _set_uname(self, uname): ...
I've added some bikesheds, the more interesting ones were from Georg though. LGTM otherwise! http://bugs.python.org/review/15118/diff/5217/Doc/library/os.rst ...
Issue 15118: uname and other os functions should return a struct sequence instead of a tuple
Created 12 months ago by larry
Modified 11 months, 4 weeks ago
Reviewers: storchaka, hynek
Base URL: None
Comments: 22