[issue7955] TextIOWrapper Buffering Inconsistent Between _io and _pyio

2010-02-17 Thread Andrew McNabb
New submission from Andrew McNabb : The following snippet behaves differently in the C IO implementation than in the Python IO implementation: import sys sys.stdout.write('unicode ') sys.stdout.buffer.write(b'bytes ') To test this, I have created two scripts, testpyio.py (using _pyio) an

[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2010-02-17 Thread Matthew Barnett
Matthew Barnett added the comment: issue2636-20100218.zip is a new version of the regex module. I've added '.' to the permitted characters when parsing the name of a property. The name itself is no longer reported in the error message. I've also corrected the positions of the 'pos' and 'endpo

[issue7952] fileobject.c can switch between fread and fwrite without an intervening flush or seek, invoking undefined behaviour

2010-02-17 Thread David-Sarah Hopwood
David-Sarah Hopwood added the comment: Correction: when input is followed by output, the call needed to avoid undefined behaviour has to be to a "file positioning function" (fseek, fsetpos, or rewind, but not fflush). Since fileobject.c does not use wide I/O operations, it should be sufficien

[issue7954] detach method has no docstring

2010-02-17 Thread Benjamin Peterson
Benjamin Peterson added the comment: 2010/2/17 Andrew McNabb : > > Andrew McNabb added the comment: > > Oops.  I had run "pydoc" instead of "pydoc3", so I was getting the 2.6 > version of the io docstrings instead of the 3.1 version. > > By the way, it took about an hour to find out how to get

[issue7954] detach method has no docstring

2010-02-17 Thread Andrew McNabb
Andrew McNabb added the comment: Oops. I had run "pydoc" instead of "pydoc3", so I was getting the 2.6 version of the io docstrings instead of the 3.1 version. By the way, it took about an hour to find out how to get Python 3 to treat stdin as bytes instead of unicode. Now that I know what

[issue7953] RawIOBase.read fails with an AttributeError

2010-02-17 Thread R. David Murray
R. David Murray added the comment: Also note that RawIOBase is not intended to be a concrete class, it is intended to be subclassed (thus the 'Base' in the name). -- nosy: +r.david.murray priority: -> normal ___ Python tracker

[issue7953] RawIOBase.read fails with an AttributeError

2010-02-17 Thread Benjamin Peterson
Benjamin Peterson added the comment: If you want the actual raw sys.stdin stream, use sys.stdin.buffer.raw. -- nosy: +benjamin.peterson resolution: -> invalid status: open -> closed ___ Python tracker

[issue7953] RawIOBase.read fails with an AttributeError

2010-02-17 Thread Andrew McNabb
New submission from Andrew McNabb : I was trying to open stdin in binary mode and ran the following: >>> RawIOBase(sys.stdin.fileno()).read() Traceback (most recent call last): File "", line 1, in AttributeError: 'RawIOBase' object has no attribute 'readinto' >>> I would expect read() to rea

[issue7952] fileobject.c can switch between fread and fwrite without an intervening flush or seek, invoking undefined behaviour

2010-02-17 Thread David-Sarah Hopwood
New submission from David-Sarah Hopwood : The C standard (any version, or POSIX), says in the description of fopen that: {{{ When a file is opened with update mode ( '+' as the second or third character in the mode argument), both input and output may be performed on the associated stream. Howe

[issue7951] Should str.format allow negative indexes when used for __getitem__ access?

2010-02-17 Thread Eric Smith
New submission from Eric Smith : It surprised me that this doesn't work: >>> "{0[-1]}".format('fox') Traceback (most recent call last): File "", line 1, in TypeError: string indices must be integers I was expecting it to be equivalent to: >>> "{0[2]}".format('fox') 'x' I don't think there's

[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2010-02-17 Thread Vlastimil Brom
Vlastimil Brom added the comment: I just tested the fix for unicode tracebacks and found some possibly weird results (not sure how/whether it should be fixed, as these inputs are indeed rather artificial...). (win XPp SP3 Czech, Python 2.6.4) Using the cmd console, the output is fine (for the

[issue7904] urlparse.urlsplit mishandles novel schemes

2010-02-17 Thread mARK
mARK added the comment: Doing a fallback test for // would look like if scheme in uses_netloc and url[:2] == '//' or url[:2] == '//': but this is equivalent to if url[:2] == '//': i.e., an authority appears if and only if there is a // after the scheme. This still allows a uses_netloc scheme

[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2010-02-17 Thread Matthew Barnett
Matthew Barnett added the comment: The main text at http://pypi.python.org/pypi/regex appears to have lost its backslashes, for example: The Unicode escapes u and U are supported. instead of: The Unicode escapes \u and \U are supported. -- __

[issue7593] Computed-goto patch for RE engine

2010-02-17 Thread Antoine Pitrou
Antoine Pitrou added the comment: You should disassemble the output (or produce assembler from gcc) and check that the various indirect jumps at the end of each case block don't get merged into a single shared indirect jump. Or perhaps it's simply that regular expression matching isn't really

[issue7946] Convoy effect with I/O bound threads and New GIL

2010-02-17 Thread Antoine Pitrou
Antoine Pitrou added the comment: We could try not to release the GIL when socket methods are called on a non-blocking socket. Regardless, I've re-run the tests under the Linux machine, with two spinning threads: * python 2.7: 25.580 seconds (409914.612 bytes/sec) * python 3.2: 32.216 secon

[issue7299] setup.py install doesn't honor PYTHONUSERBASE

2010-02-17 Thread Éric Araujo
Éric Araujo added the comment: Hello It seems to me that your patch doesn’t fix a bug but adds a feature. PEP 370 says that “distutils.command.install (setup.py install) gets a new argument --user to install packages in the user site directory”, not that the presence of the envvar should tri

[issue7633] decimal.py: type conversion in context methods

2010-02-17 Thread Mark Dickinson
Mark Dickinson added the comment: The latest patch looks fine. I've attached a slightly tweaked version: - Add conversions for number_class; without this, number_class is inconsistent with the various is_*** methods. "c.is_normal(3)" should be equivalent to "c.number_class(3) in ('+Normal

[issue3132] implement PEP 3118 struct changes

2010-02-17 Thread Mark Dickinson
Mark Dickinson added the comment: I'm looking for previous discussions of this PEP. There's a python-dev thread in April 2007: http://mail.python.org/pipermail/python-dev/2007-April/072537.html Are there other discussions that I'm missing? -- ___

[issue7593] Computed-goto patch for RE engine

2010-02-17 Thread A.M. Kuchling
A.M. Kuchling added the comment: Actually, I really want someone to verify that measurement. As a control, I tried running the call_method benchmark (after a few more xrange fixes). The Python 3.x trunk version with my patch is measured as 1.0227x slower, even though the patch only touches

[issue3132] implement PEP 3118 struct changes

2010-02-17 Thread Mark Dickinson
Mark Dickinson added the comment: > And under what conditions would a ctype long double be used vs. a > Decimal object. Well, I'm guessing that this was really just an open question for the PEP, and that the PEP authors hadn't decided which of these two options was more appropriate. If all l

[issue7593] Computed-goto patch for RE engine

2010-02-17 Thread A.M. Kuchling
A.M. Kuchling added the comment: I finally got around to benchmarking this change, and unfortunately the results are not good. I used the regex tests in the Unladen Swallow test suite, regex_effbot and regex_v8. The tests are written for Python 2.x, but the fixes for 3.x are straightforward

[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2010-02-17 Thread Alex Willmer
Alex Willmer added the comment: I've packaged this latest revision and uploaded to PyPI http://pypi.python.org/pypi/regex -- ___ Python tracker ___ _

[issue7942] Inconsistent error types/messages for __len__ between old and new-style classes

2010-02-17 Thread R. David Murray
R. David Murray added the comment: Interestingly, this (len returning something larger than ssize_t) has not been fixed in python3. On the other hand, I still think the new-style message is better. Yes, it is an implementation detail of CPython, but that is exactly the error being reported.

[issue7942] Inconsistent error types/messages for __len__ between old and new-style classes

2010-02-17 Thread Paul Boddie
Paul Boddie added the comment: I don't disagree that OverflowError describes what's happening, but the need to convert to an int in the first place is a detail of the machine - you'd have to know that this is a limitation of whatever internal "protocol" CPython implements - not a description

[issue7950] subprocess.Popen documentation should contain a good warning about the security implications when using shell=True

2010-02-17 Thread Eric Smith
Eric Smith added the comment: This was just discussed in issue 6760. -- nosy: +eric.smith resolution: -> duplicate stage: -> committed/rejected status: open -> closed superseder: -> patch to subprocess docs to better explain Popen's 'args' argument _

[issue7950] subprocess.Popen documentation should contain a good warning about the security implications when using shell=True

2010-02-17 Thread Christoph Neuroth
New submission from Christoph Neuroth : Currently, the documentation of subprocess only says "Calling the program through the shell is usually not required.". IMHO there should be a real warning (like, in its own box with a couple of big exclamation marks ;)) about the security implications of

[issue7846] Fnmatch cache is never cleared during usage

2010-02-17 Thread Andrew Clegg
Andrew Clegg added the comment: "If you give something an _, then it is not considered part of the public API and it (the internal API, not the value) is subject to change, which means you should *not* suggest that users change it. If they find it and want to change it anyway, that's their l