Re: Unicode in Python

2014-05-03 Thread wxjmfauth
Le vendredi 2 mai 2014 05:50:40 UTC+2, Michael Torrie a écrit : Can't help but feed the troll... forgive me. On 04/28/2014 02:57 AM, wxjmfa...@gmail.com wrote: Python 2.7 + cp1252: - Solid and coherent system (nothing to do with the Euro). Except that cp1252 is not unicode.

Why has __new__ been implemented as a static method?

2014-05-03 Thread Jurko Gospodnetić
Hi all. I was wandering why Python implements its __new__ method as a static and not a class method? __new__ always accepts a cls parameter, which lead me to believe it was a class method. Also, implementing __new__ as a class method seems natural when thinking about __new__ as 'a

Number of objects grows unbouned...Memory leak

2014-05-03 Thread ptb
Hello all, I'm using Python 3.4 and am seeing the memory usage of my program grow unbounded. Here's a snippet of the loop driving the main computation opt_dict = {'interior':cons_dict['int_eq'],'lboundary':cons_dict['lboundary'], 'rboundary':cons_dict['rboundary'],

[Call for Paper - SCOPUS/ISI THOMSON] ICESTI 2014, September 10-13, 2014, Kuta Bali - Indonesia

2014-05-03 Thread icesti2014editor
International Conference on Engineering, Science and Technology Innovation (ICESTI 2014) 10-13 September 2014, Bali, Indonesia http://www.icesti.org/ Contact Email: icesti2...@icesti.org Online Submission: http://www.icesti.org/online-submission ICESTI 2014 will provide a forum for accessing

Re: Number of objects grows unbouned...Memory leak

2014-05-03 Thread ptb
Turns out one of the libraries I am using has a cache system. If I shut if off then my problem goes away... On Saturday, May 3, 2014 7:15:59 AM UTC-6, ptb wrote: Hello all, I'm using Python 3.4 and am seeing the memory usage of my program grow unbounded. Here's a snippet of the loop

Re: Why has __new__ been implemented as a static method?

2014-05-03 Thread Steven D'Aprano
On Sat, 03 May 2014 12:37:24 +0200, Jurko Gospodnetić wrote: Hi all. I was wandering why Python implements its __new__ method as a static and not a class method? Have you read Guido's tutorial on it? https://www.python.org/download/releases/2.2.3/descrintro [quote] Factoid: __new__ is

Re: [Call for Paper - SCOPUS/ISI THOMSON] ICESTI 2014, September 10-13, 2014, Kuta Bali - Indonesia

2014-05-03 Thread Denis McMahon
On Sat, 03 May 2014 06:51:02 -0700, icesti2014editor wrote: sharing best practice in the field of Engineering, Science, and Technology towards sustainable development. The first event of this conference series (ICESTI 2014) will be held in Bali, Indonesia Let's all fly to Bali in the name

Re: [Call for Paper - SCOPUS/ISI THOMSON] ICESTI 2014, September 10-13, 2014, Kuta Bali - Indonesia

2014-05-03 Thread Steven D'Aprano
On Sat, 03 May 2014 15:50:40 +, Denis McMahon wrote: On Sat, 03 May 2014 06:51:02 -0700, icesti2014editor wrote: sharing best practice in the field of Engineering, Science, and Technology towards sustainable development. The first event of this conference series (ICESTI 2014) will be

Re: [Call for Paper - SCOPUS/ISI THOMSON] ICESTI 2014, September 10-13, 2014, Kuta Bali - Indonesia

2014-05-03 Thread Chris Angelico
On Sun, May 4, 2014 at 3:23 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Sat, 03 May 2014 15:50:40 +, Denis McMahon wrote: On Sat, 03 May 2014 06:51:02 -0700, icesti2014editor wrote: sharing best practice in the field of Engineering, Science, and Technology towards

Re: Why has __new__ been implemented as a static method?

2014-05-03 Thread Terry Reedy
On 5/3/2014 6:37 AM, Jurko Gospodnetić wrote: Hi all. I was wandering why Python implements its __new__ method as a static and not a class method? For a technical internal reason that Guido and maybe others have explained on pydev (more than once). I forget the details partly because

Re: [Call for Paper - SCOPUS/ISI THOMSON] ICESTI 2014, September 10-13, 2014, Kuta Bali - Indonesia

2014-05-03 Thread Terry Reedy
On 5/3/2014 1:23 PM, Steven D'Aprano wrote: On Sat, 03 May 2014 15:50:40 +, Denis McMahon wrote: On Sat, 03 May 2014 06:51:02 -0700, icesti2014editor wrote: sharing best practice in the field of Engineering, Science, and Technology towards sustainable development. The first event of

Python Image Registration and Cropping?

2014-05-03 Thread mikejohnryan08
Hello, Is there a Python tool or function that can register two images together (line them up visually), and then crop them to the common overlap area? I'm assuming this can probably be done with Python Imaging Library but I'm not very familiar with it yet. Any help or advice is appreciated!

Re: Python Image Registration and Cropping?

2014-05-03 Thread Mark Lawrence
On 03/05/2014 22:47, mikejohnrya...@gmail.com wrote: Hello, Is there a Python tool or function that can register two images together (line them up visually), and then crop them to the common overlap area? I'm assuming this can probably be done with Python Imaging Library but I'm not very

[ANNC] pybotwar-0.9 : now using pybox2d-2.3b0

2014-05-03 Thread Lee Harr
pybotwar is a fun and educational game where players write computer programs to control simulated robots. http://pybotwar.googlecode.com/ The focus of this release is updating to use the latest available pybox2d version: 2.3b0 pybotwar uses pybox2d for the physical simulation. It can be run in

Re: Why has __new__ been implemented as a static method?

2014-05-03 Thread Gregory Ewing
Steven D'Aprano wrote: I'm not entirely sure what he means by upcalls, but I believe it means to call the method further up (that is, closer to the base) of the inheritance tree. I think it means this: def __new__(cls): MyBaseClass.__new__(cls) which wouldn't work with a class

Re: Why has __new__ been implemented as a static method?

2014-05-03 Thread Steven D'Aprano
On Sun, 04 May 2014 11:21:53 +1200, Gregory Ewing wrote: Steven D'Aprano wrote: I'm not entirely sure what he means by upcalls, but I believe it means to call the method further up (that is, closer to the base) of the inheritance tree. I think it means this: def __new__(cls):

[issue20866] segfailt with os.popen and SIGPIPE

2014-05-03 Thread akira
akira added the comment: I can't reproduce it on Ubuntu 12.04 with Python 2.7.3, 2.7.6, 3.2, tip -- no segfault. It prints the expected output on both Python 2 and 3: (standard input) io-error (standard input) is printed by grep due to --files-with-match option io-error (Broken pipe) is

[issue21415] Python __new__ method doc typo (it's a class and not a static method)

2014-05-03 Thread Jurko Gospodnetić
Jurko Gospodnetić added the comment: Thanks for the detailed response! :-( I should have tested more before reporting the issue. Sorry for the noise. :-( I saw the 'cls' argument and assumed it was a class method. Having to explicitly specify cls did not seem to be in contradiction with this

[issue21420] Optimize 2 ** n: implement it as 1 n

2014-05-03 Thread Stefan Behnel
Stefan Behnel added the comment: LGTM, can't see a case where this might go wrong (errors and type checks are handled before the added code). It also seems a sufficiently common case to optimise it internally. The 2**n spelling is easier to read and to get right than the shifting, so it's

[issue20544] Use specific asserts in operator tests

2014-05-03 Thread Andrew Svetlov
Andrew Svetlov added the comment: Ok. I agree with Teddy but Raymond's arguments make a value also. Thus we need to make any decision and close the issue (and bunch of similar issues). On Sat, May 3, 2014 at 8:38 AM, Terry J. Reedy rep...@bugs.python.org wrote: Terry J. Reedy added the

[issue21422] int 0: return the number unmodified

2014-05-03 Thread STINNER Victor
New submission from STINNER Victor: I propose to add a micro-optimization for int 0: return the number unmodified. See attached patch. -- files: long_lshift0.patch keywords: patch messages: 217822 nosy: haypo, mark.dickinson, serhiy.storchaka priority: normal severity: normal status:

[issue21420] Optimize 2 ** n: implement it as 1 n

2014-05-03 Thread STINNER Victor
STINNER Victor added the comment: pow2_specialized.patch: here is a different approach, a little bit faster. I wrote a dedicated long_pow2() function which computes 2**k. Arguments in favor of pow2_specialized.patch instead of pow2.patch: - it's a little bit faster - don't touch

[issue20866] segfailt with os.popen and SIGPIPE

2014-05-03 Thread STINNER Victor
STINNER Victor added the comment: I can reproduce the crash. It occurs at the line fd.write(data). It looks like the crash occurs in the C function fwrite() which doesn't handle EPIPE / SIGPIPE correctly. Top of the gdb traceback: #0 0x0033d0a8968b in __mempcpy_sse2 () from

[issue14019] Unify tests for str.format and string.Formatter

2014-05-03 Thread Brett Cannon
Changes by Brett Cannon br...@python.org: -- assignee: - brett.cannon nosy: +brett.cannon ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14019 ___

[issue21352] improve documentation indexing

2014-05-03 Thread Tshepang Lekhonkhobe
Changes by Tshepang Lekhonkhobe tshep...@gmail.com: -- nosy: +tshepang ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21352 ___ ___

[issue18564] Integer overflow in socketmodule

2014-05-03 Thread Michele Orrù
Changes by Michele Orrù maker...@gmail.com: Added file: http://bugs.python.org/file35146/issue18564.3.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18564 ___

[issue18564] Integer overflow in socketmodule

2014-05-03 Thread Michele Orrù
Michele Orrù added the comment: Interestingly, bluetooth/bluetooth.h implements a function for parsing bluetooth addresses, but it's completely broken. https://git.kernel.org/cgit/bluetooth/bluez.git/tree/lib/bluetooth.c#n83 It would be much much more elegant to use str2ba() in our source code

[issue21233] Add *Calloc functions to CPython memory allocation API

2014-05-03 Thread Stefan Krah
Stefan Krah added the comment: I did a post-commit review. A couple of things: 1) I think Victor and I have a different view of the calloc() parameters. calloc(size_t nmemb, size_t size) If a memory region of bytes is allocated, IMO 'nbytes' should be in the place of 'nmemb' and

[issue20866] segfailt with os.popen and SIGPIPE

2014-05-03 Thread Charles-François Natali
Charles-François Natali added the comment: I can reproduce the crash. It occurs at the line fd.write(data). It looks like the crash occurs in the C function fwrite() which doesn't handle EPIPE / SIGPIPE correctly. Wouldn't be the first time. Note that in Python 3, we don't fopen/fwrite

[issue20866] segfailt with os.popen and SIGPIPE

2014-05-03 Thread Terry J. Reedy
Terry J. Reedy added the comment: I was thinking the same thing. This appears to be one of the 2.x bugs that have been fixed in 3.x but not 2.x because backporting the fix might break working code. If there another sensible fix that would be acceptable in 2.x? --

[issue21233] Add *Calloc functions to CPython memory allocation API

2014-05-03 Thread Stefan Krah
Stefan Krah added the comment: I forgot one thing: 5) If WITH_VALGRIND is defined, nbytes is uninitialized in _PyObject_Alloc(). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21233 ___

[issue20866] segfailt with os.popen and SIGPIPE

2014-05-03 Thread Charles-François Natali
Charles-François Natali added the comment: It's segfaulting inside fwrite(), so apart from completely rewriting the IO layer in 2.x, I don't see. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20866

[issue21233] Add *Calloc functions to CPython memory allocation API

2014-05-03 Thread Stefan Krah
Stefan Krah added the comment: Another thing: 6) We need some kind of prominent documentation that existing programs need to be changed: Python 3.5.0a0 (default:62438d1b11c7+, May 3 2014, 23:35:03) [GCC 4.8.2] on linux Type help, copyright, credits or license for more information. import

[issue21233] Add *Calloc functions to CPython memory allocation API

2014-05-03 Thread Nathaniel Smith
Nathaniel Smith added the comment: A simple solution would be to change the name of the struct, so that non-updated libraries will get a compile error instead of a runtime crash. -- ___ Python tracker rep...@bugs.python.org

[issue20215] Python2.7 socketserver can not listen IPv6 address

2014-05-03 Thread Andreas Røsdal
Andreas Røsdal added the comment: Here's a patch which implements support in SocketServer to set IPv6 socket address family to AF_INET6 automatically if the TCPServer is specified to listen to an IPv6 address. This means that users of the TCPServer class will get the correct address family

[issue21422] int 0: return the number unmodified

2014-05-03 Thread Raymond Hettinger
Raymond Hettinger added the comment: Every branch has a cost (in particular, it tends to contaminate global branch prediction tables and blow other code out of the L1 code cache). The cost isn't big, but branches shouldn't be added unless we know there is a real benefit. I would think that

[issue21375] Fix and test overflow behavior in the C version of heapq

2014-05-03 Thread Roundup Robot
Roundup Robot added the comment: New changeset 725cb631699a by Raymond Hettinger in branch '3.4': Issue 21375: Fix possible Py_ssizet overflow in heapq. http://hg.python.org/cpython/rev/725cb631699a -- nosy: +python-dev ___ Python tracker

[issue21375] Fix and test overflow behavior in the C version of heapq

2014-05-03 Thread Roundup Robot
Roundup Robot added the comment: New changeset b768d41dec0a by Raymond Hettinger in branch '2.7': Issue 21375: Fix possible Py_ssizet overflow in heapq. http://hg.python.org/cpython/rev/b768d41dec0a -- ___ Python tracker rep...@bugs.python.org

[issue21422] int 0: return the number unmodified

2014-05-03 Thread STINNER Victor
STINNER Victor added the comment: I would think that in real-world code, this branch will almost never be taken. The common case will pay a price (albiet a small one) for almost zero benefit. I think that x 0 is common even if it's not written like that (it's more for i in range(8): ... x

[issue21375] Fix and test overflow behavior in the C version of heapq

2014-05-03 Thread Raymond Hettinger
Changes by Raymond Hettinger raymond.hettin...@gmail.com: -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21375 ___

[issue21233] Add *Calloc functions to CPython memory allocation API

2014-05-03 Thread STINNER Victor
STINNER Victor added the comment: 6) We need some kind of prominent documentation that existing programs need to be changed: My final commit includes an addition to What's New in Python 3.5 doc, including a notice in the porting section. It is not enough? Even if the API is public, the

[issue21233] Add *Calloc functions to CPython memory allocation API

2014-05-03 Thread STINNER Victor
STINNER Victor added the comment: 5) If WITH_VALGRIND is defined, nbytes is uninitialized in _PyObject_Alloc(). Did you see my second commit? It's nlt already fixed? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21233

[issue21233] Add *Calloc functions to CPython memory allocation API

2014-05-03 Thread Stefan Krah
Stefan Krah added the comment: 5) If WITH_VALGRIND is defined, nbytes is uninitialized in _PyObject_Alloc(). Did you see my second commit? It's nlt already fixed? I don't think so, I have revision 5d076506b3f5 here. -- ___ Python tracker

[issue21233] Add *Calloc functions to CPython memory allocation API

2014-05-03 Thread STINNER Victor
STINNER Victor added the comment: allocate nbytes elements of size 1 PyObject_Malloc(100) asks to allocate one object of 100 bytes. For PyMem_Malloc() and PyMem_RawMalloc(), it's more difficult to guess, but IMO it's sane to bet that a single memory block of size bytes is requested. I

[issue21121] -Werror=declaration-after-statement is added even for extension modules through setup.py

2014-05-03 Thread Ned Deily
Ned Deily added the comment: I agree: issue21121-3.diff is a much better approach. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21121 ___ ___

[issue17338] Add length_hint parameter to list, dict, set constructors to allow efficient presizing

2014-05-03 Thread Raymond Hettinger
Raymond Hettinger added the comment: Based on all the negative comments, I'm closing this one. It adds too much complication in return for dubious value. -- resolution: - rejected status: open - closed ___ Python tracker rep...@bugs.python.org

[issue21233] Add *Calloc functions to CPython memory allocation API

2014-05-03 Thread Stefan Krah
Stefan Krah added the comment: STINNER Victor rep...@bugs.python.org wrote: PyObject_Malloc(100) asks to allocate one object of 100 bytes. Okay, then let's please call it: _PyObject_Calloc(void *ctx, size_t nobjs, size_t objsize) _PyObject_Alloc(int use_calloc, void *ctx, size_t nobjs,

[issue21101] Extend the PyDict C API to handle cases where the hash value is known

2014-05-03 Thread Roundup Robot
Roundup Robot added the comment: New changeset 39f475aa0163 by Raymond Hettinger in branch 'default': Issue 21101: Internal API for dict getitem and setitem where the hash value is known. http://hg.python.org/cpython/rev/39f475aa0163 -- nosy: +python-dev

[issue21423] concurrent.futures.ThreadPoolExecutor should accept an initializer argument

2014-05-03 Thread Andreas van Cranenburgh
New submission from Andreas van Cranenburgh: It would be useful if concurrent.futures.ThreadPoolExecutor took an initializer argument, like multiprocessing.Pool. This is useful for example to load a large dataset once upon initialization of each worker process, without have to pass the

[issue21121] -Werror=declaration-after-statement is added even for extension modules through setup.py

2014-05-03 Thread Larry Hastings
Larry Hastings added the comment: If you guys want this in 3.4.1, please get it checked in in the next, oh, eight hours. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21121 ___

[issue21101] Extend the PyDict C API to handle cases where the hash value is known

2014-05-03 Thread Roundup Robot
Roundup Robot added the comment: New changeset 592a57682ced by Raymond Hettinger in branch 'default': Issue #21101: Eliminate double hashing in the C code for collections.Counter(). http://hg.python.org/cpython/rev/592a57682ced -- ___ Python tracker

[issue21101] Extend the PyDict C API to handle cases where the hash value is known

2014-05-03 Thread Raymond Hettinger
Changes by Raymond Hettinger raymond.hettin...@gmail.com: -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21101 ___

[issue21357] Increase filecmp test coverage from 63% to 76%

2014-05-03 Thread Roundup Robot
Roundup Robot added the comment: New changeset 57dacba9febf by Benjamin Peterson in branch '3.4': improve test coverage of filecmp (closes #21357) http://hg.python.org/cpython/rev/57dacba9febf New changeset c597654a7fd8 by Benjamin Peterson in branch 'default': merge 3.4 (#21357)

[issue20642] Enhance deepcopy-ing for tuples

2014-05-03 Thread Roundup Robot
Roundup Robot added the comment: New changeset 0df3004581fe by Benjamin Peterson in branch 'default': improve idioms (closes #20642) http://hg.python.org/cpython/rev/0df3004581fe -- nosy: +python-dev resolution: - fixed stage: - resolved status: open - closed

[issue20642] Enhance deepcopy-ing for tuples

2014-05-03 Thread Raymond Hettinger
Raymond Hettinger added the comment: This was a nice patch. Thanks. -- nosy: +rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20642 ___

[issue21421] ABCs for MappingViews should declare __slots__ so subclasses aren't forced to have __dict__/__weakref__

2014-05-03 Thread Roundup Robot
Roundup Robot added the comment: New changeset 2c6a231e2c1e by Raymond Hettinger in branch 'default': Issue #21421: Add __slots__ to the MappingViews ABCs. http://hg.python.org/cpython/rev/2c6a231e2c1e -- nosy: +python-dev ___ Python tracker

[issue21421] ABCs for MappingViews should declare __slots__ so subclasses aren't forced to have __dict__/__weakref__

2014-05-03 Thread Raymond Hettinger
Raymond Hettinger added the comment: I've applied the __slots__ patch. Thank you for submitting it. Am leaving the rest of the ABCs code as-is. The current form may be a bit wordy but it is clean, fast, and easy to trace through a debugger. The expanded forms were chosen for a reason.

[issue21414] Add an intersperse function to itertools

2014-05-03 Thread Raymond Hettinger
Raymond Hettinger added the comment: I've looked into this a bit more. Even in Haskell, it seems that use case is for str.join() which we already have. I don't see intersperse() in any other functional languages. That suggests that its use cases aren't sufficiently common to warrant adding

[issue18604] Consolidate gui available checks in test.support

2014-05-03 Thread Roundup Robot
Roundup Robot added the comment: New changeset 7ecb6e4b1077 by Ned Deily in branch '3.4': Issue #18604: Skip the Tk instantiation test on OS X because it can http://hg.python.org/cpython/rev/7ecb6e4b1077 New changeset 7f6d9990a9b1 by Ned Deily in branch 'default': Issue #18604: merge from 3.4

[issue18604] Consolidate gui available checks in test.support

2014-05-03 Thread Ned Deily
Ned Deily added the comment: For some reason, the newly-added Tk instantiation check causes the OS X Cocoa Tk to segfault when tests are run under regrtest -jn option, which causes each test to be run under a separate subprocess called from a separate thread. Somewhat surprisingly, the

[issue19414] iter(ordered_dict) yields keys not in dict in some circumstances

2014-05-03 Thread Roundup Robot
Roundup Robot added the comment: New changeset a3c345ba3563 by Raymond Hettinger in branch 'default': Issue #19414: Have the OrderedDict mark deleted links as unusable. http://hg.python.org/cpython/rev/a3c345ba3563 -- nosy: +python-dev ___ Python

[issue19414] iter(ordered_dict) yields keys not in dict in some circumstances

2014-05-03 Thread Raymond Hettinger
Raymond Hettinger added the comment: To address Armin's concern, I'm triggering an early failure by setting the link fields to None. That will help prevent accidental reliance on non-guaranteed behaviors. -- resolution: - fixed status: open - closed

[issue21424] Simplify and speed-up heaqp.nlargest()

2014-05-03 Thread Raymond Hettinger
New submission from Raymond Hettinger: Consolidate the logic for nlargest() into a single function. Remove both the C and pure Python base underlying code. With all the logic in a single function, it only becomes necessary to create, store, and compare the data tuples when a need item is