[issue10516] Add list.clear() and list.copy()

2011-03-01 Thread Raymond Hettinger

Raymond Hettinger rhettin...@users.sourceforge.net added the comment:

 Hmm, shouldn't self.__class__(self) be a 
 good default implementation of copy()?

 I'd expect any sequence to support this way 
 of creation from another sequence, even if it's inefficient.

The copy() method isn't being proposed for MutableSequence because it presumes 
that we know something about the constructor's signature.  For example, the 
constructor of array() needs the element storage type as an argument.  We 
refuse the temptation to guess.

In the Set api, we had no choice because many set-methods necessarily create a 
new set.  To handle the constructor signature problem, the creation step was 
factored-out into the from_iterable() method so that a user could override it 
if necessary.

Also copy() is handled oddly in the builtin types.  To handle the constructor 
signature issue for subclasses, they ignore the subclass and return a instance 
of the base class.  For example, the inherited copy() method on a subclass of 
list or dict will create an instance of list or dict, not of the subclass 
itself.  Accordingly, subclasses that want instances of themselves have to 
override the inherited copy() method.  They would have to do this anyway if 
they subclass contained any other data in the class dictionary that would need 
to be passed along to a copy.

In short, we're better-off not supplying copy() as part of the MutableSequence 
ABC.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10516
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11140] threading.Lock().release() raises _thread.error, not RuntimeError

2011-03-01 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

Hello,

 Shouldn't this be fixed in _dummy_thread too?
 
 Attached patch contains fix + test.

Oops, thanks for noticing.

 (Unfortunately, I was not able to run the tests with my patch:
 `python3.2 -m test.regrtest test_dummy_thread` tests my 'system'
 version, not my svn checkout.

You must run ./python instead and it should work.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11140
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11349] _pickle should implement the module finalisation protocol

2011-03-01 Thread Nick Coghlan

Nick Coghlan ncogh...@gmail.com added the comment:

We might be able to tapdance our way around the issue by falling back to the 
old mechanism when dealing with extension modules without 
traverse/clear/dealloc methods.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11349
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11349] _pickle should implement the module finalisation protocol

2011-03-01 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

Not sure why #812369 is bogged down. The patch simply needs updating for 3.x.

--
nosy: +pitrou

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11349
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1559549] ImportError needs attributes for module and file name

2011-03-01 Thread Ram Rachum

Changes by Ram Rachum cool...@cool-rr.com:


--
nosy: +cool-RR

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1559549
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8927] Handle version incompatibilities in dependencies

2011-03-01 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

Re: title, I don’t know how to phrase it best.  What exactly is the behavior 
you request?  I put “handle” as in “do the right thing”, that is, “don’t 
install the newest version but the one that satisfies all predicates”.  I 
softened “conflicts” to “incompatibilities”, does it work for you?  In any 
case, the important thing is that your report describes the problem well.

Re: 404, it has moved to 
http://distutils2.notmyidea.org/library/distutils2.depgraph.html

--
nosy: +alexis
title: Handle version conflicts in dependencies - Handle version 
incompatibilities in dependencies

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8927
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9436] test_sysconfig failure

2011-03-01 Thread Éric Araujo

Changes by Éric Araujo mer...@netwok.org:


--
nosy: +eric.araujo

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9436
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7867] Proposed FAQ entry on pass-by-? semantics and the meaning of 'variable' in python

2011-03-01 Thread Éric Araujo

Changes by Éric Araujo mer...@netwok.org:


--
nosy: +eric.araujo

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7867
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8933] Invalid detection of metadata version

2011-03-01 Thread Filip Gruszczyński

Filip Gruszczyński grusz...@gmail.com added the comment:

I'll get down to it.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8933
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10900] bz2 module fails to uncompress large files

2011-03-01 Thread Charles-Francois Natali

Charles-Francois Natali neolo...@free.fr added the comment:

@Eric.Wolf

Could you try with this:

# Read in anohter chunk of the file
# NOTE: It's possible that an XML tag will be greater than buffsize
#   This will break in that situation
-newb = self.fp.read(self.bufpos)
+newb = self.fp.read(self.buffsize)

Also, could you provide the output of
strace -emmap2,sbrk,brk python script

I could be completely wrong, but both in your case and in wrobell's case, 
there's a lot of _PyBytes_Resize going on, and given how PyObject_Realloc is 
implemented, this could lead to heavy heap fragmentation.

--
nosy: +neologix

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10900
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11360] In documentation of getopt, advertise argparse instead of optparse

2011-03-01 Thread Daniel Haertle

New submission from Daniel Haertle haer...@uni-bonn.de:

At the beginning of http://docs.python.org/dev/library/getopt.html the line

A more convenient, flexible, and powerful alternative is the optparse module.

routes the user to optparse. Since optparse is deprecated in favor of argparse, 
this line is no more up-to-date.

The best is to remove this line completely, since there already is a note 
routing to argparse.

--
assignee: docs@python
components: Documentation
messages: 129753
nosy: Danh, docs@python
priority: normal
severity: normal
status: open
title: In documentation of getopt, advertise argparse instead of optparse
versions: Python 3.2, Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11360
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11351] Mac OS X os.sendfile()

2011-03-01 Thread Steffen Daode Nurpmeso

Steffen Daode Nurpmeso sdao...@googlemail.com added the comment:

I'm trashing your mailbox, but 
http://bugs.python.org/file20949/issue11351-2.patch should do 
'total+=blen' not 'total+=len'.
Anyway i attach yet a third patch which does some code cleanup in 
general and is a bit more of my very own coding style, because 
i have seen that gotos seem to be possible in Python, and because 
i was unable to enjoy the code (and this is beautiful C!) before. 
It also follows PEP guidelines more than before.

This compiles clean and runs the test even if i
hg revert  hg patch
(I'm a bit messy)

--
Added file: http://bugs.python.org/file20955/issue11351-3.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11351
___diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -5866,37 +5866,47 @@
 }
 
 #ifdef HAVE_SENDFILE
-#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__APPLE__)
-static int
+# if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__APPLE__)
+static Py_ssize_t
 iov_setup(struct iovec **iov, Py_buffer **buf, PyObject *seq, int cnt, int 
type)
 {
 int i, j;
+Py_ssize_t blen, total = 0;
+
 *iov = PyMem_New(struct iovec, cnt);
 if (*iov == NULL) {
 PyErr_NoMemory();
-return 0;
-}
+goto jleave;
+}
+
 *buf = PyMem_New(Py_buffer, cnt);
 if (*buf == NULL) {
 PyMem_Del(*iov);
 PyErr_NoMemory();
-return 0;
+goto jleave;
 }
 
 for (i = 0; i  cnt; i++) {
-if (PyObject_GetBuffer(PySequence_GetItem(seq, i), (*buf)[i],
-type) == -1) {
-PyMem_Del(*iov);
-for (j = 0; j  i; j++) {
-PyBuffer_Release((*buf)[j]);
-   }
-PyMem_Del(*buf);
-return 0;
-}
+if (PyObject_GetBuffer(PySequence_GetItem(seq, i),
+   (*buf)[i], type) == -1)
+goto jrelease;
+
 (*iov)[i].iov_base = (*buf)[i].buf;
-(*iov)[i].iov_len = (*buf)[i].len;
-}
-return 1;
+blen = (*buf)[i].len;
+(*iov)[i].iov_len = blen;
+total += blen;
+}
+
+jleave:
+return total;
+
+jrelease:
+PyMem_Del(*iov);
+for (j = 0; j  i; j++)
+PyBuffer_Release((*buf)[j]);
+PyMem_Del(*buf);
+total = 0;
+goto jleave;
 }
 
 static void
@@ -5904,12 +5914,11 @@
 {
 int i;
 PyMem_Del(iov);
-for (i = 0; i  cnt; i++) {
+for (i = 0; i  cnt; i++)
 PyBuffer_Release(buf[i]);
-}
 PyMem_Del(buf);
 }
-#endif
+# endif
 
 PyDoc_STRVAR(posix_sendfile__doc__,
 sendfile(out, in, offset, nbytes) - byteswritten\n\
@@ -5924,10 +5933,10 @@
 Py_ssize_t ret;
 off_t offset;
 
-#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__APPLE__)
-#ifndef __APPLE__
+# if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__APPLE__)
+#  ifndef __APPLE__
 Py_ssize_t len;
-#endif
+#  endif
 PyObject *headers = NULL, *trailers = NULL;
 Py_buffer *hbuf, *tbuf;
 off_t sbytes;
@@ -5939,46 +5948,58 @@
 offset, count,
 headers, trailers, flags, NULL};
 
-#ifdef __APPLE__
 if (!PyArg_ParseTupleAndKeywords(args, kwdict, iiOO|OOi:sendfile,
-keywords, out, in, _parse_off_t, offset, _parse_off_t, sbytes,
-#else
-if (!PyArg_ParseTupleAndKeywords(args, kwdict, iiOn|OOi:sendfile,
-keywords, out, in, _parse_off_t, offset, len,
-#endif
-headers, trailers, flags))
+ keywords, out, in, _parse_off_t,
+#  ifdef __APPLE__
+ offset, _parse_off_t, sbytes,
+#  else
+ offset, len,
+#  endif
+ headers, trailers, flags))
 return NULL;
+
 if (headers != NULL) {
 if (!PySequence_Check(headers)) {
 PyErr_SetString(PyExc_TypeError,
-sendfile() headers must be a sequence or None);
+sendfile() headers must be a sequence or None);
 return NULL;
 } else {
+Py_ssize_t i = 0; /* (Avoid uninitialized warning) */
 sf.hdr_cnt = PySequence_Size(headers);
-if (sf.hdr_cnt  0  !iov_setup((sf.headers), hbuf,
-headers, sf.hdr_cnt, PyBUF_SIMPLE))
+if (sf.hdr_cnt  0 
+(i = iov_setup((sf.headers), hbuf,
+   headers, sf.hdr_cnt, PyBUF_SIMPLE)) == 0)
 return NULL;
+#  ifdef __APPLE__
+sbytes += i;
+#  endif
 }
 }
+
 if (trailers != NULL) {
 if (!PySequence_Check(trailers)) {
 PyErr_SetString(PyExc_TypeError,
-sendfile() trailers must be a sequence or 

[issue11354] argparse: nargs could accept range of options count

2011-03-01 Thread Daniel Haertle

Daniel Haertle haer...@uni-bonn.de added the comment:

Hi Wojciech,

in your tests, at

def test_add_argument10(self):
nargs = (0, 1) = optimized to '?'
opt = self.add_argument(1, None)
self.assertEqual(opt.nargs, argparse.ONE_OR_MORE)

you should change argparse.ONE_OR_MORE to argparse.OPTIONAL.

--
nosy: +Danh

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11354
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8933] Invalid detection of metadata version

2011-03-01 Thread Filip Gruszczyński

Changes by Filip Gruszczyński grusz...@gmail.com:


Removed file: http://bugs.python.org/file20942/8933.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8933
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8933] Invalid detection of metadata version

2011-03-01 Thread Filip Gruszczyński

Filip Gruszczyński grusz...@gmail.com added the comment:

Patch with tests. Hope this is enough.

--
Added file: http://bugs.python.org/file20956/8933.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8933
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11351] Mac OS X os.sendfile()

2011-03-01 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

Well the third patch has a lot of spurious style changes that make it harder to 
spot the actual changes.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11351
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11351] Mac OS X os.sendfile()

2011-03-01 Thread Steffen Daode Nurpmeso

Steffen Daode Nurpmeso sdao...@googlemail.com added the comment:

Aah, unfortunately - what a shame, this beautiful language ... 
But do i need to re-post the real (ouch!) issue11351-2.patch, i.e. with 
'total+=blen' instead of 'total+=len'? 
Or is it sufficient now with these comments (for Giampaolo')?

 Antoine Pitrou pit...@free.fr added the comment:
 
 Well the third patch has a lot of spurious style changes that make it harder 
 to spot the actual changes.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11351
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11324] ConfigParser(interpolation=None) doesn't work

2011-03-01 Thread Tobias Brink

Tobias Brink tobias.br...@gmail.com added the comment:

I added a test but I am not too familiar with the Python test suite.  Please 
check if the test_init_takes_interpolation_none test is necessary because the 
test suite also fails without it if my patch is not applied.  Feel free to 
remove it if it is superfluous.

--
Added file: http://bugs.python.org/file20957/patch_with_test.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11324
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11351] Mac OS X os.sendfile()

2011-03-01 Thread Steffen Daode Nurpmeso

Steffen Daode Nurpmeso sdao...@googlemail.com added the comment:

Maybe Giampaolo' should at least replace these two 
PyArg_ParseTupleAndKeywords() near (unpatched) line 5942, 
because doing it like this is messes up (at least) vim(1) group 
detection, resulting in a lot of bold red mis-brace warnings 
further on?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11351
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11361] suggestion for os.kill(pid,CTRL_C_EVENT)

2011-03-01 Thread Igor

New submission from Igor i...@prettysin.info:

Hello!

I see some 'skip' in test_os.py


@unittest.skip(subprocesses aren't inheriting CTRL+C property)
def test_CTRL_C_EVENT(self):

I think, problem with calling SetConsoleCtrlHandler(NULL,0) in parent process, 
rather in child. If call SetConsoleCtrlHandler(NULL, 0).

Calling SetConsoleCtrlHandler(ctrl_handler, 1) is not enough. Need first call 
SetConsoleCtrlHandler(NULL, 0).



My patch for this test fixture: (may be, not so good, but it works)


H:\usr\python27\Lib\testdiff win_console_handler.py win_console_handler.py_orig

26,27d25
 elif sig == signal.SIGINT:
 pass
34,35d31
 def ctrl_handler_int(sig, obj):
 sys.exit(1)
40d35
 NULL = ctypes.POINTER(ctypes.c_int)()
43,53d37
 # Calling this with NULL and FALSE causes the calling process to
 # handle CTRL+C, rather than ignore it. This property isn't inherited
 # by subprocesses, if it's created with CREATE_NEW_PROCESS_GROUP flag
 SetConsoleCtrlHandler.argtypes = (ctypes.POINTER(ctypes.c_int), wintypes.B
OOL)
 if not SetConsoleCtrlHandler(NULL, 0):
 print(Unable to restore SetConsoleCtrlHandler)
 exit(-1)

 signal.signal(signal.SIGINT, ctrl_handler_int)

 SetConsoleCtrlHandler.argtypes = (HandlerRoutine, wintypes.BOOL)
57a42


And on my machine  (win2003 32bit):
...
test_CTRL_BREAK_EVENT (__main__.Win32KillTests) ... ok
test_CTRL_C_EVENT (__main__.Win32KillTests) ... ok
test_kill_int (__main__.Win32KillTests) ... ok
test_kill_sigterm (__main__.Win32KillTests) ... ok

--
Ran 61 tests in 2.344s

OK

--
components: IO
messages: 129761
nosy: iigor
priority: normal
severity: normal
status: open
title: suggestion for os.kill(pid,CTRL_C_EVENT)
type: behavior
versions: Python 2.7

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11361
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11358] Please replace the use of pickle in multiprocessing with json.

2011-03-01 Thread david

david db.pub.m...@gmail.com added the comment:

On 1 March 2011 18:01, Alex rep...@bugs.python.org wrote:

 Alex alex.gay...@gmail.com added the comment:

 Why?  JSON is incapable of representing most Python datastructures that can 
 be pickled (i.e. anything that isn't a list, tuple, dict, int, or str).

I would have suggested yaml (using safe_load() ) . However there isn't
a 'core' yaml module afaik.

If you wanted to actually transfer a complex python data-structure no
one would stop you from pickling it and sending it (json'ed).

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11358
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11351] Mac OS X os.sendfile()

2011-03-01 Thread Giampaolo Rodola'

Giampaolo Rodola' g.rod...@gmail.com added the comment:

Please try to provide a patch which fixes (as in makes the test pass) this 
specific issue only. As for other changes such as the code restyling you can 
open a separate ticket with another patch.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11351
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11359] Please replace the use of pickle in subprocess with json.

2011-03-01 Thread david

david db.pub.m...@gmail.com added the comment:

Um this isn't a duplicate this is addressing a different module to 
multiprocessing. Currently in subprocess you can almost remove the use of 
pickle with little to no side-effects.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11359
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11359] Please replace the use of pickle in subprocess with json.

2011-03-01 Thread david

david db.pub.m...@gmail.com added the comment:

Can you please re-open this bug ? (unless you feel otherwise).

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11359
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11361] suggestion for os.kill(pid,CTRL_C_EVENT)

2011-03-01 Thread Igor

Changes by Igor i...@prettysin.info:


--
keywords: +patch
Added file: http://bugs.python.org/file20958/1.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11361
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11324] ConfigParser(interpolation=None) doesn't work

2011-03-01 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

Thanks, the configparser maintainer will review your patch.

Łukasz, you may want to use assertIsNone when you commit.

--
keywords: +needs review
stage:  - patch review

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11324
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11351] Mac OS X os.sendfile()

2011-03-01 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

 Maybe Giampaolo' should at least replace these two 
 PyArg_ParseTupleAndKeywords() near (unpatched) line 5942, 
 because doing it like this is messes up (at least) vim(1) group 
 detection, resulting in a lot of bold red mis-brace warnings 
 further on?

Problem is, each developer has his/her own preferences and editor
settings, so if we start reformatting with each commit, the history of a
piece of code becomes very difficult to read.

I would simply suggest that you disable these vim settings, or at least
tweak them so that they don't apply automatically when you edit existing
code.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11351
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11351] Mac OS X os.sendfile()

2011-03-01 Thread Steffen Daode Nurpmeso

Steffen Daode Nurpmeso sdao...@googlemail.com added the comment:

So this is fixed -2.patch supplemented only with 
PyArg_ParseTupleAndKeywords() fixed in a way that re-enables 
correct syntax highlighting.

--
Added file: http://bugs.python.org/file20959/issue11351-4.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11351
___diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -5867,36 +5867,42 @@
 
 #ifdef HAVE_SENDFILE
 #if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__APPLE__)
-static int
+static Py_ssize_t
 iov_setup(struct iovec **iov, Py_buffer **buf, PyObject *seq, int cnt, int 
type)
 {
 int i, j;
+Py_ssize_t blen, total = 0;
+
 *iov = PyMem_New(struct iovec, cnt);
 if (*iov == NULL) {
 PyErr_NoMemory();
-return 0;
-}
+return total;
+}
+
 *buf = PyMem_New(Py_buffer, cnt);
 if (*buf == NULL) {
 PyMem_Del(*iov);
 PyErr_NoMemory();
-return 0;
+return total;
 }
 
 for (i = 0; i  cnt; i++) {
-if (PyObject_GetBuffer(PySequence_GetItem(seq, i), (*buf)[i],
-type) == -1) {
+if (PyObject_GetBuffer(PySequence_GetItem(seq, i),
+   (*buf)[i], type) == -1) {
 PyMem_Del(*iov);
 for (j = 0; j  i; j++) {
 PyBuffer_Release((*buf)[j]);
-   }
+}
 PyMem_Del(*buf);
-return 0;
+total = 0;
+return total;
 }
 (*iov)[i].iov_base = (*buf)[i].buf;
-(*iov)[i].iov_len = (*buf)[i].len;
-}
-return 1;
+blen = (*buf)[i].len;
+(*iov)[i].iov_len = blen;
+total += blen;
+}
+return total;
 }
 
 static void
@@ -5939,14 +5945,17 @@
 offset, count,
 headers, trailers, flags, NULL};
 
+if (!PyArg_ParseTupleAndKeywords(args, kwdict,
 #ifdef __APPLE__
-if (!PyArg_ParseTupleAndKeywords(args, kwdict, iiOO|OOi:sendfile,
-keywords, out, in, _parse_off_t, offset, _parse_off_t, sbytes,
+ iiOO|OOi:sendfile,
+ keywords, out, in, _parse_off_t,
+ offset, _parse_off_t, sbytes,
 #else
-if (!PyArg_ParseTupleAndKeywords(args, kwdict, iiOn|OOi:sendfile,
-keywords, out, in, _parse_off_t, offset, len,
-#endif
-headers, trailers, flags))
+ iiOn|OOi:sendfile,
+ keywords, out, in,
+ _parse_off_t, offset, len,
+#endif
+ headers, trailers, flags))
 return NULL;
 if (headers != NULL) {
 if (!PySequence_Check(headers)) {
@@ -5954,10 +5963,15 @@
 sendfile() headers must be a sequence or None);
 return NULL;
 } else {
+Py_ssize_t i = 0; /* (Avoid uninitialized warning) */
 sf.hdr_cnt = PySequence_Size(headers);
-if (sf.hdr_cnt  0  !iov_setup((sf.headers), hbuf,
-headers, sf.hdr_cnt, PyBUF_SIMPLE))
+if (sf.hdr_cnt  0 
+!(i = iov_setup((sf.headers), hbuf,
+headers, sf.hdr_cnt, PyBUF_SIMPLE)))
 return NULL;
+#ifdef __APPLE__
+sbytes += i;
+#endif
 }
 }
 if (trailers != NULL) {
@@ -5966,10 +5980,15 @@
 sendfile() trailers must be a sequence or None);
 return NULL;
 } else {
+Py_ssize_t i = 0; /* (Avoid uninitialized warning) */
 sf.trl_cnt = PySequence_Size(trailers);
-if (sf.trl_cnt  0  !iov_setup((sf.trailers), tbuf,
-trailers, sf.trl_cnt, PyBUF_SIMPLE))
+if (sf.trl_cnt  0 
+!(i = iov_setup((sf.trailers), tbuf,
+trailers, sf.trl_cnt, PyBUF_SIMPLE)))
 return NULL;
+#ifdef __APPLE__
+sbytes += i;
+#endif
 }
 }
 
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11351] Mac OS X os.sendfile()

2011-03-01 Thread Steffen Daode Nurpmeso

Steffen Daode Nurpmeso sdao...@googlemail.com added the comment:

(GMail imposes a five minute or so delay when used over SMTP, so 
the timeline sometimes looks unfortunate.)
So, finally, -2.patch only fixed with 'blen' for 'len'.
Compiles and test ok.

 Giampaolo Rodola' g.rod...@gmail.com added the comment:
 
 Please try to provide a patch which fixes (as in makes the test pass) this 
 specific issue only. As for other changes such as the code restyling you can 
 open a separate ticket with another patch.

--
Added file: http://bugs.python.org/file20960/issue11351-5.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11351
___diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -5867,36 +5867,42 @@
 
 #ifdef HAVE_SENDFILE
 #if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__APPLE__)
-static int
+static Py_ssize_t
 iov_setup(struct iovec **iov, Py_buffer **buf, PyObject *seq, int cnt, int 
type)
 {
 int i, j;
+Py_ssize_t blen, total = 0;
+
 *iov = PyMem_New(struct iovec, cnt);
 if (*iov == NULL) {
 PyErr_NoMemory();
-return 0;
-}
+return total;
+}
+
 *buf = PyMem_New(Py_buffer, cnt);
 if (*buf == NULL) {
 PyMem_Del(*iov);
 PyErr_NoMemory();
-return 0;
+return total;
 }
 
 for (i = 0; i  cnt; i++) {
-if (PyObject_GetBuffer(PySequence_GetItem(seq, i), (*buf)[i],
-type) == -1) {
+if (PyObject_GetBuffer(PySequence_GetItem(seq, i),
+   (*buf)[i], type) == -1) {
 PyMem_Del(*iov);
 for (j = 0; j  i; j++) {
 PyBuffer_Release((*buf)[j]);
-   }
+}
 PyMem_Del(*buf);
-return 0;
+total = 0;
+return total;
 }
 (*iov)[i].iov_base = (*buf)[i].buf;
-(*iov)[i].iov_len = (*buf)[i].len;
-}
-return 1;
+blen = (*buf)[i].len;
+(*iov)[i].iov_len = blen;
+total += blen;
+}
+return total;
 }
 
 static void
@@ -5954,10 +5960,15 @@
 sendfile() headers must be a sequence or None);
 return NULL;
 } else {
+Py_ssize_t i = 0; /* Avoid uninitialized warning */
 sf.hdr_cnt = PySequence_Size(headers);
-if (sf.hdr_cnt  0  !iov_setup((sf.headers), hbuf,
-headers, sf.hdr_cnt, PyBUF_SIMPLE))
+if (sf.hdr_cnt  0 
+!(i = iov_setup((sf.headers), hbuf,
+headers, sf.hdr_cnt, PyBUF_SIMPLE)))
 return NULL;
+#ifdef __APPLE__
+sbytes += i;
+#endif
 }
 }
 if (trailers != NULL) {
@@ -5966,10 +5977,15 @@
 sendfile() trailers must be a sequence or None);
 return NULL;
 } else {
+Py_ssize_t i = 0; /* Avoid uninitialized warning */
 sf.trl_cnt = PySequence_Size(trailers);
-if (sf.trl_cnt  0  !iov_setup((sf.trailers), tbuf,
-trailers, sf.trl_cnt, PyBUF_SIMPLE))
+if (sf.trl_cnt  0 
+!(i = iov_setup((sf.trailers), tbuf,
+trailers, sf.trl_cnt, PyBUF_SIMPLE)))
 return NULL;
+#ifdef __APPLE__
+sbytes += i;
+#endif
 }
 }
 
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11351] Mac OS X os.sendfile()

2011-03-01 Thread Steffen Daode Nurpmeso

Steffen Daode Nurpmeso sdao...@googlemail.com added the comment:

But, dear Antoine, i don't know *any* editor that is capable to 
handle the following code correctly:

#ifdef __APPLE__
if (!PyArg_ParseTupleAndKeywords(args, kwdict, iiOO|OOi:sendfile,
keywords, out, in, _parse_off_t, offset, _parse_off_t, sbytes,
#else
if (!PyArg_ParseTupleAndKeywords(args, kwdict, iiOn|OOi:sendfile,
keywords, out, in, _parse_off_t, offset, len,
#endif
headers, trailers, flags))

 Antoine Pitrou pit...@free.fr added the comment:
 
 Problem is, each developer has his/her own preferences and editor
 settings, so if we start reformatting with each commit, the history of a
 piece of code becomes very difficult to read.
 
 I would simply suggest that you disable these vim settings, or at least
 tweak them so that they don't apply automatically when you edit existing
 code.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11351
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11359] Please replace the use of pickle in subprocess with json.

2011-03-01 Thread david

david db.pub.m...@gmail.com added the comment:

I don't have 3.3 installed so I cannot test it, but here is a patch for 2.6. I 
am sure it breaks stuff - are there tests for the subprocess module that would 
cover the cases that pickle was used for? 


--- subprocess.py.orig  2011-03-02 00:47:59.0 +1100
+++ subprocess.py   2011-03-02 00:51:27.0 +1100
@@ -414,7 +414,7 @@
 import select
 import errno
 import fcntl
-import pickle
+import json
 
 __all__ = [Popen, PIPE, STDOUT, call, check_call, 
CalledProcessError]
 
@@ -1105,7 +1105,7 @@
exc_value,
tb)
 exc_value.child_traceback = ''.join(exc_lines)
-os.write(errpipe_write, pickle.dumps(exc_value))
+os.write(errpipe_write, json.dumps(exc_value))
 
 # This exitcode won't be reported to applications, so 
it
 # really doesn't matter what we return.
@@ -1134,7 +1134,7 @@
 
 if data != :
 _eintr_retry_call(os.waitpid, self.pid, 0)
-child_exception = pickle.loads(data)
+child_exception = json.loads(data)
 for fd in (p2cwrite, c2pread, errread):
 if fd is not None:
 os.close(fd)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11359
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11351] Mac OS X os.sendfile()

2011-03-01 Thread Steffen Daode Nurpmeso

Changes by Steffen Daode Nurpmeso sdao...@googlemail.com:


Removed file: http://bugs.python.org/file20943/posixmodule.naive-apple-patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11351
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11351] Mac OS X os.sendfile()

2011-03-01 Thread Steffen Daode Nurpmeso

Changes by Steffen Daode Nurpmeso sdao...@googlemail.com:


Removed file: http://bugs.python.org/file20946/issue11351.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11351
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11351] Mac OS X os.sendfile()

2011-03-01 Thread Steffen Daode Nurpmeso

Changes by Steffen Daode Nurpmeso sdao...@googlemail.com:


Removed file: http://bugs.python.org/file20949/issue11351-2.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11351
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11358] Please replace the use of pickle in multiprocessing with json.

2011-03-01 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@haypocalc.com:


--
nosy: +haypo

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11358
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11359] Please replace the use of pickle in subprocess with json.

2011-03-01 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

Why do you want to replace pickle by json?

--
nosy: +haypo

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11359
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11351] Mac OS X os.sendfile()

2011-03-01 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

 But, dear Antoine, i don't know *any* editor that is capable to 
 handle the following code correctly:
 
 #ifdef __APPLE__
 if (!PyArg_ParseTupleAndKeywords(args, kwdict, iiOO|OOi:sendfile,
 keywords, out, in, _parse_off_t, offset, _parse_off_t, sbytes,
 #else
 if (!PyArg_ParseTupleAndKeywords(args, kwdict, iiOn|OOi:sendfile,
 keywords, out, in, _parse_off_t, offset, len,
 #endif
 headers, trailers, flags))

What do you mean with handling? If you are asking your editor to
understand the C language, then it might indeed have a problem.
If you are asking your editor to simply edit test, it should work fine.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11351
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11349] _pickle should implement the module finalisation protocol

2011-03-01 Thread Benjamin Peterson

Benjamin Peterson benja...@python.org added the comment:

http://mail.python.org/pipermail/python-dev/2009-October/093057.html

2011/3/1 Antoine Pitrou rep...@bugs.python.org:

 Antoine Pitrou pit...@free.fr added the comment:

 Not sure why #812369 is bogged down. The patch simply needs updating for 3.x.

 --
 nosy: +pitrou

 ___
 Python tracker rep...@bugs.python.org
 http://bugs.python.org/issue11349
 ___


--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11349
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11361] suggestion for os.kill(pid,CTRL_C_EVENT)

2011-03-01 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


--
nosy: +gregory.p.smith
versions: +Python 3.2, Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11361
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11351] Mac OS X os.sendfile()

2011-03-01 Thread Steffen Daode Nurpmeso

Steffen Daode Nurpmeso sdao...@googlemail.com added the comment:

I agree with that.

 Antoine Pitrou pit...@free.fr added the comment:
 If you are asking your editor to simply edit test, it should work fine.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11351
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11359] Please replace the use of pickle in subprocess with json.

2011-03-01 Thread david

david db.pub.m...@gmail.com added the comment:

From my reading of the code it may be possible if I execute a command via 
Popen that the child had output that went to stderror, because stderror is 
associated with the fd of errpipe_write, and it was not to be 'trusted' (lets 
say I ran it as another user) then it could be pickle.loaded in the parent - 
and this could potentially be bad.

I could be totally wrong about this tho. I haven't tested the above case yet. 

Regardless - the use of pickle here is not really required and json can do what 
pickle is doing (from my reading of the code thus far).

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11359
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11359] Please replace the use of pickle in subprocess with json.

2011-03-01 Thread david

david db.pub.m...@gmail.com added the comment:

Actually I don't think that is possible mmm.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11359
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11359] Please replace the use of pickle in subprocess with json.

2011-03-01 Thread david

david db.pub.m...@gmail.com added the comment:

As the child will have already have exec'ed there will be no exception raised 
-- so the parent shouldn't pickle.load from stderror... So unless there is a 
path where the parent will end up pickle.load ing the exception that case I put 
before is not possible.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11359
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11358] Please replace the use of pickle in multiprocessing with json.

2011-03-01 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

This would increase the overhead to no purpose, as far as I can see.

Ask or Jesse can reopen this if they think it is worth considering.

--
nosy: +asksol, jnoller, r.david.murray
resolution:  - rejected
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11358
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11358] Please replace the use of pickle in multiprocessing with json.

2011-03-01 Thread david

david db.pub.m...@gmail.com added the comment:

Um ok.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11358
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11358] Please replace the use of pickle in multiprocessing with json.

2011-03-01 Thread Jesse Noller

Jesse Noller jnol...@gmail.com added the comment:

I concur with RDM. We need complex data structures, and switching to JSON 
represents a non zero amount of work, isn't as fast and pickle works well. If 
you want to use JSON as a transport, I would do custom subclassing.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11358
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11358] Please replace the use of pickle in multiprocessing with json.

2011-03-01 Thread david

david db.pub.m...@gmail.com added the comment:

Fair enough.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11358
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11357] Add support for PEP 381 -- Mirror Authenticity

2011-03-01 Thread Alexis Metaireau

Alexis Metaireau ale...@notmyidea.org added the comment:

Some nitpicks:

In mirrors.get_server_key, the documentation is not up to date with your last 
changes (raises an error if there is a problem instead of returning None)

You do use the name 'package' while talking about distributions or projects. 
Please be sure to use the right one on the right place (in your case, that's a 
project). A project (Django) contains releases (Django 1.1, 1.2, 1.3?) which 
contains distributions (sdist, bdist).

The verify_package name could probably be changed in is_trustable or 
something like that, or raise an error (Otherwise, one can use verify_package 
thinking that it will actually check for something, without looking at the 
return value).

In the documentation, you've mainly copy/pasted the PEP and provided examples 
on how to do the authenticity check with distutils2. 

While the second part is fine, I think that duplicating the PEP content on the 
documentation is probably an error: If the PEP changes, then the distutils2 
documentation have to change as well. You probably can just refer on the PEP 
with a link.

Adding informations on where did you find the sources of verify.py could be 
nice as well.

Again, thanks for your work !

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11357
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11357] Add support for PEP 381 -- Mirror Authenticity

2011-03-01 Thread Alexis Metaireau

Alexis Metaireau ale...@notmyidea.org added the comment:

Antoine Pitrou on #python-dev made interesting remarks about the validation:

16:19  __ap__ hmm the way the patch does validation is bogus
16:22  __ap__ because it opens the URL a first time, validates it,
then opens it a second time with urlopen()
16:22  __ap__ without verifying the certificate on the second time
16:23  __ap__ it should do the validation directly with urlopen()
16:23  __ap__ (which probably requires defining a custom HTTPSHandler)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11357
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11357] Add support for PEP 381 -- Mirror Authenticity

2011-03-01 Thread Kelsey

Kelsey kelsey.highto...@gmail.com added the comment:

Thanks for the feedback! I agree with the issues raised and will rework the 
patch to address them.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11357
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11322] encoding package's normalize_encoding() function is too slow

2011-03-01 Thread Jesús Cea Avión

Changes by Jesús Cea Avión j...@jcea.es:


--
nosy: +jcea

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11322
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11362] image/webp missing from mimetypes.py

2011-03-01 Thread Richard Rabbat

New submission from Richard Rabbat rab...@google.com:

image/webp is missing from the mimetypes.py list of valid mimetypes. 
webp is an open-source image format and uses vp8 as a codec.

--
components: Library (Lib)
messages: 129786
nosy: Richard.Rabbat
priority: normal
severity: normal
status: open
title: image/webp missing from mimetypes.py
type: feature request
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11362
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10900] bz2 module fails to uncompress large files

2011-03-01 Thread Eric Wolf

Eric Wolf ebw...@gmail.com added the comment:

I tried the change you suggested. It still fails but now at 572,320 bytes 
instead of 900,000. I'm not sure why the difference in bytes read. I'll explore 
this more in a bit.

I also converted the BZ2 to GZ and used the gzip module. It's failing after 
reading 46628864 bytes. The GZ file is 33GB compared to the 22GB BZ2.

I've attached the strace output. I was getting an error with the sbrk 
parameter, so I left it out. Let me know if there's anything else I can provide.

--
versions: +Python 2.5
Added file: http://bugs.python.org/file20961/strace_bz2.txt

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10900
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11360] In documentation of getopt, advertise argparse instead of optparse

2011-03-01 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

This was overlooked in r81490, which added the note pointing to argparse. Fixed 
in r88696 for the py3k branch (I’ll backport later to 3.2 and 2.7), thanks.

--
nosy: +eric.araujo
resolution:  - fixed
stage:  - committed/rejected
status: open - closed
versions: +Python 2.7

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11360
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11362] image/webp missing from mimetypes.py

2011-03-01 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

Is there an IANA registration for this?  Any other standards references to it 
would be helpful, if it doesn't.  See issue 10730 for an example of the 
research that went in to the last mimetypes addition.

--
nosy: +r.david.murray
versions:  -Python 2.6, Python 2.7, Python 3.1, Python 3.2

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11362
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9276] pickle should support methods

2011-03-01 Thread Ram Rachum

Ram Rachum cool...@cool-rr.com added the comment:

Okay, as an initial suggestion, how about we give every function a 
`.__parent_class__` attribute saying which class it is a method of? I feel this 
is a bit of a duct tape solution, but I don't see any other alternative.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9276
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11363] Curses - add missing functions to doc

2011-03-01 Thread Sandro Tosi

New submission from Sandro Tosi sandro.t...@gmail.com:

Following up http://mail.python.org/pipermail/docs/2011-January/002922.html , I 
did a check on all the documented functions of curses and those available from 
the module, and wrote a patch to include in the doc the missing ones (text is 
mainly brought by manpages).

IMHO, it should be backported to the currently maintained versions (but I 
didn't check what's 2.7 status).

--
assignee: docs@python
components: Documentation
files: curses_missing_functs-py3k.patch
keywords: patch
messages: 129791
nosy: docs@python, sandro.tosi
priority: low
severity: normal
stage: patch review
status: open
title: Curses - add missing functions to doc
versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3
Added file: http://bugs.python.org/file20962/curses_missing_functs-py3k.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11363
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11326] connect_ex() implementation missing for SSL sockets

2011-03-01 Thread Florian Mayer

Florian Mayer florma...@aim.com added the comment:

Thanks for the fast response and for fixing this.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11326
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11363] Curses - add missing functions to doc

2011-03-01 Thread Sandro Tosi

Sandro Tosi sandro.t...@gmail.com added the comment:

On Tue, Mar 1, 2011 at 19:50, Sandro Tosi rep...@bugs.python.org wrote:

 New submission from Sandro Tosi sandro.t...@gmail.com:

 Following up http://mail.python.org/pipermail/docs/2011-January/002922.html , 
 I did a check on all the documented functions of curses and those available 
 from the module, and wrote a patch to include in the doc the missing ones 
 (text is mainly brought by manpages).

 IMHO, it should be backported to the currently maintained versions (but I 
 didn't check what's 2.7 status).

I did it now, it was quite easy: diff between 2.7 and py3k doc files
are just a bunch of line, and patch applies fine (with some hunk
offsets) on release2.7-maint too.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11363
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10900] bz2 module fails to uncompress large files

2011-03-01 Thread Charles-Francois Natali

Charles-Francois Natali neolo...@free.fr added the comment:

 I've attached the strace output. I was getting an error with the sbrk 
 parameter, so I left it out.

Yeah, sbrk is not a syscall ;-)

 Let me know if there's anything else I can provide.

Stupid questions:
- have you checked the file's md5sum ?
- what does bzip2 -cd file  /dev/null return ?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10900
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11364] Move from distutils.sysconfig to sysconfig in test_osx_env

2011-03-01 Thread Éric Araujo

New submission from Éric Araujo mer...@netwok.org:

I’m working on removing uses of distutils from the standard library.  I found 
only one remaining use of distutils.sysconfig; changing it to use sysconfig 
should not change the behavior of the test, but I can’t test, so please review 
attached patch.

--
assignee: eric.araujo
components: Macintosh, Tests
files: remove-distutils.sysconfig-traces.diff
keywords: patch
messages: 129795
nosy: eric.araujo, tarek
priority: normal
severity: normal
stage: commit review
status: open
title: Move from distutils.sysconfig to sysconfig in test_osx_env
versions: Python 3.3
Added file: 
http://bugs.python.org/file20963/remove-distutils.sysconfig-traces.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11364
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11364] Move from distutils.sysconfig to sysconfig in test_osx_env

2011-03-01 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

(I thought auto-nosy was set for Mac.)

--
nosy: +ned.deily, ronaldoussoren

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11364
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9276] pickle should support methods

2011-03-01 Thread Raymond Hettinger

Raymond Hettinger rhettin...@users.sourceforge.net added the comment:

 how about we give every function a `.__parent_class__` 
 attribute saying which class it is a method of? 

Won't work.  The same function can be used in multiple classes.

The function object is independent of the class.  This is conceptually no 
different that the unremarkable fact that any object can be stored in multiple 
dictionaries and the object is not responsible for knowing which dictionaries 
it is stored in.

def f(self): ...   # not even defined inside a class
A.f = f# stored in class A
B.f = f# also stored in class B
dir(f) # f doesn't know where it is stored

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9276
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9276] pickle should support methods

2011-03-01 Thread Ram Rachum

Ram Rachum cool...@cool-rr.com added the comment:

Raymond: I don't think this matters. We don't need a canonical 
`.__parent_class__`, we just need to know where that function is defined so we 
could find it when unpickling. In the example that you gave, `f` would have a 
`.__parent_class__` of `None`, and it would be pickleable because it would be 
found on the top-level of the module it's defined on.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9276
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11364] Move from distutils.sysconfig to sysconfig in test_osx_env

2011-03-01 Thread Ned Deily

Ned Deily n...@acm.org added the comment:

LGTM

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11364
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11364] Move from distutils.sysconfig to sysconfig in test_osx_env

2011-03-01 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

Thanks for reviewing.  Have you had time to test it or shall I just commit and 
wait for the buildbots master to come at me with a big knife if I break them?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11364
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9276] pickle should support methods

2011-03-01 Thread Raymond Hettinger

Raymond Hettinger rhettin...@users.sourceforge.net added the comment:

This isn't worth introducing poorly thought out hacks.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9276
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11364] Move from distutils.sysconfig to sysconfig in test_osx_env

2011-03-01 Thread Ned Deily

Ned Deily n...@acm.org added the comment:

Go for it. It's highly unlikely to break anything but, if so, redirect the 
knives my way. I verified that the results from the two sysconfigs are the 
same. I don't know that there are any buildbots that currently build a 
framework configuration anyway.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11364
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9276] pickle should support methods

2011-03-01 Thread Ram Rachum

Ram Rachum cool...@cool-rr.com added the comment:

 This isn't worth introducing poorly thought out hacks.

Being able to pickle unbound methods is important. In my project I have objects 
that refer to unbound methods. Now these objects are unpickleable. I can't save 
them to disk and I can't use the multiprocessing module on them. That's a big 
problem.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9276
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9276] pickle should support methods

2011-03-01 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

 Being able to pickle unbound methods is important. In my project I have 
 objects that refer to unbound methods. Now these objects are
 unpickleable. I can't save them to disk and I can't use the
 multiprocessing module on them. That's a big problem.

Judging from all that has been said on this issue, I think the best you can do 
now is try to whip up a patch and upload it if it ends up not too hackish.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9276
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9276] pickle should support methods

2011-03-01 Thread Ram Rachum

Ram Rachum cool...@cool-rr.com added the comment:

 [...]  try to whip up a patch and upload it if it ends up not too hackish.

To have a non-hackish patch we need a non-hackish idea. The `.__parent_class__` 
idea looks hackish to me, but now that I think about it, how is it more hackish 
than a function's `.__module__` attribute?

I mean, a function's `.__module__` attribute says on which module the function 
was originally defined, but the function could be accessible on any other 
module and any other namespace or class. Its `.__module__` would remain 
constant, because it's the one place where you are guaranteed to be able to 
find the function, assuming it's defined in the top-level. So the `.__module__` 
attribute is used in unpickling the function. How is the `.__parent_class__` 
suggestion more hackish than `.__module__`?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9276
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9276] pickle should support methods

2011-03-01 Thread Daniel Urban

Changes by Daniel Urban urban.dani...@gmail.com:


--
nosy: +durban

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9276
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9276] pickle should support methods

2011-03-01 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

 To have a non-hackish patch we need a non-hackish idea. The
 `.__parent_class__` idea looks hackish to me, but now that I think
 about it, how is it more hackish than a function's `.__module__`
 attribute?

Not much, agreed. You might want to call it `__namespace__` instead if
you want it to look cleaner :)
(and it could be useful for other purposes such as e.g. introspection)

But by hackish I meant the possible implementation of it, not the idea
itself. That's what a patch would help assess.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9276
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10900] bz2 module fails to uncompress large files

2011-03-01 Thread Charles-Francois Natali

Charles-Francois Natali neolo...@free.fr added the comment:

After running this under gdb, it turns out that it's actually bzlib's bzRead 
that's returning a BZ_STREAM_END after only 900k bytes.
So it confims what I've been suspecting, i.e. that the file is corrupt (I got 
the error at exactly the same offset as you - it could be a bug in bzlib, but 
it'd be quite surprising).
Note that google returns quite a few occurrences of corrupted OSM archives, 
e.g. http://www.mail-archive.com/newbies@openstreetmap.org/msg01854.html

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10900
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10900] bz2 module fails to uncompress large files

2011-03-01 Thread Eric Wolf

Eric Wolf ebw...@gmail.com added the comment:

Stupid questions are always worth asking. I did check the MD5 sum earlier and 
just checked it again (since I copied the file from one machine to another):

ebwolf@ubuntu:/opt$ md5sum /host/full-planet-110115-1800.osm.bz2 
0e3f81ef0dd415d8f90f1378666a400c  /host/full-planet-110115-1800.osm.bz2
ebwolf@ubuntu:/opt$ cat full-planet-110115-1800.osm.bz2.md5 
0e3f81ef0dd415d8f90f1378666a400c  full-planet-110115-1800.osm.bz2

There you have it. I was able to convert the bz2 to gzip with no errors:

bzcat full-planet-110115-1800.osm.bz2 | gzip  full-planet.osm.gz

FYI: This problem came up last year with no resolution:

http://mail.python.org/pipermail/tutor/2010-February/074610.html

Thanks for looking at this. Let me know if there's anything else you'd like me 
to try. In general, is it best to always read the same number of bytes? And 
what is the best value to pass for buffering in BZ2File? I just made up 
something hoping it would work.

I'm still waiting on the bzcat to /dev/null

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10900
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9276] pickle should support methods

2011-03-01 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc amaur...@gmail.com added the comment:

 Being able to pickle unbound methods is important. In my project I have 
 objects that refer to unbound methods. Now these objects are
 unpickleable. I can't save them to disk and I can't use the
 multiprocessing module on them. That's a big problem.

The multiprocessing module *can* pickle bound and unbound methods (see below), 
but only with the multiprocessing.Process class. It does not work with 
Pool.map(), for example.  The reason is that Process uses the special 
ForkingPickler that has special code to handle methods.  Pool.map could be 
fixed IMO.

Is ForkingPickler enough for your needs?



 mod.py 
class C:
def foo(self):
print(CALLED)
 main.py ===
from mod import C
if __name__ == '__main__':
from multiprocessing import Process
p = Process(target=C().foo)
p.start(); p.join()
p = Process(target=C.foo, args=(C(),))
p.start(); p.join()

--
nosy: +amaury.forgeotdarc

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9276
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11265] asyncore does not check for EAGAIN and EPIPE errno

2011-03-01 Thread Марк Коренберг

Марк Коренберг socketp...@gmail.com added the comment:

patch updated for handling EPIPE

--
title: asyncore does not check for EAGAIN errno - asyncore does not check for 
EAGAIN and EPIPE errno
Added file: http://bugs.python.org/file20964/z.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11265
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11265] asyncore does not check for EAGAIN and EPIPE errno

2011-03-01 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


--
assignee:  - giampaolo.rodola
nosy: +giampaolo.rodola

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11265
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11365] Integrate Buildroot patches (cross-compilation)

2011-03-01 Thread STINNER Victor

New submission from STINNER Victor victor.stin...@haypocalc.com:

Buildroot: Making Embedded Linux easy has patches for Python 2.7 to simplify 
the cross-compilation of Python:
http://git.buildroot.net/buildroot/tree/package/python

The maintainer, Thomas Petazzoni, told me that the 12 first patches are the 
most important. Other patches are to disable some features.

--
components: Build
messages: 129811
nosy: haypo
priority: normal
severity: normal
status: open
title: Integrate Buildroot patches (cross-compilation)
versions: Python 2.7, Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11365
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11365] Integrate Buildroot patches (cross-compilation)

2011-03-01 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


--
nosy: +eric.araujo, tarek
stage:  - needs patch
type:  - feature request
versions:  -Python 2.7

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11365
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9276] pickle should support methods

2011-03-01 Thread Ram Rachum

Ram Rachum cool...@cool-rr.com added the comment:

Amaury: I don't think ForkingPickler works for unbound methods defined in user 
code, which are implemented as functions. I think it only works for 
method-descriptors and wrapper-descriptors.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9276
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9276] pickle should support methods

2011-03-01 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc amaur...@gmail.com added the comment:

did you see my example above? it passes methods defined in user code.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9276
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10900] bz2 module fails to uncompress large files

2011-03-01 Thread Eric Wolf

Eric Wolf ebw...@gmail.com added the comment:

The only problem with the theory that the file is corrupt is that at least 
three people have encountered exactly the same problem with three files:

http://mail.python.org/pipermail/tutor/2010-June/076343.html

Colin was using an OSM planet file from some time last year and it quit at 
exactly 90 bytes.

I'm trying bzip2 -t on the file to see if it reports any problems. These things 
take time... the bzcat to /dev/null still hasn't completed.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10900
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11365] Integrate Buildroot patches (cross-compilation)

2011-03-01 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

buildroot-python-patches.tar.gz: today checkout of the git repository 
(package/python).

--
Added file: http://bugs.python.org/file20965/buildroot-python-patches.tar.gz

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11365
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11365] Integrate Buildroot patches (cross-compilation)

2011-03-01 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

buildboot.patch: the 12 patches combined into a single patch for Python 2.7.

Note: python-2.7-001-support-for-build.patch doesn't apply cleanly on 
release27-maint.

--
keywords: +patch
Added file: http://bugs.python.org/file20966/buildroot.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11365
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11365] Integrate Buildroot patches (cross-compilation)

2011-03-01 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

Well, the patches should be first ported to 3.3 (and need checking that they 
don't break anything: test suite, etc.). Then, if you want them to be examined 
separately, it might be better to create a separate issue for each.

--
nosy: +pitrou

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11365
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8841] GetoptError strings should be localized

2011-03-01 Thread Filip Gruszczyński

Filip Gruszczyński grusz...@gmail.com added the comment:

I'd be happy to provide a patch.

How about extending getopt api to something like this:

 optlist, args = getopt.getopt(['-b'], 'e', not_recognized=no %s option, 
 mate!)
GetoptError: no -b option, mate!

Or maybe you should provide a dictionary?

 optlist, args = getopt.getopt(['-b'], 'e', errors={'not_recognized': no %s 
 option, mate!)
GetoptError: no -b option, mate!

I have little experience with making design decisions, so if someone could 
guide me here, I will get down and provide a patch with proposed solution.

--
nosy: +gruszczy

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8841
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11342] ResourceWarning: unclosed file _io.TextIOWrapper

2011-03-01 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

Can you try updating your py3k checkout and applying with “patch -p1”?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11342
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8841] GetoptError strings should be localized

2011-03-01 Thread Filip Gruszczyński

Filip Gruszczyński grusz...@gmail.com added the comment:

One more solution. Maybe getopt should expose variables that hold error 
messages (rather than have them hardcoded in the code), that can be simply 
substituted by the user before he runs getopt? But I don't really like this one.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8841
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10900] bz2 module fails to uncompress large files

2011-03-01 Thread Charles-Francois Natali

Charles-Francois Natali neolo...@free.fr added the comment:

 Stupid questions are always worth asking. I did check the MD5 sum earlier
 and just checked it again (since I copied the file from one machine to
 another):

 ebwolf@ubuntu:/opt$ md5sum /host/full-planet-110115-1800.osm.bz2
 0e3f81ef0dd415d8f90f1378666a400c  /host/full-planet-110115-1800.osm.bz2
 ebwolf@ubuntu:/opt$ cat full-planet-110115-1800.osm.bz2.md5
 0e3f81ef0dd415d8f90f1378666a400c  full-planet-110115-1800.osm.bz2


Well, that only proves that the file wasn't corrupted during the download.
But this doesn't prove that the file on the remote server isn't
corrupt (see for example the link I gave you, the guy used rsync and
had a correct checksum but was still unable to extract the file).

 There you have it. I was able to convert the bz2 to gzip with no errors:

 bzcat full-planet-110115-1800.osm.bz2 | gzip  full-planet.osm.gz


How big is full-planet.osm.gz ?
Since bzip2 uses bzlib, and can very well return after having
uncompressed only half the file.
A more interesting test would be
$ bzip2 -cd full-planet-110115-1800.osm.bz2 | bzip2 -c  full-planet.new.osm.bz2
$ md5sum full-planet.*.bz2

 FYI: This problem came up last year with no resolution:

 http://mail.python.org/pipermail/tutor/2010-February/074610.html


Yeah, and it was also on an OSM file.
Now, I know that OSM are probably one of the biggest providers of huge
archives, but it's surprising that everytime there's a problem with
bz2, it's with an OSM file, no ?

Look at what I just found, a message from an OSM admin dating from later 2010:


On 26 October 2010 13:47, Anthony osm at inbox.org wrote:
 a at A-PC:/media/usbdrive$ cat full-planet-101022.osm.bz2.md5
 0a90fec8ce66bdd82984c2ee8c6bb6ac  full-planet-101022.osm.bz2
 a at A-PC:/media/usbdrive$ md5sum full-planet-101022.osm.bz2
 c652430b00668c30bb04816ff16cbfbe  full-planet-101022.osm.bz2

 Just me?


We had problems with the network card in that machine last night
causing some corruption, try
rsync://planet.openstreetmap.org/planet/full-experimental/ the file
into a good state.

Although best to wait a few hours, currently packet loss issues on
server's upstream network.

Regards
 Grant


 In general, is it best to always read the same number of bytes?

In that case, it doesn't matter.

 And what is the best value to pass for buffering in BZ2File? I just made up
 something hoping it would work.

The default one ;-) (don't provide any)

 Colin was using an OSM planet file from some time last year and it quit at 
 exactly 90 bytes.

OSM again :-)
900.000 is exacty the default bz2 block size...

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10900
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11265] asyncore does not check for EAGAIN and EPIPE errno

2011-03-01 Thread Giampaolo Rodola'

Giampaolo Rodola' g.rod...@gmail.com added the comment:

Ok for EAGAIN.

I'm not completely sure about EPIPE on recv() as it is not listed here:
http://www.kernel.org/doc/man-pages/online/pages/man2/recv.2.html
...although I think it's ok to treat it as an alias for connection lost anyway.

In pyftpdlib I treat both EPIPE and EBADF as disconnect events, and this works 
with both select() and poll().

Your patches should be targeted for python 3.3 (and not 2.x).

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11265
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11365] Integrate Buildroot patches (cross-compilation)

2011-03-01 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

I uploaded the patch to Rietveld for a review:
http://codereview.appspot.com/4253047

 Well, the patches should be first ported to 3.3

Ok, I will ask the author if he can do this job. I uploaded the patches for 
Python 2.7 for a review and to open the discussion.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11365
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8841] GetoptError strings should be localized

2011-03-01 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

Filip: The standard way of doing localization is thanks to the gettext module.

Richard: Regarding the contents of the error messages, please make specific 
remarks on what is lacking.

--
stage:  - needs patch
versions: +Python 3.3 -Python 3.2

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8841
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8841] GetoptError strings should be localized

2011-03-01 Thread Filip Gruszczyński

Filip Gruszczyński grusz...@gmail.com added the comment:

I understand I should do something similar to what is done in argparse:

from gettext import gettext as _, ngettext

...

message = ngettext('conflicting option string: %s',
   'conflicting option strings: %s',
   len(conflicting_actions))

and then let user define those messages somewhere in his own po files?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8841
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10900] bz2 module fails to uncompress large files

2011-03-01 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

Perhaps your bz2 files are simply multi-stream files? The bz2 module currently 
doesn't support them (it only decompresses the first stream); see issue1625 for 
a patch.

I'm not an expert on this, but it seems you can do:

$ bzip2 -tvvv foo.bz2 
  foo.bz2: 
[1: huff+mtf rt+rld {0x135c15ac, 0x135c15ac}]
combined CRCs: stored = 0x135c15ac, computed = 0x135c15ac
[1: huff+mtf rt+rld {0x6ff631c1, 0x6ff631c1}]
combined CRCs: stored = 0x6ff631c1, computed = 0x6ff631c1
ok

My intuition is that if you get several lines about CRCs, it means there are 
several streams in the bz2 file.

--
nosy: +pitrou

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10900
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8841] GetoptError strings should be localized

2011-03-01 Thread Richard Lowe

Richard Lowe richl...@richlowe.net added the comment:

I don't find anything lacking about the error messages, I meant that there were 
no more specific exceptions, or fields in GetoptError to allow the caller to 
tell what was specifically wrong and provide its own localized messages.  So 
while the defaults are unlocalized, all an application can do is interpret the 
error string to provide a localized message.

The solution I was thinking of is getopt raising sub-types of GetoptError for 
each specific error case (unknown option, option requires argument, etc), and 
the message text of each of those being localized through gettext().  I'm not 
sure what problems that could cause with compatibility however, beyond 
obviously anyone who's already resorted to interpreting the string would have 
problems.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8841
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8841] GetoptError strings should be localized

2011-03-01 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

Richard: It’s not common to use subclasses to allow message customization.  
Would gettext cover your need?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8841
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11246] PyUnicode_FromFormat(%V) decodes the byte string from ISO-8859-1

2011-03-01 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

Fixed in Python 3.3 (r88697) and 3.2 (r88698). Thank you Ray.

--
resolution:  - fixed
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11246
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8841] GetoptError strings should be localized

2011-03-01 Thread Richard Lowe

Richard Lowe richl...@richlowe.net added the comment:

Sure, just localizing them in the getopt implementation would be fine.

I suggested subclassing to solve the more general problem of the caller being 
able to tell one getopt error from another, for which it is a pretty common 
solution.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8841
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11140] threading.Lock().release() raises _thread.error, not RuntimeError

2011-03-01 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

_dummy_thread patch committed in r88699, thank you!

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11140
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



  1   2   >