[issue15061] hmac.secure_compare() leaks information about length of strings

2012-06-15 Thread Hynek Schlawack
Hynek Schlawack h...@ox.cx added the comment: Secure vs not secure is not a binary state - it's about making attacks progressively more difficult. Something that is secure against a casual script kiddie scatter gunning attacks on various sites with an automated script won't stand up to a

[issue15061] hmac.secure_compare() leaks information about length of strings

2012-06-15 Thread Martin v . Löwis
Martin v. Löwis mar...@v.loewis.de added the comment: On 14.06.2012 14:26, Antoine Pitrou wrote: Antoine Pitrou pit...@free.fr added the comment: It's either secure or it's not. I don't think that's true. By that reasoning, Python is not secure so there's no point in fixing crashes or

[issue15061] hmac.secure_compare() leaks information about length of strings

2012-06-15 Thread Martin v . Löwis
Martin v. Löwis mar...@v.loewis.de added the comment: Being able to tell people using hmac.total_compare will make you less vulnerable to timing attacks than using ordinary short circuiting comparisons is a *good thing*. No, it's not. It's a *bad thing*. The two issues that have been opened

[issue15061] hmac.secure_compare() leaks information about length of strings

2012-06-15 Thread Martin v . Löwis
Martin v. Löwis mar...@v.loewis.de added the comment: Why not write a C function which can be more secure than Python code? For Unicode strings, it's impossible to write a time-independent comparison function even in C I would argue that would be an general asset for the stdlib I would

[issue14377] Modify serializer for xml.etree.ElementTree to allow forcing the use of long tag closing

2012-06-15 Thread Serhiy Storchaka
Serhiy Storchaka storch...@gmail.com added the comment: xml.sax.saxutils.XMLGenerator constructor has a parameter short_empty_elements (False by default). For consistency new ElementTree.write parameter must have the same name (True by default for compatibility). --

[issue15061] hmac.secure_compare() leaks information about length of strings

2012-06-15 Thread Hynek Schlawack
Hynek Schlawack h...@ox.cx added the comment: Why not write a C function which can be more secure than Python code? For Unicode strings, it's impossible to write a time-independent comparison function even in C Really? Some comments sounded different. That's too bad but also what I

[issue1470548] Bugfix for #1470540 (XMLGenerator cannot output UTF-16)

2012-06-15 Thread Serhiy Storchaka
Serhiy Storchaka storch...@gmail.com added the comment: The patch updated to reflect Martin's comments. I hope the old behavior now preserved in the most used in practice cases. Tests converted to work with bytes instead of strings. -- Added file:

[issue14035] behavior of test.support.import_fresh_module

2012-06-15 Thread Nick Coghlan
Changes by Nick Coghlan ncogh...@gmail.com: -- status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14035 ___ ___ Python-bugs-list

[issue15061] hmac.secure_compare() leaks information about length of strings

2012-06-15 Thread Nick Coghlan
Nick Coghlan ncogh...@gmail.com added the comment: Can people please stop raising a false dichotomy and using that as an excuse not to do anything? The decision is not between leak some information and leak no information. It is between leak more information and leak less information. The

[issue15061] hmac.secure_compare() leaks information about length of strings

2012-06-15 Thread Martin v . Löwis
Martin v. Löwis mar...@v.loewis.de added the comment: Well, one example: https://github.com/mitsuhiko/python-pbkdf2/blob/master/pbkdf2.py It says that it needs that, but I fail to understand why. pbkdf2 is used to generate encryption keys from passwords, where you don't need to compare

[issue15074] Strange behaviour of python cmd module. (Ignores slash)

2012-06-15 Thread jsevilleja
New submission from jsevilleja j...@jsevilleja.org: I've used the code from here: http://stackoverflow.com/questions/5637124/tab-completion-in-pythons-raw-input/5638688#5638688 and it works. But I've used the same code in a class which inherits from cmd.Cmd, and the code doesn't works. Doing

[issue15061] hmac.secure_compare() leaks information about length of strings

2012-06-15 Thread Nick Coghlan
Nick Coghlan ncogh...@gmail.com added the comment: To repeat, the specific feature being proposed for retention is: * a function called hmac.total_compare() that is clearly documented as being still vulnerable to timing analysis given a sufficiently sophisticated attacker, while still being

[issue15061] hmac.secure_compare() leaks information about length of strings

2012-06-15 Thread Martin v . Löwis
Martin v. Löwis mar...@v.loewis.de added the comment: The timing variations with standard comparison are relatively massive and relatively easy to analyse (if the time taken goes up, you got the previous digit correct). If you have an application that is vulnerable to such an attack, you

[issue15061] hmac.secure_compare() leaks information about length of strings

2012-06-15 Thread Martin v . Löwis
Martin v. Löwis mar...@v.loewis.de added the comment: To repeat, the specific feature being proposed for retention is: To repeat, no use case has been demonstrated for that function. It has been added because it was fun to write, not because it is useful. --

[issue15061] hmac.secure_compare() leaks information about length of strings

2012-06-15 Thread Maciej Fijalkowski
Maciej Fijalkowski fij...@gmail.com added the comment: On Fri, Jun 15, 2012 at 9:41 AM, Nick Coghlan rep...@bugs.python.orgwrote: Nick Coghlan ncogh...@gmail.com added the comment: To repeat, the specific feature being proposed for retention is: * a function called hmac.total_compare()

[issue15061] hmac.secure_compare() leaks information about length of strings

2012-06-15 Thread Maciej Fijalkowski
Maciej Fijalkowski fij...@gmail.com added the comment: On Fri, Jun 15, 2012 at 9:47 AM, Martin v. Löwis rep...@bugs.python.orgwrote: Martin v. Löwis mar...@v.loewis.de added the comment: To repeat, the specific feature being proposed for retention is: To repeat, no use case has been

[issue15061] hmac.secure_compare() leaks information about length of strings

2012-06-15 Thread Hynek Schlawack
Hynek Schlawack h...@ox.cx added the comment: and any other place that compares passwords, tokens, … No no no. Any sensible place to compare passwords would use some sort of one-way function (password hash) before the comparison, so that someone breaking into the machine will not gain the

[issue15061] hmac.secure_compare() leaks information about length of strings

2012-06-15 Thread Nick Coghlan
Nick Coghlan ncogh...@gmail.com added the comment: I'm not really opposed to writing it in C - I just don't think rewriting it in C should be a requirement for keeping it. Even in pure Python, it still leaks less information than the standard comparison operator. --

[issue15061] hmac.secure_compare() leaks information about length of strings

2012-06-15 Thread Maciej Fijalkowski
Maciej Fijalkowski fij...@gmail.com added the comment: On Fri, Jun 15, 2012 at 9:55 AM, Hynek Schlawack rep...@bugs.python.orgwrote: Hynek Schlawack h...@ox.cx added the comment: and any other place that compares passwords, tokens, … No no no. Any sensible place to compare passwords

[issue15061] hmac.secure_compare() leaks information about length of strings

2012-06-15 Thread Martin v . Löwis
Martin v. Löwis mar...@v.loewis.de added the comment: Is comparing passwords against a secure one not useful? I claim that this use case doesn't occur in practice. Everybody uses hashed passwords. If they do compare against a plain-text password, and they want to change something about it,

[issue15061] hmac.secure_compare() leaks information about length of strings

2012-06-15 Thread Nick Coghlan
Nick Coghlan ncogh...@gmail.com added the comment: This point was discussed in #14532 when the new API was added. From http://bugs.python.org/issue14532#msg158045: Given that this issue has affected a lot of security-sensitive third-party code (keyczar, openid providers, almost every python

[issue14991] Option for regex groupdict() to show only matching names

2012-06-15 Thread Ezio Melotti
Changes by Ezio Melotti ezio.melo...@gmail.com: -- components: +Regular Expressions nosy: +ezio.melotti, mrabarnett stage: - needs patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14991

[issue15061] hmac.secure_compare() leaks information about length of strings

2012-06-15 Thread Martin v . Löwis
Martin v. Löwis mar...@v.loewis.de added the comment: I see your point that adding such a function would leverage bad security behavior and thus may be a bad thing. The usefulness of such a function to some(?) people is IMHO not disputable though. I think this entire issue is out of scale.

[issue15007] Unittest CLI does not support test packages very well

2012-06-15 Thread Ezio Melotti
Changes by Ezio Melotti ezio.melo...@gmail.com: -- nosy: +ezio.melotti ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15007 ___ ___

[issue15019] String termination on Linux

2012-06-15 Thread Ezio Melotti
Changes by Ezio Melotti ezio.melo...@gmail.com: -- nosy: +ezio.melotti ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15019 ___ ___

[issue15034] tutorial should use best practices in user defined exceptions section

2012-06-15 Thread Ezio Melotti
Changes by Ezio Melotti ezio.melo...@gmail.com: -- nosy: +ezio.melotti ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15034 ___ ___

[issue14998] pprint._safe_key is not always safe enough

2012-06-15 Thread Ezio Melotti
Changes by Ezio Melotti ezio.melo...@gmail.com: -- nosy: +ezio.melotti stage: needs patch - patch review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14998 ___

[issue15009] urlsplit can't round-trip relative-host urls.

2012-06-15 Thread Ezio Melotti
Changes by Ezio Melotti ezio.melo...@gmail.com: -- nosy: +ezio.melotti stage: - needs patch type: - behavior versions: +Python 3.3 -Python 2.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15009

[issue15061] hmac.secure_compare() leaks information about length of strings

2012-06-15 Thread Martin v . Löwis
Martin v. Löwis mar...@v.loewis.de added the comment: Note that this does not relief you from using a time-independent comparison function. If you call some hash function (which time is known to the attacker), then you compare it against a stored hashed version. If you use a normal compare

[issue15061] hmac.secure_compare() leaks information about length of strings

2012-06-15 Thread Maciej Fijalkowski
Maciej Fijalkowski fij...@gmail.com added the comment: On Fri, Jun 15, 2012 at 10:09 AM, Martin v. Löwis rep...@bugs.python.orgwrote: Martin v. Löwis mar...@v.loewis.de added the comment: Note that this does not relief you from using a time-independent comparison function. If you call

[issue15061] hmac.secure_compare() leaks information about length of strings

2012-06-15 Thread Martin v . Löwis
Martin v. Löwis mar...@v.loewis.de added the comment: For password hashing, the attacker is unlikely to be able to provide the digest directly, but for signature checking it's far more likely to be the case. Can you elaborate? What is the application, where is the digest checking, and what

[issue11600] PY_CFLAGS and PY_CPPFLAGS inconsistent

2012-06-15 Thread Serhiy Storchaka
Serhiy Storchaka storch...@gmail.com added the comment: PY_CFLAGS (C compiler flags) always used with PY_CPPFLAGS (C preprocessor flags). The include directories need for #include, so it is logical that PY_CPPFLAGS did contain them. This may be useful if you use C preprocessor without C

[issue15075] XincludeTest failure in test_xml_etree

2012-06-15 Thread Eli Bendersky
New submission from Eli Bendersky eli...@gmail.com: The XincludeTest test-case in test_xml_etree is now skipped, because it fails in an intermittent manner. I can reproduce the failure when running full regrtest with -j1, but not -j8, and not when run individually. The failure is most likely

[issue15061] hmac.secure_compare() leaks information about length of strings

2012-06-15 Thread Martin v . Löwis
Martin v. Löwis mar...@v.loewis.de added the comment: Martin, you fail to understand how this works. You don't do 2**32 tries to leak the 4 charaters, you need 4 * 256, that's why this attack is so bad, because the time needed for the next character is brute force, but then you can move on

[issue15061] hmac.secure_compare() leaks information about length of strings

2012-06-15 Thread Nick Coghlan
Nick Coghlan ncogh...@gmail.com added the comment: That's why the vulnerable cases are far more likely to be related to *signature* checking. In those you can generally provide both the hash input (the message) and the hash target (the purported signature). If the signature check uses a

[issue15075] XincludeTest failure in test_xml_etree

2012-06-15 Thread Nick Coghlan
Changes by Nick Coghlan ncogh...@gmail.com: -- nosy: +ncoghlan ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15075 ___ ___ Python-bugs-list

[issue15061] hmac.secure_compare() leaks information about length of strings

2012-06-15 Thread Petri Lehtinen
Petri Lehtinen pe...@digip.org added the comment: For example, Django uses time independent comparison to compare signatures of signed cookies. A signed cookie consists of a plain-text value followed by a signature. An attacker wants to construct a cookie that has a malformed value and a

[issue15073] commands.getoutput() is broken

2012-06-15 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc amaur...@gmail.com added the comment: The documentation http://docs.python.org/library/commands.html prominently says Platforms: Unix. This module does not work on Windows. You should really use the subprocess module: import subprocess output =

[issue15061] hmac.secure_compare() leaks information about length of strings

2012-06-15 Thread Nick Coghlan
Nick Coghlan ncogh...@gmail.com added the comment: FWIW, Petri's example also explains why leaking the expected length of the string is considered an acceptable optimisation in most reimplementations of this signature check comparison: the attacker is assumed to already know the expected

[issue12508] Codecs Anomaly

2012-06-15 Thread Serhiy Storchaka
Changes by Serhiy Storchaka storch...@gmail.com: -- versions: +Python 2.7, Python 3.3 Added file: http://bugs.python.org/file26013/fffd-2.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12508

[issue1598083] Top-level exception handler writes to stdout unsafely

2012-06-15 Thread Serhiy Storchaka
Serhiy Storchaka storch...@gmail.com added the comment: It looks like another reason to replace codecs.open on io.open. -- nosy: +storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1598083

[issue15061] hmac.secure_compare() leaks information about length of strings

2012-06-15 Thread Martin v . Löwis
Martin v. Löwis mar...@v.loewis.de added the comment: That's why the vulnerable cases are far more likely to be related to *signature* checking. In those you can generally provide both the hash input (the message) and the hash target (the purported signature). I see. I wonder how feasible

[issue5067] Error msg from using wrong quotes in JSON is unhelpful

2012-06-15 Thread Serhiy Storchaka
Serhiy Storchaka storch...@gmail.com added the comment: Patch adapted for Python 3.3. Consistently changed messages in C code, docs and docstrings. -- components: +Documentation nosy: +storchaka versions: +Python 2.7, Python 3.2, Python 3.3 -Python 2.6 Added file:

[issue15061] hmac.secure_compare() leaks information about length of strings

2012-06-15 Thread Armin Rigo
Changes by Armin Rigo ar...@users.sourceforge.net: -- nosy: -arigo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15061 ___ ___ Python-bugs-list

[issue15076] Sometimes couldn't import os, shown 'import site' failed, use -v for trackback

2012-06-15 Thread Leon Zhang
New submission from Leon Zhang leozh...@cisco.com: Hello Experts, I am using Python 2.6.2 on a Linux machine. I found sometimes I have problem to run my simple python script. Linux version and Python version leonz@fxcsgbu2c1% uname -a SunOS fxcsgbu2c1 5.8 Generic_117350-06

[issue15061] hmac.secure_compare() leaks information about length of strings

2012-06-15 Thread Christian Heimes
Christian Heimes li...@cheimes.de added the comment: Oh dead god, what have I done ... I threw a small stone and caused a major landslide. :) I'm all with Nick on this topic. A correctly named and documented function provides a tool to users that greatly reduced the change of a side channel

[issue15075] XincludeTest failure in test_xml_etree

2012-06-15 Thread Eli Bendersky
Eli Bendersky eli...@gmail.com added the comment: After some tinkering I found which test when run before test_xml_etree causes it to crash: $ ./python -m test.regrtest test___all__ test_xml_etree [1/2] test___all__ [2/2] test_xml_etree Fatal Python error: Segmentation fault Current thread

[issue15061] hmac.secure_compare() leaks information about length of strings

2012-06-15 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: I could wrap up a quick C implementation if you like. The operator module is a better place for a total_compare() function. Do you a agree? I think the function is fine in either hashlib or hmac. Putting it in one of these modules is a hint

[issue15077] Regexp match goes into infinite loop

2012-06-15 Thread Moriyoshi Koizumi
New submission from Moriyoshi Koizumi mozo+pyt...@mozo.jp: A peculiar pair of a regexp and a target string causes the runtime into an infinite loop. The same expression works with Perl. -- components: Regular Expressions files: x.py messages: 162883 nosy: ezio.melotti, moriyoshi,

[issue15075] XincludeTest failure in test_xml_etree

2012-06-15 Thread Eli Bendersky
Eli Bendersky eli...@gmail.com added the comment: As suspected, the cause is that xinclude_loader manages to somehow import the C version of ET, although test_xml_etree tries to enforce the Python version. This is probably because test___all__ imports all modules and leaves stuff in the

[issue15061] hmac.secure_compare() leaks information about length of strings

2012-06-15 Thread Nick Coghlan
Nick Coghlan ncogh...@gmail.com added the comment: As a first step, I'm going to make a change to: 1. Rename the function to compare_digest 2. Remove the support for comparing strings 3. Update the documentation to be much clearer about its limitations (including why it's considered OK to leak

[issue15078] Change os.sendfile so its arguments are stable

2012-06-15 Thread Larry Hastings
New submission from Larry Hastings la...@hastings.org: As I keep saying on python-dev: I think that the argument list for a function should be stable. If you have a function where some abilities are only available on certain platforms, it's best to always accept default no-op parameters for

[issue14423] Getting the starting date of iso week from a week number and a year.

2012-06-15 Thread Erik Cederstrand
Erik Cederstrand e...@cederstrand.dk added the comment: I would like to point out that http://bugs.python.org/issue12006 provides a solution (including patches) based on %G%, V and %u directives for use in strptime()/strftime(). These directives are defined in (FreeBSD) libc, and PHP has

[issue15061] hmac.secure_compare() leaks information about length of strings

2012-06-15 Thread Roundup Robot
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset f36af3766a20 by Nick Coghlan in branch 'default': Issue #15061: Don't oversell the capabilities of the new non-shortcircuiting comparison function in hmac http://hg.python.org/cpython/rev/f36af3766a20 --

[issue14955] hmac.secure_compare() is not time-independent for unicode strings

2012-06-15 Thread Nick Coghlan
Nick Coghlan ncogh...@gmail.com added the comment: As a result of the discussions on #15061, I removed unicode comparison support altogether in f36af3766a20 (updating the warning on the hexdigest() method accordingly). Are folks happy to close this issue on that basis? (I'll raise the

[issue15036] mailbox.mbox fails to pop two items in a row, flushing in between

2012-06-15 Thread Petri Lehtinen
Petri Lehtinen pe...@digip.org added the comment: As I suspected, all single-file mailboxes(mbox, MMDF, Babyl) have this issue. Attached a patch with tests. -- keywords: +patch Added file: http://bugs.python.org/file26017/issue15036.patch ___ Python

[issue15061] hmac.secure_compare() leaks information about length of strings

2012-06-15 Thread Nick Coghlan
Nick Coghlan ncogh...@gmail.com added the comment: OK, the worst aspects (the misleading name and documentation) have been dealt with, so that leaves the questions of: 1. Avoiding leaking the length information (seems unnecessary, since most digests are part of protocols where they have a

[issue15061] hmac.secure_compare() leaks information about length of strings

2012-06-15 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: 2. Providing a C implementation via the operator module (given the restriction to bytes values, and the assumption of caching for all relevant integers, would a C reimplementation really be buying us much additional security?) I like the fact

[issue15061] hmac.secure_compare() leaks information about length of strings

2012-06-15 Thread Christian Heimes
Christian Heimes li...@cheimes.de added the comment: Am 15.06.2012 14:21, schrieb Antoine Pitrou: I like the fact that a C implementation can be audited much more easily. Who knows what kind of effects the Python implementation can trigger, if some optimizations get added in the future.

[issue15073] commands.getoutput() does not work on windows

2012-06-15 Thread R. David Murray
R. David Murray rdmur...@bitdance.com added the comment: Hmm. Maybe issue 10197 should be reclassified as an enhancement... -- nosy: +r.david.murray resolution: wont fix - duplicate superseder: - subprocess.getoutput fails on win32 title: commands.getoutput() is broken -

[issue15061] hmac.secure_compare() leaks information about length of strings

2012-06-15 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: The point of supporting unicode would precisely be to avoid a unicode-bytes conversion when unicode strings are received. A byte-wise comparison of the memory representation would work IFF both sides have the same type and unicode kind.

[issue15077] Regexp match goes into infinite loop

2012-06-15 Thread Serhiy Storchaka
Serhiy Storchaka storch...@gmail.com added the comment: This is not infinite loop. This is O(2**len(prefix_before_first_quote)) computation. Measure times of matching for INSER(`id`..., INSERT(`id`..., INSERT (`id`..., INSERT I(`id`..., etc. Better use

[issue15078] Change os.sendfile so its arguments are stable

2012-06-15 Thread Antoine Pitrou
Changes by Antoine Pitrou pit...@free.fr: -- nosy: +giampaolo.rodola, neologix ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15078 ___ ___

[issue15073] commands.getoutput() does not work on windows

2012-06-15 Thread Pavel Fedin
Pavel Fedin p.fe...@samsung.com added the comment: I see it's deprecated and dropped, but anyway, why not to fix it to work on Windows? From 10197 i see the fix is quite simple, and there is lots of legacy code i believe. -- ___ Python tracker

[issue15074] Strange behaviour of python cmd module. (Ignores slash)

2012-06-15 Thread Peter Otten
Peter Otten __pete...@web.de added the comment: Not a python bug. You are ommitting an important detail of the stackoverflow example in your code: # we want to treat '/' as part of a word, so override the delimiters readline.set_completer_delims(' \t\n;') Please turn to the Python mailing

[issue15061] hmac.secure_compare() leaks information about length of strings

2012-06-15 Thread Nick Coghlan
Nick Coghlan ncogh...@gmail.com added the comment: (Ah, the dangers of using a real text editor for edit fields. This got rather long, but I think it's all still relevant) I'm persuaded that a C implementation is a good idea in the long run. However, I *don't* think we should rush the design

[issue15078] Change os.sendfile so its arguments are stable

2012-06-15 Thread Serhiy Storchaka
Serhiy Storchaka storch...@gmail.com added the comment: I believe, that instead of a integer flags will be better and more portable to use boolean parameters (diskio=True, wait=True, sync=False). All additional parameters should be keyword-only. os.sendfile(out, in, offset, nbytes, *,

[issue15052] Outdated comments in build_ssl.py

2012-06-15 Thread Jeremy Kloth
Jeremy Kloth jeremy.kl...@gmail.com added the comment: I would suggest trying to build OpenSSL (build_ssl.py) *without* Perl installed. On Windows (7,64-bit at least) a dialog box pops up many times asking which program to use to run XXX.pl. This is using the externals from svn.python.org.

[issue15019] String termination on Linux

2012-06-15 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc amaur...@gmail.com added the comment: Jānis: Prints 11 This is not what I get on Linux: I see 11 Hithere:) because the console chooses to not print the \x00. The character is present in the output stream though. Did you really got a truncated output? How did you run

[issue15068] fileinput requires two EOF when reading stdin

2012-06-15 Thread Joey Geralnik
Joey Geralnik jgeral...@gmail.com added the comment: First off, I'm a complete noob looking at the python source code for the first time so forgive me if I've done something wrong. What if the length of the chunk is checked as well? The following code works fine: import sys while True:

[issue15066] make install error: ImportError: No module named _struct

2012-06-15 Thread suzhengchun
suzhengchun suzhengc...@yahoo.com.cn added the comment: Thank for your attention. I try it: suzc@linux-opensuse:22:02:51:Python-2.7.3$ PYTHONPATH=/WORK/suzc/installed/python/lib/python2.7 ./python -c 'import sys; print(sys.path)' ['', '/WORK/suzc/installed/python/lib/python2.7',

[issue15068] fileinput requires two EOF when reading stdin

2012-06-15 Thread Serhiy Storchaka
Serhiy Storchaka storch...@gmail.com added the comment: The patch I've attached checks if the number of bytes read from the file is less than the size of the buffer (which means that the file has ended). From io.RawIOBase.read docs: Read up to n bytes from the object and return them. As a

[issue15068] fileinput requires two EOF when reading stdin

2012-06-15 Thread Joey Geralnik
Joey Geralnik jgeral...@gmail.com added the comment: But this is calling the readlines function, which continually reads from the file until more bytes have been read than the specified argument. From bz2.readlines: size can be specified to control the number of lines read: no further lines

[issue15068] fileinput requires two EOF when reading stdin

2012-06-15 Thread Joey Geralnik
Joey Geralnik jgeral...@gmail.com added the comment: Forget other filelike objects. The FileInput class only works with actual files, so the readlines function should always return at least as many bytes as its first parameter. Is this assumption wrong? --

[issue15068] fileinput requires two EOF when reading stdin

2012-06-15 Thread R. David Murray
R. David Murray rdmur...@bitdance.com added the comment: fileinput should work (for some definition of work) for anything that can be opened by name using the open syscall on unix. That includes many more things than files. Named pipes are a particularly interesting example in this context.

[issue15068] fileinput requires two EOF when reading stdin

2012-06-15 Thread R. David Murray
R. David Murray rdmur...@bitdance.com added the comment: So the real question is: does readlines block until the byte count is satisified? It might, but the docs for io.IOBase.readlines leave open the possibility that fewer lines will be read, and do not limit that to the EOF case. It's not

[issue15068] fileinput requires two EOF when reading stdin

2012-06-15 Thread R. David Murray
R. David Murray rdmur...@bitdance.com added the comment: The _pyio.py version of readlines does read until the count is equaled or exceeded. This could, however, be an implementation detail and not part of the spec. -- ___ Python tracker

[issue15068] fileinput requires two EOF when reading stdin

2012-06-15 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: Le vendredi 15 juin 2012 à 14:41 +, Serhiy Storchaka a écrit : From io.RawIOBase.read docs: Read up to n bytes from the object and return them. As a convenience, if n is unspecified or -1, readall() is called. Otherwise, only one system

[issue15068] fileinput requires two EOF when reading stdin

2012-06-15 Thread Serhiy Storchaka
Serhiy Storchaka storch...@gmail.com added the comment: Forget other filelike objects. The FileInput class only works with actual files, No. sys.stdin can be reassigned before using FileInput. And FileInput has openhook parameter (for read compressed files or get files from Web, for

[issue15068] fileinput requires two EOF when reading stdin

2012-06-15 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: so the readlines function should always return at least as many bytes as its first parameter. Is this assumption wrong? qwert 'qwert\n' You type five characters qwert end press Enter. Python immediately receives these six characters,

[issue15061] hmac.secure_compare() leaks information about length of strings

2012-06-15 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: Secondly, it seems to me that the proposed lower level feature may make more sense as a bytes method rather than as a function in the operator module. If it's a function, though, it can compare all kinds of buffer-like objects (bytearrays,

[issue14955] hmac.secure_compare() is not time-independent for unicode strings

2012-06-15 Thread Jon Oberheide
Jon Oberheide j...@oberheide.org added the comment: Sounds good to me, Nick. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14955 ___ ___

[issue15064] multiprocessing should use more context manager

2012-06-15 Thread Tshepang Lekhonkhobe
Changes by Tshepang Lekhonkhobe tshep...@gmail.com: -- nosy: +tshepang ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15064 ___ ___

[issue15068] fileinput requires two EOF when reading stdin

2012-06-15 Thread Serhiy Storchaka
Serhiy Storchaka storch...@gmail.com added the comment: But sys.stdin does not implement RawIOBase, it implements TextIOBase. sys.stdin.buffer.raw implements RawIOBase. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15068

[issue15068] fileinput requires two EOF when reading stdin

2012-06-15 Thread Serhiy Storchaka
Serhiy Storchaka storch...@gmail.com added the comment: qwert 'qwert\n' Oh, it seems that the mail server again ate some lines of my examples. Well, did you try readline() or readlines()? Yes, it's my mistake, I used readline(). -- ___

[issue14904] test_unicode_repr_oflw (in test_bigmem) crashes

2012-06-15 Thread Roundup Robot
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset 1c9635109079 by Antoine Pitrou in branch '2.7': Skip test_bigmem.test_unicode_repr_oflw, since it crashes (issue #14904). http://hg.python.org/cpython/rev/1c9635109079 -- nosy: +python-dev

[issue15079] pickle: Possibly misplaced test

2012-06-15 Thread Stefan M
New submission from Stefan M mstefa...@gmail.com: After issue7455 was fixed, a test was created to reflect the fix (Lib/test/pickletester.py @ AbstractPickleModuleTests.test_bad_input). The test makes sure that an UnpicklingError is raised whenever pickled data attempts to pop on an empty

[issue15068] fileinput requires two EOF when reading stdin

2012-06-15 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: Oh, it seems that the mail server again ate some lines of my examples. This is a bug in the e-mail gateway. You can lobby for a fix at http://psf.upfronthosting.co.za/roundup/meta/issue264 -- ___

[issue15079] pickle: Possibly misplaced test

2012-06-15 Thread R. David Murray
R. David Murray rdmur...@bitdance.com added the comment: It would be best to have the pickle tests always run against both the C and python code. We do this for other modules that have C versions of some or all of the Python code. And yes, making the two consistent is also good. Since

[issue14933] Misleading documentation about weakrefs

2012-06-15 Thread Roundup Robot
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset 69177ff1a643 by Antoine Pitrou in branch '3.2': Issue #14933: fix misleading doc about weakref support in extension types. http://hg.python.org/cpython/rev/69177ff1a643 New changeset b17c8005e08a by Antoine Pitrou

[issue14933] Misleading documentation about weakrefs

2012-06-15 Thread Antoine Pitrou
Changes by Antoine Pitrou pit...@free.fr: -- resolution: - fixed stage: - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14933 ___

[issue14059] Implement multiprocessing.Barrier

2012-06-15 Thread Roundup Robot
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset 2d2f206d040e by Richard Oudkerk in branch 'default': Issue #14059: Implement multiprocessing.Barrier http://hg.python.org/cpython/rev/2d2f206d040e -- nosy: +python-dev

[issue15026] Faster UTF-16 encoding

2012-06-15 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: Serhiy, the tests crash here in debug mode: $ ./python -m test -v test_unicode == CPython 3.3.0a4+ (default:b17c8005e08a+, Jun 15 2012, 19:28:56) [GCC 4.5.2] == Linux-2.6.38.8-desktop-10.mga-x86_64-with-mandrake-1-Official little-endian ==

[issue14874] Faster charmap decoding

2012-06-15 Thread Antoine Pitrou
Changes by Antoine Pitrou pit...@free.fr: -- stage: - patch review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14874 ___ ___ Python-bugs-list

[issue15075] XincludeTest failure in test_xml_etree

2012-06-15 Thread Eli Bendersky
Eli Bendersky eli...@gmail.com added the comment: Here is a patch that solves the current problem. A longer term solution would be to have a cleaner test plan for ET in general, without monkey-patching at all, and without state that causes test-order dependencies. -- keywords: +patch

[issue15036] mailbox.mbox fails to pop two items in a row, flushing in between

2012-06-15 Thread Roundup Robot
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset 0add70dd3c43 by Petri Lehtinen in branch '2.7': #15036: Make a repeated changes and flushes work with single-file mailboxes http://hg.python.org/cpython/rev/0add70dd3c43 New changeset 714b8f91f3d4 by Petri Lehtinen

[issue15008] PEP 362 Signature Objects reference implementation

2012-06-15 Thread Yury Selivanov
Yury Selivanov yseliva...@gmail.com added the comment: Attaching the new version of the patch. Summary: 1. 'is_*' family was replaced with 'Parameter.kind' 2. 'signature()' function was updated to check for '__wrapped__' attribute in all callables 3. 'is_implemented' - 'implemented' 4. Added

[issue15036] mailbox.mbox fails to pop two items in a row, flushing in between

2012-06-15 Thread Petri Lehtinen
Changes by Petri Lehtinen pe...@digip.org: -- resolution: - fixed stage: needs patch - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15036 ___

[issue15036] mailbox.mbox fails to pop two items in a row, flushing in between

2012-06-15 Thread R. David Murray
R. David Murray rdmur...@bitdance.com added the comment: The news item isn't completely clear. It sounds like the mailbox is now automatically being flushed between pops, but what you really fixed is popping if the *application* does a flush between them, right? --

[issue15074] Strange behaviour of python cmd module. (Ignores slash)

2012-06-15 Thread Ned Deily
Changes by Ned Deily n...@acm.org: -- resolution: - invalid status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15074 ___ ___

  1   2   >