[Python-Dev] Add calloc-like memory allocators to Python

2014-04-28 Thread Victor Stinner
Hi, We made progress on the following issue and the latest patch (calloc-5.patch) is ready for a review: http://bugs.python.org/issue21233 This issue should help numpy to reuse Python memory allocators to use the new tracemalloc module of Python 3.4. The issue is only for Python 3.5. It was

[Python-Dev] Python 2.7.7. on Windows

2014-04-28 Thread Mike Miller
Greetings, I've just woken up and noticed Python 2.7.7 is on track to be released, and in a rather unique event contains a few security enhancements in addition to the usual fixes: http://legacy.python.org/dev/peps/pep-0466/ I thought this might be a good time to make a final plea to fix a

[Python-Dev] API and process questions (sparked by Claudiu Popa on 16104

2014-04-28 Thread Jim J. Jewett
(1) Should fixes to a docstring go in with a patch, even if they aren't related to the changing functionality? Bytestring compilation has several orthogonal parameters. Most -- but not all -- are documented in the docstring. (Specifically, there is no explanation of the rx parameter which acts

[Python-Dev] API and process questions (sparked by Claudiu Popa on 16104

2014-04-28 Thread Brett Cannon
On Mon Apr 28 2014 at 11:32:58 AM, Jim J. Jewett jimjjew...@gmail.com wrote: (1) Should fixes to a docstring go in with a patch, even if they aren't related to the changing functionality? It should probably be its own commit. Bytestring compilation has several orthogonal parameters.

Re: [Python-Dev] API and process questions (sparked by Claudiu Popa on 16104

2014-04-28 Thread Claudiu Popa
On Mon, Apr 28, 2014 at 6:32 PM, Jim J. Jewett jimjjew...@gmail.com wrote: (1) Should fixes to a docstring go in with a patch, even if they aren't related to the changing functionality? Bytestring compilation has several orthogonal parameters. Most -- but not all -- are documented in the

Re: [Python-Dev] Python 2.7.7. on Windows

2014-04-28 Thread Sturla Molden
Mike Miller python-...@mgmiller.net wrote: The main rationale given (for not using the standard %ProgramFiles%) has been that the full path to python is too long to type, and ease of use is more important than the security benefits given by following Windows conventions. C:\Program

Re: [Python-Dev] API and process questions (sparked by Claudiu Popa on 16104

2014-04-28 Thread Charles-François Natali
(2) The patch adds new functionality to use multiple processes in parallel. The normal parameter values are integers indicating how many processes to use. The parameter also needs two special values -- one to indicate use os.cpu_count, and the other to indicate don't use multiprocessing at

Re: [Python-Dev] Python 2.7.7. on Windows

2014-04-28 Thread Steve Dower
Mike Miller wrote: I thought this might be a good time to make a final plea to fix a long-standing security issue in the installer on Windows. By default it installs Python to the root folder, thereby bypassing filesystem permissions: http://bugs.python.org/issue1284316 This would be an

Re: [Python-Dev] API and process questions (sparked by Claudiu Popa on 16104

2014-04-28 Thread Charles-François Natali
And incidentally, I think that the argument *processes* should be renamed to *workers*, or *jobs* (like in make), and any mention of multiprocessing in the documentation should be removed (if any): multiprocessing is an implementation detail. When I type: make -jN I don't really care that make is

Re: [Python-Dev] API and process questions (sparked by Claudiu Popa on 16104

2014-04-28 Thread Jim J. Jewett
On Mon, Apr 28, 2014 at 12:56 PM, Charles-François Natali cf.nat...@gmail.com wrote: Why would the user care if multiprocessing is used behind the scene? Err ... that was another set of questions that I forgot to ask. (A) Why bother raising an error if multiprocessing is unavailable? After

[Python-Dev] file objects guarantees

2014-04-28 Thread Charles-François Natali
Hi, What's meant exactly by a file object? Let me be more specific: for example, pickle.dump() accepts a file object. Looking at the code, it doesn't check the return value of its write() method. So it assumes that write() should always write the whole data (not partial write). Same thing for

[Python-Dev] Multiple inheritance from builtin (C) types [still] supported in Python3?

2014-04-28 Thread Paul Sokolovsky
Hello, It's more or less known fact (ref: google) that you can't inherit from multiple generic builtin (as in coded in C) types: class C(dict, list): pass TypeError: multiple bases have instance lay-out conflict However, more detailed googling led me to this page of a book:

Re: [Python-Dev] API and process questions (sparked by Claudiu Popa on 16104

2014-04-28 Thread Charles-François Natali
2014-04-28 18:29 GMT+01:00 Jim J. Jewett jimjjew...@gmail.com: On Mon, Apr 28, 2014 at 12:56 PM, Charles-François Natali cf.nat...@gmail.com wrote: Why would the user care if multiprocessing is used behind the scene? Err ... that was another set of questions that I forgot to ask. (A) Why

Re: [Python-Dev] pep8 reasoning

2014-04-28 Thread Chris Barker
On Sun, Apr 27, 2014 at 1:40 PM, Barry Warsaw ba...@python.org wrote: On Apr 27, 2014, at 12:34 PM, Chris Barker wrote: foo = long_function_name(var_one, var_two, var_three,

Re: [Python-Dev] pep8 reasoning

2014-04-28 Thread Chris Barker
On Sun, Apr 27, 2014 at 6:34 PM, Steven D'Aprano st...@pearwood.infowrote: I would agree with having at least one example done with one arg per line. Is it really necessary? I think that one-arg-per-line is an obvious variation of the existing example. not really -- a lot of folks learn

Re: [Python-Dev] Python 2.7.7. on Windows

2014-04-28 Thread Antoine Pitrou
On Mon, 28 Apr 2014 19:52:48 +1200 Mike Miller python-...@mgmiller.net wrote: I thought this might be a good time to make a final plea to fix a long-standing security issue in the installer on Windows. By default it installs Python to the root folder, thereby bypassing filesystem

Re: [Python-Dev] file objects guarantees

2014-04-28 Thread Guido van Rossum
File objects historically have a pretty vague spec. E.g. it's not defined which methods are supported beyond read() and readline() (for readers) or write() (for writers). Short writes shouldn't be allowed (a regular file object's write() doesn't even return a value for this reason). This means

Re: [Python-Dev] Multiple inheritance from builtin (C) types [still] supported in Python3?

2014-04-28 Thread Antoine Pitrou
On Mon, 28 Apr 2014 20:45:48 +0300 Paul Sokolovsky pmis...@gmail.com wrote: So, is that it, or disjoint native types are supported as bases somehow? Also, would someone know if a class-subclass case happens for example in stdlib? Well, for instance this trivial example works: class C(list,

Re: [Python-Dev] Multiple inheritance from builtin (C) types [still] supported in Python3?

2014-04-28 Thread Guido van Rossum
Antoine's example works because list inherits from object. The more general rule compatible layout only allows the rarest of cases to work -- basically the two classes involved must have a common base class and one of the classes must not add any C-level fields to that base class's layout. I would

Re: [Python-Dev] API and process questions (sparked by Claudiu Popa on 16104

2014-04-28 Thread Ned Deily
In article CA+OGgf4weBk1NsXBSqi1g7tDE-=7rfkzd5bzn1mxihwsgge...@mail.gmail.com, Jim J. Jewett jimjjew...@gmail.com wrote: As Claudiu pointed out, processes=1 should really mean 1 worker process, which is still different from do everything in the main process. I'm not sure that level of

Re: [Python-Dev] Multiple inheritance from builtin (C) types [still] supported in Python3?

2014-04-28 Thread Paul Sokolovsky
Hello, On Mon, 28 Apr 2014 20:24:58 +0200 Antoine Pitrou solip...@pitrou.net wrote: On Mon, 28 Apr 2014 20:45:48 +0300 Paul Sokolovsky pmis...@gmail.com wrote: So, is that it, or disjoint native types are supported as bases somehow? Also, would someone know if a class-subclass case

Re: [Python-Dev] Multiple inheritance from builtin (C) types [still] supported in Python3?

2014-04-28 Thread Antoine Pitrou
Hi Paul, On Mon, 28 Apr 2014 21:42:02 +0300 Paul Sokolovsky pmis...@gmail.com wrote: Basically, if two classes have compatible layouts, you can inherit from both at once. How is compatible layout defined? Or layout for that matter at all? See Guido's answer. I don't think it's

Re: [Python-Dev] pep8 reasoning

2014-04-28 Thread Barry Warsaw
On Apr 28, 2014, at 11:12 AM, Chris Barker wrote: No -- stupid variable-width font! I don't think anyone should write code with variable width fonts, and I'd rather not do email that way either, but gmail is making it tough these days.. Ouch. I'm sure it's gmail being helpful the way

Re: [Python-Dev] Multiple inheritance from builtin (C) types [still] supported in Python3?

2014-04-28 Thread Guido van Rossum
On Mon, Apr 28, 2014 at 11:42 AM, Paul Sokolovsky pmis...@gmail.com wrote: Well, it's easy to treat object class as a special-case, null class. But the implementation doesn't, at least not for the question you're asking. So, let's re-formulate questions above with where such native base

Re: [Python-Dev] Multiple inheritance from builtin (C) types [still] supported in Python3?

2014-04-28 Thread Guido van Rossum
On Mon, Apr 28, 2014 at 12:02 PM, Antoine Pitrou solip...@pitrou.netwrote: On Mon, 28 Apr 2014 21:42:02 +0300 Paul Sokolovsky pmis...@gmail.com wrote: Basically, if two classes have compatible layouts, you can inherit from both at once. How is compatible layout defined? Or layout

Re: [Python-Dev] Commit-ready patches needing review

2014-04-28 Thread Antoine Pitrou
On Sun, 27 Apr 2014 12:10:46 -0700 Nikolaus Rath nikol...@rath.org wrote: * http://bugs.python.org/issue21057 (TextIOWrapper does not support reading bytearrays or memoryviews) I've reviewed this one. Regards Antoine. ___ Python-Dev mailing

Re: [Python-Dev] Python 2.7.7. on Windows

2014-04-28 Thread Mike Miller
On 04/29/2014 05:12 AM, Steve Dower wrote: This would be an incredibly painful change that would surprise and hurt a lot of people. Hi, I think incredibly painful is overstating the case a bit. ;) We're talking about an installer default, a setting that would still be changeable as it

Re: [Python-Dev] API and process questions (sparked by Claudiu Popa on 16104

2014-04-28 Thread Ezio Melotti
On Mon, Apr 28, 2014 at 6:32 PM, Jim J. Jewett jimjjew...@gmail.com wrote: (1) Should fixes to a docstring go in with a patch, even if they aren't related to the changing functionality? [...] It is best if a commit changes one small thing at a time. On the other hand, Nick recently posted

Re: [Python-Dev] API and process questions (sparked by Claudiu Popa on 16104

2014-04-28 Thread Claudiu Popa
This issue raised too much bikeshedding. To wrap it up, I'll modify the patch with the following: - processes renamed to workers - `workers` defaults to 1 - When `workers` is equal to 0, then `os.cpu_count` will be used - When `workers` 1, multiple processes will be used - When `workers` == 1,

Re: [Python-Dev] Python 2.7.7. on Windows

2014-04-28 Thread Brian Curtin
On Mon, Apr 28, 2014 at 3:07 PM, Mike Miller python-...@mgmiller.net wrote: On 04/29/2014 05:12 AM, Steve Dower wrote: This would be an incredibly painful change that would surprise and hurt a lot of people. Hi, I think incredibly painful is overstating the case a bit. ;) We're talking

Re: [Python-Dev] Python 2.7.7. on Windows

2014-04-28 Thread Mike Miller
Hi, Those bugs were fixed 9 years ago or so around 2005. I use python in ProgramFiles every day without issue. If another bug has crept in somewhere, it can be fixed. -Mike -- From: Sturla Molden sturla.mol...@gmail.com To: python-dev@python.org Subject: Re:

Re: [Python-Dev] Python-Dev Digest, Vol 129, Issue 81

2014-04-28 Thread Mike Miller
Hi, note the pep, it makes allowances for security enhancements. -Mike Message: 5 Date: Mon, 28 Apr 2014 20:23:12 +0200 From: Antoine Pitrou solip...@pitrou.net To: python-dev@python.org Subject: Re: [Python-Dev] Python 2.7.7. on Windows Message-ID: 20140428202312.6903d62a@fsol

Re: [Python-Dev] Python 2.7.7. on Windows

2014-04-28 Thread Mike Miller
On 04/29/2014 08:38 AM, Brian Curtin wrote: The option to add the current install to your path was added 3.3. Ok, thanks. So there is some precedent it would be useful. Remember, python-dev's are not the target users of this package, and are a rather minuscule fraction of the user base.

Re: [Python-Dev] Python-Dev Digest, Vol 129, Issue 81

2014-04-28 Thread Brett Cannon
On Mon Apr 28 2014 at 4:58:35 PM, Mike Miller python-...@mgmiller.net wrote: Hi, note the pep, it makes allowances for security enhancements. The PEP in question is about fixing fundamentally broken security issues in Python 2.7 (e.g. updating OpenSSL). Tweaking where Python is installed by

Re: [Python-Dev] API and process questions (sparked by Claudiu Popa on 16104

2014-04-28 Thread Terry Reedy
On 4/28/2014 4:24 PM, Claudiu Popa wrote: This issue raised too much bikeshedding. To wrap it up, I'll modify the patch with the following: - processes renamed to workers - `workers` defaults to 1 - When `workers` is equal to 0, then `os.cpu_count` will be used - When `workers` 1, multiple

Re: [Python-Dev] pep8 reasoning

2014-04-28 Thread Terry Reedy
On 4/28/2014 2:12 PM, Chris Barker wrote: I don't think anyone should write code with variable width fonts, The problem is that fixed pitch does not work well for even a half-way complete unicode font and I don't know that there are any available. As far as I know, my Windows 7 only came

Re: [Python-Dev] Python-Dev Digest, Vol 129, Issue 81

2014-04-28 Thread Terry Reedy
On 4/28/2014 5:01 PM, Brett Cannon wrote: On Mon Apr 28 2014 at 4:58:35 PM, Mike Miller python-...@mgmiller.net mailto:python-...@mgmiller.net wrote: Hi, note the pep, it makes allowances for security enhancements. The PEP in question is about fixing fundamentally broken security issues

Re: [Python-Dev] API and process questions (sparked by Claudiu Popa on 16104

2014-04-28 Thread R. David Murray
On Mon, 28 Apr 2014 23:24:16 +0300, Claudiu Popa pcmantic...@gmail.com wrote: - Will raise NotImplementedError if multiprocessing can't be used (when `workers` equals to 0 or 1) I think the most common use case for this ability will be run with the appropriate number of processes for the

Re: [Python-Dev] pep8 reasoning

2014-04-28 Thread R. David Murray
On Mon, 28 Apr 2014 18:01:32 -0400, Terry Reedy tjre...@udel.edu wrote: On 4/28/2014 2:12 PM, Chris Barker wrote: I don't think anyone should write code with variable width fonts, The problem is that fixed pitch does not work well for even a half-way complete unicode font and I don't

Re: [Python-Dev] pep8 reasoning

2014-04-28 Thread Chris Barker
On Mon, Apr 28, 2014 at 3:01 PM, Terry Reedy tjre...@udel.edu wrote: I don't think anyone should write code with variable width fonts, The problem is that fixed pitch does not work well for even a half-way complete unicode font and I don't know that there are any available. ... Given that

Re: [Python-Dev] pep8 reasoning

2014-04-28 Thread Terry Reedy
On 4/28/2014 7:13 PM, Chris Barker wrote: On Mon, Apr 28, 2014 at 3:01 PM, Terry Reedy tjre...@udel.edu mailto:tjre...@udel.edu wrote: I don't think anyone should write code with variable width fonts, The problem is that fixed pitch does not work well for even a half-way

Re: [Python-Dev] Python 2.7.7. on Windows

2014-04-28 Thread Chris Barker
On Mon, Apr 28, 2014 at 1:56 PM, Mike Miller python-...@mgmiller.netwrote: * watch Dave Beazley's PyCon 2014 talk for a good story involving one of those manufacturer installed Pythons: https://www.youtube.com/watch?v=RZ4Sn-Y7AP8 Thanks, I'm trying to get thru all the talk will watch that

Re: [Python-Dev] Multiple inheritance from builtin (C) types [still] supported in Python3?

2014-04-28 Thread Paul Sokolovsky
Hello, On Mon, 28 Apr 2014 12:08:40 -0700 Guido van Rossum gu...@python.org wrote: [] How is compatible layout defined? Or layout for that matter at all? The layout is what the C struct defining the object looks like. These are typically defined in headers in the Include directory

Re: [Python-Dev] Python 2.7.7. on Windows

2014-04-28 Thread Steve Dower
Mike Miller wrote: On 04/29/2014 05:12 AM, Steve Dower wrote: This would be an incredibly painful change that would surprise and hurt a lot of people. Hi, I think incredibly painful is overstating the case a bit. ;) We're talking about an installer default, a setting that would still be

Re: [Python-Dev] Python 2.7.7. on Windows

2014-04-28 Thread Brian Curtin
On Mon, Apr 28, 2014 at 7:04 PM, Steve Dower steve.do...@microsoft.com wrote: Mike Miller wrote: On 04/29/2014 05:12 AM, Steve Dower wrote: This would be an incredibly painful change that would surprise and hurt a lot of people. Hi, I think incredibly painful is overstating the case a bit.

Re: [Python-Dev] Python 2.7.7. on Windows

2014-04-28 Thread Benjamin Peterson
On Mon, Apr 28, 2014, at 17:14, Brian Curtin wrote: If it's an acceptable change to the release manager (Benjamin?), and if there's actually time before the RC (I don't know when it is planned), I am willing to backport my 3.3 change to get this in the 2.7 installer. That's fine. However,

Re: [Python-Dev] pep8 reasoning

2014-04-28 Thread Stephen J. Turnbull
R. David Murray writes: My unix fix-width terminal font handles most unicode (even a lot of non-bmp stuff...though I have no idea if it is readable :). Oh, I bet you do. With a true fixed-width Unicode font, it's the *Latin-character* text that's painful, if not unreadable, because the

Re: [Python-Dev] pep8 reasoning

2014-04-28 Thread Stephen J. Turnbull
On Mon, Apr 28, 2014 at 11:12 AM, Chris Barker wrote: not really -- it allows it: # Aligned with opening delimiter. foo = long_function_name(var_one, var_two, var_three, var_four) but all the examples have more than one variable per line...my point is

Re: [Python-Dev] Python 2.7.7. on Windows

2014-04-28 Thread Stephen J. Turnbull
Mike Miller writes: Microsoft's guidelines on where to install software are clear, and don't make exceptions that tools should be installed to the root of the drive to bypass file system permissions, for convenience. But there's the rub. In this case, Microsoft doesn't have *security*, it

[Python-Dev] bytes with trailing \0?

2014-04-28 Thread Nikolaus Rath
Hello, I was surprised to find the following in bytesobject.c: , | [...] |As always, an extra byte is allocated for a trailing \0 byte (newsize |does *not* include that), and a trailing \0 byte is stored. | */ | | int | _PyBytes_Resize(PyObject **pv, Py_ssize_t newsize) | { | [...]

Re: [Python-Dev] Python 2.7.7. on Windows

2014-04-28 Thread Steven D'Aprano
On Tue, Apr 29, 2014 at 12:07:00PM +0900, Stephen J. Turnbull wrote: Mike Miller writes: Microsoft's guidelines on where to install software are clear, and don't make exceptions that tools should be installed to the root of the drive to bypass file system permissions, for convenience.

Re: [Python-Dev] Python 2.7.7. on Windows

2014-04-28 Thread Glenn Linderman
On 4/28/2014 8:52 PM, Steven D'Aprano wrote: I think that's unfair. I'm not a MS fan, not even close. I think their business practices in the past have been reprehensible. But if there is anyone who takes backwards-compatibility even more seriously than Python-Dev, it is them. I guess there is

Re: [Python-Dev] bytes with trailing \0?

2014-04-28 Thread Guido van Rossum
It is to improve the experience of passing bytes to a C function that expects a trailing \0. For example syscalls taking filenames. The wrapper must still check for embedded \0 but the bytes don't need to be copied. On Monday, April 28, 2014, Nikolaus Rath nikol...@rath.org wrote: Hello, I