msg262657 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2016-03-30 09:31 |
path_converter in Modules/posixmodule.c sequentially tries to convert an argument to str, bytes, and int. If previous conversion is failed, it clears the error and tries with type. This can hide some errors (such as MemoryError) and even cause using unexpected conversion. Proposed patch cleans up path_converter. In addition it avoids copying the content of instances of string subclass. |
|
|
msg262695 - (view) |
Author: Larry Hastings (larry) *  |
Date: 2016-03-31 15:08 |
I approve in principle, but this patch isn't ready. If we compile on Win32, and allow_fd is on, and they pass in an invalid fd, your patched code will reach line 914 "length = PyBytes_GET_SIZE(bytes);" but bytes will be uninitialized. |
|
|
msg262734 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2016-04-01 10:16 |
Good catch! Here is updated patch. It fixes also hiding exception in dir_fd converter. |
|
|
msg262950 - (view) |
Author: Larry Hastings (larry) *  |
Date: 2016-04-06 17:10 |
Can you post the updated patch please? |
|
|
msg262953 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2016-04-06 18:57 |
Here it is. |
|
|
msg262954 - (view) |
Author: Larry Hastings (larry) *  |
Date: 2016-04-06 19:01 |
LGTM. |
|
|
msg262955 - (view) |
Author: Roundup Robot (python-dev)  |
Date: 2016-04-06 19:19 |
New changeset a866f5727b7f by Serhiy Storchaka in branch 'default': Issue #26671: Enhanced path_converter. https://hg.python.org/cpython/rev/a866f5727b7f |
|
|
msg262956 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2016-04-06 19:20 |
Thank you for your review Larry. |
|
|
msg262959 - (view) |
Author: Roundup Robot (python-dev)  |
Date: 2016-04-06 19:55 |
New changeset 8dc144e47252 by Serhiy Storchaka in branch 'default': Issue #26671: Fixed #ifdef indentation. https://hg.python.org/cpython/rev/8dc144e47252 |
|
|
msg262961 - (view) |
Author: Roundup Robot (python-dev)  |
Date: 2016-04-06 20:03 |
New changeset 4acdb324a430 by Serhiy Storchaka in branch 'default': Issue #26671: Fixed #ifdef indentation. https://hg.python.org/cpython/rev/4acdb324a430 |
|
|
msg263005 - (view) |
Author: Martin Panter (martin.panter) *  |
Date: 2016-04-08 05:10 |
Looks like the tests may need updating for a changed exception message: http://buildbot.python.org/all/builders/x86%20Ubuntu%20Shared%203.x/builds/12996/steps/test/logs/stdio ====================================================================== FAIL: test_stat (test.test_posix.PosixTester) ---------------------------------------------------------------------- TypeError: stat: path should be string, bytes or integer, not NoneType During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/test/test_posix.py", line 415, in test_stat posix.stat, None) AssertionError: "can't specify None for path argument" does not match "stat: path should be string, bytes or integer, not NoneType" ====================================================================== FAIL: test_stat_dir_fd (test.test_posix.PosixTester) ---------------------------------------------------------------------- TypeError: argument should be integer or None, not str During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/test/test_posix.py", line 867, in test_stat_dir_fd posix.stat, support.TESTFN, dir_fd=posix.getcwd()) AssertionError: "should be integer, not" does not match "argument should be integer or None, not str" |
|
|
msg263007 - (view) |
Author: Roundup Robot (python-dev)  |
Date: 2016-04-08 05:48 |
New changeset 633bb190fb76 by Serhiy Storchaka in branch 'default': Issue #26671: Fixed tests for changed error messages. https://hg.python.org/cpython/rev/633bb190fb76 |
|
|
msg263008 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2016-04-08 05:49 |
Thank you Martin. |
|
|