classification
Title: Add tests for NUL checking in certain strs
Type: Stage:
Components: Tests Versions: Python 3.3, Python 3.2, Python 2.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: alex, amaury.forgeotdarc, haypo, hynek, loewis, pitrou, r.david.murray, terry.reedy
Priority: normal Keywords:

Created on 2012-01-24 02:05 by alex, last changed 2012-02-15 21:13 by haypo.

Messages (11)
msg151877 - (view) Author: Alex Gaynor (alex) * (Python committer) Date: 2012-01-24 02:05
ATM there's no tests (at least in 2.x, I haven't checked 3.x yet) for this behavior:

>>> os.path.exists("/tmp\x00abcds")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.2/genericpath.py", line 18, in exists
    os.stat(path)
TypeError: embedded NUL character
msg151878 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2012-01-24 02:23
Why is that a bug? There is no feature in Python saying that the test suite covers the code fully (by some kind of measurement).

New tests should only be added to 3.3, unless they test for a newly-fixed bug (and even then the test may not be backported to the maintenance release).
msg151879 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2012-01-24 02:42
Adding tests helps the other VMs, which generally are trailing behind the CPython releases.
msg151883 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2012-01-24 08:12
If other VMs need this test for some reason, they can easily add a test case themselves. I'm -1 on adding test cases to bug fix releases just for completeness. A lacking test is not a bug, and hence must not be added to a bug fix release.
msg151903 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2012-01-24 13:21
My understanding (and recollection, but I don't have notes I can point at to hand) is that one goal that arose from recent VM and language summits was for the CPython test suite to be used as the validating test suite, with CPython-specific tests marked as such so that the other VMs can easily "not conform" to those tests.  Thus my comment that it is helpful to the other VMs to add tests.
msg151904 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2012-01-24 13:25
Oh, and in case it isn't clear, this request is *coming* from one of the other VMs (pypy), so if my summit recollection is correct, they are in fact "adding a test that they need" by submitting this issue :)

(Or at least they will have once Alex posts the patch.)
msg151907 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2012-01-24 13:46
If so, I think this change should not checked into the 2.7 branch. Instead, a separate branch should be made for changes not intended for CPython, but for Python implementations in general. Making the Python test suite usable for other implementations is certainly not a feature of Python 2.7.
msg151908 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2012-01-24 13:49
Reconsidering: I think it shouldn't be checked into the cpython *repository*. Instead, if PyPy developers want to contribute changes to the test suite and standard library to improve the standard library, there should be a separate Mercurial repository for that, and PyPy developers might get a blanket write permission to add changes unless they explicitly feel a need for review.
msg152140 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2012-01-27 23:26
This is a bit related to #13848 files 2 seconds earlier.
msg152141 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2012-01-27 23:35
Well, adding tests is certainly useful to avoid regressions in CPython (not only PyPy or Jython). It seems to me that the only reasonable discussion is whether they should be committed to 2.7 and 3.2, or only the default branch.

(I personally like adding tests to stable branches as well, since that avoids potential regressions in further bugfix releases)

If we had had such tests from the beginning, 3.x wouldn't have regressed in that matter (see #13848).
msg153436 - (view) Author: STINNER Victor (haypo) * (Python committer) Date: 2012-02-15 21:13
See also issue #13617.
History
Date User Action Args
2012-02-15 21:13:13hayposetnosy: + haypo
messages: + msg153436
2012-01-27 23:35:43pitrousetnosy: + pitrou

messages: + msg152141
versions: + Python 3.2, Python 3.3
2012-01-27 23:26:35terry.reedysetnosy: + terry.reedy
messages: + msg152140
2012-01-24 13:49:57loewissetmessages: + msg151908
2012-01-24 13:46:32loewissetmessages: + msg151907
2012-01-24 13:31:45hyneksetnosy: + hynek
2012-01-24 13:25:16r.david.murraysetmessages: + msg151904
2012-01-24 13:21:50r.david.murraysetmessages: + msg151903
2012-01-24 08:12:10loewissetmessages: + msg151883
2012-01-24 02:42:06r.david.murraysetnosy: + r.david.murray
messages: + msg151879
2012-01-24 02:23:36loewissetnosy: + loewis
messages: + msg151878
2012-01-24 02:05:53alexcreate