[issue26821] array module "minimum size in bytes" table is wrong for int/long

2016-04-21 Thread Georg Brandl
Georg Brandl added the comment: Agreed. -- resolution: -> not a bug status: open -> closed ___ Python tracker ___

Re: How much sanity checking is required for function inputs?

2016-04-21 Thread Stephen Hansen
On Thu, Apr 21, 2016, at 08:33 PM, Christopher Reimer wrote: > On 4/21/2016 7:20 PM, Stephen Hansen wrote: > > I... that... what... I'd forget that link and pretend you never went > > there. Its not helpful. > > I found it on the Internet, so it must be true -- and Pythonic at that! My advice is

[issue26823] Shrink recursive tracebacks

2016-04-21 Thread Nick Coghlan
Nick Coghlan added the comment: For testing, you can create a recursive scenario that terminates with an exception after a defined number of iterations: >>> def f(counter): ... if counter: ... f(counter-1) ... else: ... raise RuntimeError ... >>> f(3) Traceback (most

[issue26821] array module "minimum size in bytes" table is wrong for int/long

2016-04-21 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: > I can't get two arrays one int, one byte with the same backing memory where > changes to one effect the other For this case you can use an array or bytearray + memoryview. I think this issue can be closed. -- nosy: +serhiy.storchaka

[issue26821] array module "minimum size in bytes" table is wrong for int/long

2016-04-21 Thread Georg Brandl
Georg Brandl added the comment: Indeed, I don't think the `array` module is much used anymore. If you're looking to serialize or deserialize fixed-size formats, you'll probably want the `struct` module. It has both native and fixed-size modes. For anything else involving arrays (mostly, but

Re: Error 0*80070570

2016-04-21 Thread eryk sun
On Thu, Apr 21, 2016 at 11:15 PM, Allan Leo wrote: > On Apr 21, 2016 9:51 PM, "eryk sun" wrote: >> On Thu, Apr 21, 2016 at 4:06 AM, Allan Leo wrote: >> > When running the setup for your 3.5.1(32-bit version), the setup >> >

[issue26824] Make some macros use Py_TYPE

2016-04-21 Thread Xiang Zhang
Changes by Xiang Zhang : -- type: -> enhancement versions: +Python 3.6 ___ Python tracker ___

[issue26824] Make some macros use Py_TYPE

2016-04-21 Thread Xiang Zhang
New submission from Xiang Zhang: According to PEP3123, all accesses to ob_refcnt and ob_type MUST cast the object pointer to PyObject* (unless the pointer is already known to have that type), and SHOULD use the respective accessor macros. I find that there are still some macros in Python use

Re: How much sanity checking is required for function inputs?

2016-04-21 Thread Ethan Furman
On 04/21/2016 08:33 PM, Christopher Reimer wrote: On 4/21/2016 7:20 PM, Stephen Hansen wrote: Keep in mind that I'm coming from a Java background (not by choice) with a smattering of C programming. A refugee! Water! Food! import this!! :) Oh! and Enum!!! ;) -- ~Ethan~ --

Re: How much sanity checking is required for function inputs?

2016-04-21 Thread Christopher Reimer
On 4/21/2016 7:20 PM, Stephen Hansen wrote: Whyyy are you using getattr? Something wrong with PieceFactory.factory(color, piece, position)? (Or, better yet, yield piece_factory(color, piece, position) where piece_factory is just a function) Because the example I found used it, I implemented

[issue26823] Shrink recursive tracebacks

2016-04-21 Thread Emanuel Barry
Emanuel Barry added the comment: Attached patch also modifies Lib/traceback.py to present identical behaviour, and changes "Previous message" to "Previous line". I'll postpone the more complex implementation of that, and might just not do it as it's indeed better to avoid bugs where we're

[issue26823] Shrink recursive tracebacks

2016-04-21 Thread Nick Coghlan
Nick Coghlan added the comment: +1 for the simple approach, and deferring the mutual recursion support - it's desirable to keep traceback printing simple in order to minimise the chance for failures during the display process. In addition to the C implementation of traceback printing, the

[issue22234] urllib.parse.urlparse accepts any falsy value as an url

2016-04-21 Thread Luiz Poleto
Changes by Luiz Poleto : -- nosy: +luiz.poleto ___ Python tracker ___ ___

Re: How much sanity checking is required for function inputs?

2016-04-21 Thread Christopher Reimer
On 4/21/2016 7:10 PM, Ethan Furman wrote: I do plan to incorporate a sanity test in each Piece class to validate the initial position value. Pawns have 16 specific positions. Bishop, Knight and Rook each have four specific positions. King and Queen each have two specific positions. An invalid

[issue26823] Shrink recursive tracebacks

2016-04-21 Thread Emanuel Barry
Emanuel Barry added the comment: The message is mostly a placeholder, but "message" is singular so I figured it would be obvious. But alas, if you are confused, others might be too. Propositions for a better message are welcome :) I'll attempt to make it track chained calls (or mutually

[issue26823] Shrink recursive tracebacks

2016-04-21 Thread Xiang Zhang
Xiang Zhang added the comment: With the current patch, a simple test gives the traceback: Traceback (most recent call last): File "", line 1, in File "", line 2, in test File "", line 2, in test File "", line 2, in test [Previous message repeated 995 more times] RecursionError:

Re: How much sanity checking is required for function inputs?

2016-04-21 Thread Christopher Reimer
On 4/21/2016 6:54 PM, Tim Chase wrote: I'd simplify this code to something like class PieceFactory(object): @staticmethod def factory(color, piece, position): try: return { 'Bishop': Bishop, 'King': King, 'Knight': Knight,

[issue26823] Shrink recursive tracebacks

2016-04-21 Thread Ethan Furman
Changes by Ethan Furman : -- nosy: +georg.brandl ___ Python tracker ___ ___

[issue26823] Shrink recursive tracebacks

2016-04-21 Thread Ethan Furman
Ethan Furman added the comment: If you can, give it a go. Make it a new patch, though -- don't delete the existing one. -- ___ Python tracker ___

[issue26823] Shrink recursive tracebacks

2016-04-21 Thread Ethan Furman
Changes by Ethan Furman : -- type: -> behavior ___ Python tracker ___ ___

[issue26823] Shrink recursive tracebacks

2016-04-21 Thread Emanuel Barry
Emanuel Barry added the comment: Yes, can't handle mutually recursive functions. I could maybe check for the last two or three functions, but that seems like unnecessary work for something that might not happen as often (I can see it being the case with e.g. __getattr__ though). If enough

[issue26823] Shrink recursive tracebacks

2016-04-21 Thread Chris Angelico
Chris Angelico added the comment: By "doesn't keep track of call chains", you mean that it can't handle mutually-recursive functions, right? Still useful. -- nosy: +Rosuav ___ Python tracker

[issue26823] Shrink recursive tracebacks

2016-04-21 Thread Ethan Furman
Changes by Ethan Furman : -- nosy: +ethan.furman ___ Python tracker ___ ___

[issue26823] Shrink recursive tracebacks

2016-04-21 Thread Emanuel Barry
New submission from Emanuel Barry: I recently suggested on Python-ideas ( https://mail.python.org/pipermail/python-ideas/2016-April/039899.html ) to shrink long tracebacks if they were all the same noise (recursive calls). Seeing as the idea had a good reception, I went ahead and implemented

[issue26822] itemgetter/attrgetter/methodcaller objects ignore keyword arguments

2016-04-21 Thread Xiang Zhang
Xiang Zhang added the comment: This makes sense. It makes the C version and Python version consistent. -- nosy: +xiang.zhang ___ Python tracker ___

Re: How much sanity checking is required for function inputs?

2016-04-21 Thread Steven D'Aprano
On Fri, 22 Apr 2016 11:34 am, Christopher Reimer wrote: > Greetings, > > Thanks to everyone for providing feedback. Here's my revised code to > generate a set of chess pieces. > class PieceFactory(object): > > def factory(color, piece, position): > if piece == 'Bishop': >

Re: How much sanity checking is required for function inputs?

2016-04-21 Thread Tim Chase
On 2016-04-21 18:34, Christopher Reimer wrote: > class PieceFactory(object): > > def factory(color, piece, position): > if piece == 'Bishop': > return Bishop(color, position) > if piece == 'King': > return King(color, position)

Re: How much sanity checking is required for function inputs?

2016-04-21 Thread Stephen Hansen
On Thu, Apr 21, 2016, at 06:34 PM, Christopher Reimer wrote: > class PieceFactory(object): > > def factory(color, piece, position): > if piece == 'Bishop': > return Bishop(color, position) > if piece == 'King': > return

Re: How much sanity checking is required for function inputs?

2016-04-21 Thread Ethan Furman
On 04/21/2016 06:34 PM, Christopher Reimer wrote: class PieceFactory(object): > [...] Better. I do plan to incorporate a sanity test in each Piece class to validate the initial position value. Pawns have 16 specific positions. Bishop, Knight and Rook each have four specific positions. King

Re: A pickle problem!

2016-04-21 Thread Paulo da Silva
Às 22:43 de 21-04-2016, Paulo da Silva escreveu: > Hi. > > Why in this code fragment self.__name is not kept between pickle > dumps/loads? How to fix it? > > Thanks. > > import pickle > import pandas as pd > import numpy as np > > class C(pd.DataFrame): > def __init__(self,name,*a,**b):

Re: How much sanity checking is required for function inputs?

2016-04-21 Thread Christopher Reimer
Greetings, Thanks to everyone for providing feedback. Here's my revised code to generate a set of chess pieces. class PieceFactory(object): def factory(color, piece, position): if piece == 'Bishop': return Bishop(color, position) if piece ==

[issue26814] [WIP] Add a new _PyObject_FastCall() function which avoids the creation of a tuple or dict for arguments

2016-04-21 Thread STINNER Victor
STINNER Victor added the comment: I created a repository. I will work there and make some experiment. It would help to have a better idea of the concrete performance. When I will have a better view of all requires changes to get best performances everywhere, I will start a discussion to see

[issue26814] Add a new _PyObject_FastCall() function which avoids the creation of a tuple or dict for arguments

2016-04-21 Thread STINNER Victor
Changes by STINNER Victor : -- hgrepos: +342 ___ Python tracker ___ ___

[issue26041] Update deprecation messages of platform.dist() and platform.linux_distribution()

2016-04-21 Thread Luiz Poleto
Changes by Luiz Poleto : -- nosy: +luiz.poleto ___ Python tracker ___ ___

[issue26820] Prevent uses of format string based PyObject_Call* that do not produce tuple required by docs

2016-04-21 Thread Jeremy Kloth
Jeremy Kloth added the comment: IMHO, this is a documentation bug with PyObject_CallMethod. The change to its documentation to differ from PyObject_CallFunction was changed back in 2004. It should have been updated then to reflect the already well-entrenched behavior of those 2 (at the

[issue26800] Don't accept bytearray as filenames part 2

2016-04-21 Thread STINNER Victor
STINNER Victor added the comment: bytearray is designed for performance. I don't think that the code creating a filename can be a bottleneck in an application. -- ___ Python tracker

[issue26800] Don't accept bytearray as filenames part 2

2016-04-21 Thread Larry Hastings
Larry Hastings added the comment: I did the path_converter change. IIRC some functions supported bytearray, some did not, and in my quest for consistency I took the superset of functionality and supported bytearray for everything. Sounds to me like bytearray support should be dropped, but

[issue26601] Use new madvise()'s MADV_FREE on the private heap

2016-04-21 Thread Julian Taylor
Julian Taylor added the comment: it defaulted to 128kb ten years ago, its a dynamic threshold since ages. -- ___ Python tracker ___

[issue26601] Use new madvise()'s MADV_FREE on the private heap

2016-04-21 Thread Julian Taylor
Julian Taylor added the comment: ARENA_SIZE is 256kb, the threshold in glibc is up to 32 MB -- ___ Python tracker ___

[issue26601] Use new madvise()'s MADV_FREE on the private heap

2016-04-21 Thread David Wilson
David Wilson added the comment: @Julian note that ARENA_SIZE is double the threshold after which at least glibc resorts to calling mmap directly, so using malloc in place of mmap on at least Linux would have zero effect -- nosy: +dw ___ Python

[issue26821] array module "minimum size in bytes" table is wrong for int/long

2016-04-21 Thread Jonathan Booth
Jonathan Booth added the comment: Ugly -- if I know I'm dealing with 4-byte data, I can't just specify 'I' or 'L' because it'll be wrong on some platform? Maybe the bug is really the module's design. Seems I need to look elsewhere for other reasons (array seems to want to copy memory, rather

[issue26601] Use new madvise()'s MADV_FREE on the private heap

2016-04-21 Thread Julian Taylor
Julian Taylor added the comment: simplest way to fix this would be to not use malloc instead of mmap in the allocator, then you also get MADV_FREE for free when malloc uses it. The rational for using mmap is kind of weak, the source just says "heap fragmentation". The usual argument for using

[issue26822] itemgetter/attrgetter/methodcaller objects ignore keyword arguments

2016-04-21 Thread Josh Rosenberg
Josh Rosenberg added the comment: Seems sensible for itemgetter and attrgetter, where all but the first argument is nonsensical anyway. It really seems like methodcaller should allow additional arguments (positional and keyword though), a la functools.partial (the difference being the support

A pickle problem!

2016-04-21 Thread Paulo da Silva
Hi. Why in this code fragment self.__name is not kept between pickle dumps/loads? How to fix it? Thanks. import pickle import pandas as pd import numpy as np class C(pd.DataFrame): def __init__(self,name,*a,**b): super(C,self).__init__(*a,**b)

Re: Error 0*80070570

2016-04-21 Thread eryk sun
On Thu, Apr 21, 2016 at 4:06 AM, Allan Leo wrote: > When running the setup for your 3.5.1(32-bit version), the setup > experiences error 0*80070570 and tells me to check the log file. What could > be the problem and whats the solution. ERROR_FILE_CORRUPT (0x0570) seems

[issue26821] array module "minimum size in bytes" table is wrong for int/long

2016-04-21 Thread random832
random832 added the comment: It says *minimum* size for a reason. The *actual* sizes of the types used in array are platform-dependent. 2 is the smallest that an int can be (it is probably not that size on any currently supported platforms, but would have been in DOS), and 4 is the smallest

Re: Re: Error 0*80070570

2016-04-21 Thread sohcahtoa82
On Thursday, April 21, 2016 at 10:47:04 AM UTC-7, Allan Leo wrote: > I need help with this setup error. > -- Forwarded message -- > From: "Allan Leo" > Date: Apr 21, 2016 10:06 AM > Subject: Re: Error 0*80070570 > To: > Cc: > >

Re: Different names for Unicode codepoint

2016-04-21 Thread Eli Zaretskii
> From: Lele Gaifax > Date: Thu, 21 Apr 2016 21:04:32 +0200 > Cc: python-list@python.org > > is there a particular reason for the slightly different names that Emacs > (version 25.0.92) and Python (version 3.6.0a0) give to a single Unicode > entity? They don't. > Just to

[issue16679] Add advice about non-ASCII wsgiref PATH_INFO

2016-04-21 Thread Graham Dumpleton
Graham Dumpleton added the comment: Double back slashes would possibly be an artefact of the some mess that happens when logging out through the Apache error log. -- ___ Python tracker

python regex dna processing

2016-04-21 Thread Joel Goldstick
>From time to time there are DNA related question posted here. I came upon this in the hopes it may be useful to those who do that kind of software http://benchling.engineering/dna-regex-search/ -- Joel Goldstick http://joelgoldstick.com/blog http://cc-baseballstats.info/stats/birthdays --

[issue26822] itemgetter/attrgetter/methodcaller objects ignore keyword arguments

2016-04-21 Thread Serhiy Storchaka
New submission from Serhiy Storchaka: itemgetter(), attrgetter() and methodcaller() objects require one argument. They raise TypeError if less or more than one positional argument is provided. But they totally ignore any keyword arguments. >>> import operator >>> f = operator.itemgetter(1)

[issue26689] Add `has_flag` method to `distutils.CCompiler`

2016-04-21 Thread Sylvain Corlay
Sylvain Corlay added the comment: Hey, any blocker to getting this in? -- ___ Python tracker ___ ___

[issue26821] array module "minimum size in bytes" table is wrong for int/long

2016-04-21 Thread Jonathan Booth
New submission from Jonathan Booth: https://docs.python.org/3.5/library/array.html describes the 'I' and 'i' typecodes as being minimum-size in bytes of 2. The interpreter disagrees: >>> import array >>> a = array.array('i') >>> a.itemsize 4 There is also a bug with the 'L' and 'l' long

Re: Fwd: Re: Error 0*80070570

2016-04-21 Thread Stephen Hansen
On Thu, Apr 21, 2016, at 10:46 AM, Allan Leo wrote: > I need help with this setup error. > -- Forwarded message -- > From: "Allan Leo" > Date: Apr 21, 2016 10:06 AM > Subject: Re: Error 0*80070570 > To: > Cc: > > When running the

[issue26820] Prevent uses of format string based PyObject_Call* that do not produce tuple required by docs

2016-04-21 Thread Josh Rosenberg
Josh Rosenberg added the comment: The motivation for this change was Mr. STINNER's comment on #26814 ( https://bugs.python.org/issue26814#msg263923 ), where he mentioned the weirdness of PyObject_CallFunction and friends, which complicates the implementation of PyObject_FastCall and alerted

[issue26820] Prevent uses of format string based PyObject_Call* that do not produce tuple required by docs

2016-04-21 Thread Josh Rosenberg
New submission from Josh Rosenberg: PyObject_CallMethod explicitly documents that "The C arguments are described by a Py_BuildValue() format string that should produce a tuple." While PyObject_CallFunction doesn't document this requirement, it has the same behavior, and the same failures, as

Re: How are you supposed to define subclasses in C?

2016-04-21 Thread Stefan Behnel
Random832 schrieb am 21.04.2016 um 18:35: > I was trying to write a proof of concept on including descriptors (e.g. > a "sys.recursionlimit" instead of set/get methods) in the sys module, > and couldn't figure out how to "properly" define a type using > PyType_FromSpecWithBases. Everything I tried

[issue16679] Add advice about non-ASCII wsgiref PATH_INFO

2016-04-21 Thread Andrew Clover
Andrew Clover added the comment: > Why only PATH_INFO is encoded in such a manner, but QUERY_STRING is passed > without any changes and does not requires any latin-1 to utf-8 recodings? Laziness: QUERY_STRING should be pure-ASCII, making any such transcoding a no-op. In principle a user

Fwd: Re: Error 0*80070570

2016-04-21 Thread Allan Leo
I need help with this setup error. -- Forwarded message -- From: "Allan Leo" Date: Apr 21, 2016 10:06 AM Subject: Re: Error 0*80070570 To: Cc: When running the setup for your 3.5.1(32-bit version), the setup experiences error

[issue26819] _ProactorReadPipeTransport pause_reading()/resume_reading() broken if called before any read is perfored

2016-04-21 Thread Fulvio Esposito
New submission from Fulvio Esposito: Calling pause_reading()/resume_reading() on a _ProactorReadPipeTransport will result in an InvalidStateError('Result is not ready.') from a future if no read has been issued yet. The reason is that resume_reading() will schedule _loop_reading() a second

[issue26814] Add a new _PyObject_FastCall() function which avoids the creation of a tuple or dict for arguments

2016-04-21 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: PyObject_Call*() implementations with _PyObject_FastCall() look much more complex than with PyObject_Call() (even not counting additional complex functions in modsupport.c). And I'm not sure there is a benefit. May be for first stage we can do without this.

Re: How are you supposed to define subclasses in C?

2016-04-21 Thread Zachary Ware
On Thu, Apr 21, 2016 at 11:35 AM, Random832 wrote: > I was trying to write a proof of concept on including descriptors (e.g. > a "sys.recursionlimit" instead of set/get methods) in the sys module, > and couldn't figure out how to "properly" define a type using >

How are you supposed to define subclasses in C?

2016-04-21 Thread Random832
I was trying to write a proof of concept on including descriptors (e.g. a "sys.recursionlimit" instead of set/get methods) in the sys module, and couldn't figure out how to "properly" define a type using PyType_FromSpecWithBases. Everything I tried just segfaulted. I ended up just calling

[issue7275] CoverageResult fails to merge input file with non-empty callers in trace.py

2016-04-21 Thread Berker Peksag
Berker Peksag added the comment: Thanks for the report and for the patch, Christian. Here is a patch with a test. -- nosy: +berker.peksag title: CoverageResult fails to merge input file with non-empty callers in trace.py (patch) -> CoverageResult fails to merge input file with

Re: PEP proposal: sequence expansion support for yield statement: yield *

2016-04-21 Thread Chris Angelico
On Fri, Apr 22, 2016 at 1:19 AM, justin walters wrote: > I agree with the others that the new syntax is not needed. > > I would also like to point out that I believe any new added syntax or > functionality should avoid the use of '*' and '**' as both of these >

Re: Error 0*80070570

2016-04-21 Thread justin walters
On Thu, Apr 21, 2016 at 2:06 AM, Allan Leo wrote: > When running the setup for your 3.5.1(32-bit version), the setup > experiences error 0*80070570 and tells me to check the log file. What could > be the problem and whats the solution. > On Apr 21, 2016 7:05 AM, "Allan

Re: PEP proposal: sequence expansion support for yield statement: yield *

2016-04-21 Thread justin walters
I agree with the others that the new syntax is not needed. I would also like to point out that I believe any new added syntax or functionality should avoid the use of '*' and '**' as both of these characters are already used for many things such as optional arguments and mathematical operators.

[issue26814] Add a new _PyObject_FastCall() function which avoids the creation of a tuple or dict for arguments

2016-04-21 Thread STINNER Victor
STINNER Victor added the comment: > I believe I got a very simple version of it working at one point, supporting > positional parameters only, with some optional arguments. Yeah, that would be a nice first step. > p.s. My last name has two S's. If you continue to leave off one of them, I >

[issue26814] Add a new _PyObject_FastCall() function which avoids the creation of a tuple or dict for arguments

2016-04-21 Thread STINNER Victor
STINNER Victor added the comment: Since early microbenchmarks are promising, I wrote a more complete implementations which tries to use the fast-path (avoid temporary tuple/dict) in all PyObject_Call*() functions. The next step would be to add a METH_FASTCALL flag. IMHO adding such new flag

Re: Detecting repeated subsequences of identical items

2016-04-21 Thread Chris Angelico
On Fri, Apr 22, 2016 at 12:30 AM, Oscar Benjamin wrote: > On 21 April 2016 at 15:12, Chris Angelico wrote: >> On Fri, Apr 22, 2016 at 12:01 AM, Oscar Benjamin >> wrote: >>> In the recursive stack overflow case what you'll

[issue26818] trace CLI doesn't respect -s option

2016-04-21 Thread Berker Peksag
New submission from Berker Peksag: I noticed this while triaging issue 9317. Using traceme.py from that issue, $ ./python -m trace -c -s traceme.py returns nothing. It seems like it's a regression caused by https://github.com/python/cpython/commit/17e5da46a733a1a05072a277bc81ffa885f0c204

Re: Detecting repeated subsequences of identical items

2016-04-21 Thread Oscar Benjamin
On 21 April 2016 at 15:12, Chris Angelico wrote: > On Fri, Apr 22, 2016 at 12:01 AM, Oscar Benjamin > wrote: >> In the recursive stack overflow case what you'll usually have is >> >> 1) A few frames leading up to the start of recursion >> 2) A long

[issue9317] Incorrect coverage file from trace test_pickle.py

2016-04-21 Thread Berker Peksag
Berker Peksag added the comment: A patch similar to issue9317.2.patch has been applied in 0aa46b9ffba3. However, I noticed a regression and created issue 26818. I can confirm that this issue is fixed with the patch from issue 26818 applied. -- nosy: +berker.peksag resolution: ->

[issue26814] Add a new _PyObject_CallStack() function which avoids the creation of a tuple or dict for arguments

2016-04-21 Thread Larry Hastings
Larry Hastings added the comment: Yes, I've been working on a patch to do this as well. I called the calling convention METH_RAW, to go alongside METH_ZERO METH_O etc. My calling convention was exactly the same as yours: PyObject *(PyObject *o, PyObject **stack, int na, int nk). I only had

Re: Detecting repeated subsequences of identical items

2016-04-21 Thread Chris Angelico
On Fri, Apr 22, 2016 at 12:01 AM, Oscar Benjamin wrote: > In the recursive stack overflow case what you'll usually have is > > 1) A few frames leading up to the start of recursion > 2) A long repetitive sequence of frames > 3) A few frames at the end showing how the

Re: Detecting repeated subsequences of identical items

2016-04-21 Thread Oscar Benjamin
On 21 April 2016 at 13:15, Steven D'Aprano wrote: > On Thu, 21 Apr 2016 06:53 pm, Oscar Benjamin wrote: > >> On 21 April 2016 at 04:07, Steven D'Aprano wrote: >>> I want to group repeated items in a sequence. For example, I can group >>> repeated

[issue12743] C API marshalling doc contains XXX

2016-04-21 Thread Berker Peksag
Berker Peksag added the comment: Since 4059e871e74e, PyMarshal_ReadLongFromFile and PyMarshal_ReadShortFromFile can return -1 on error. Return values of those functions were already documented in acb4d43955f6. Some of the usages also check return value of PyErr_Occurred():

[issue26814] Add a new _PyObject_CallStack() function which avoids the creation of a tuple or dict for arguments

2016-04-21 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: With call_stack-2.patch attribute access in namedtuple is only 25% slower than attribute access in ordinary Python object! Definitely this this worth to continue to experiment! But adding new slot to PyTypeObject sets the bar too high. Try to use your

Re: delete from pattern to pattern if it contains match

2016-04-21 Thread Jussi Piitulainen
harirammano...@gmail.com writes: > On Monday, April 18, 2016 at 12:38:03 PM UTC+5:30, > hariram...@gmail.com wrote: >> HI All, >> >> can you help me out in doing below. >> >> file: >> >> guava >> fruit >> >> >> mango >> fruit >> >> >> orange >> fruit >> >> >> need to

[issue26817] Docs for StringIO should link to io.BytesIO

2016-04-21 Thread Thomas Guettler
New submission from Thomas Guettler: I think a warning at the top of StringIO docs is needed. And it should link to io.BytesIO. Maybe even deprecate StringIO and cStringIO in Python2? StringIO docs: https://docs.python.org/2/library/stringio.html io.BytesIO docs:

[issue26815] SIGBUS in test_ssl.test_dealloc_warn() on "AMD64 FreeBSD 10.0 3.x" buildbot

2016-04-21 Thread STINNER Victor
STINNER Victor added the comment: Another different failure. http://buildbot.python.org/all/builders/AMD64%20FreeBSD%2010.0%203.x/builds/4362/steps/test/logs/stdio == FAIL: test_refcycle (test.test_ssl.BasicSocketTests)

Re: Detecting repeated subsequences of identical items

2016-04-21 Thread Steven D'Aprano
On Thu, 21 Apr 2016 06:53 pm, Oscar Benjamin wrote: > On 21 April 2016 at 04:07, Steven D'Aprano wrote: >> I want to group repeated items in a sequence. For example, I can group >> repeated sequences of a single item at a time using groupby: >> >> >> from itertools import

[issue26816] Make concurrent.futures.Executor an abc

2016-04-21 Thread Xiang Zhang
Changes by Xiang Zhang : -- type: -> enhancement versions: +Python 3.5, Python 3.6 ___ Python tracker ___

[issue22359] Remove incorrect uses of recursive make

2016-04-21 Thread Xavier de Gaye
Xavier de Gaye added the comment: _freeze_importlib and pgen are cross-built in this patch. Patch tested with a run of the testsuite after a cross-build. -- Added file: http://bugs.python.org/file42554/crossbuild-sources-readonly_2.patch ___ Python

Re: Detecting repeated subsequences of identical items

2016-04-21 Thread Nobody
On Thu, 21 Apr 2016 18:05:40 +1000, Steven D'Aprano wrote: > The specific problem I am trying to solve is that I have a sequence of > strings (in this case, error messages from a Python traceback) and I'm > looking for repeated groups that may indicate mutually recursive calls. E.g. > suppose

[issue26816] Make concurrent.futures.Executor an abc

2016-04-21 Thread Xiang Zhang
Xiang Zhang added the comment: Update the patch to remove more unnecessary base object. -- Added file: http://bugs.python.org/file42553/make_concurrent_futures_Executor_an_abc_v2.patch ___ Python tracker

Re: Detecting repeated subsequences of identical items

2016-04-21 Thread Serhiy Storchaka
On 21.04.16 06:07, Steven D'Aprano wrote: Now I want to group subsequences. For example, I have: "ABCABCABCDEABCDEFABCABCABCB" and I want to group it into repeating subsequences. [...] How can I do this? Does this problem have a standard name and/or solution? This is a part of lossless

[issue26750] Mock autospec does not work with subclasses of property()

2016-04-21 Thread Berker Peksag
Changes by Berker Peksag : -- components: +Library (Lib) -Tests nosy: +berker.peksag stage: -> patch review type: enhancement -> behavior versions: +Python 3.5, Python 3.6 ___ Python tracker

[issue26803] syslog logging handler fails with address in unix abstract namespace

2016-04-21 Thread Xavier de Gaye
Xavier de Gaye added the comment: In makesockaddr(), the current implementation does not do any decoding of AF_UNIX addresses in the abstract namespace in the struct sockaddr_un to bytes direction, i.e. system to python direction, but does encode a string or bytes object to struct sockaddr_un

[issue26804] Prioritize lowercase proxy variables in urllib.request

2016-04-21 Thread Hans-Peter Jansen
Hans-Peter Jansen added the comment: Here's the finalized version of this patch, including unit tests. -- Added file: http://bugs.python.org/file42552/python-urllib-prefer-lowercase-proxies-v4.diff ___ Python tracker

Re: delete from pattern to pattern if it contains match

2016-04-21 Thread Peter Otten
harirammano...@gmail.com wrote: > On Monday, April 18, 2016 at 12:38:03 PM UTC+5:30, hariram...@gmail.com > wrote: >> HI All, >> >> can you help me out in doing below. >> >> file: >> >> guava >> fruit >> >> >> mango >> fruit >> >> >> orange >> fruit >> Is that literally what you have

[issue26816] Make concurrent.futures.Executor an abc

2016-04-21 Thread Xiang Zhang
New submission from Xiang Zhang: The documentation tells that concurrent.futures.Executor is an abstract class. Also PEP3148 tells so and says concurrent.futures.Executor.submit is an abstract method and must be implemented by Executor subclasses. I think using abc.ABCMeta here is a good

[issue26814] Add a new _PyObject_CallStack() function which avoids the creation of a tuple or dict for arguments

2016-04-21 Thread STINNER Victor
STINNER Victor added the comment: call_stack-2.patch: A little bit more complete patch, it adds a tp_call_stack field to PyTypeObject an use it in _PyObject_CallStack(). Updated microbenchmark on Python 3.6, best of 3 runs: ./python -m timeit -r 11 -s "from collections import namedtuple as n;

[issue26814] Add a new _PyObject_CallStack() function which avoids the creation of a tuple or dict for arguments

2016-04-21 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: See also issue23507. May be your function help to optimize filter(), map(), sorted()? -- ___ Python tracker ___

Re: delete from pattern to pattern if it contains match

2016-04-21 Thread harirammanohar
On Monday, April 18, 2016 at 12:38:03 PM UTC+5:30, hariram...@gmail.com wrote: > HI All, > > can you help me out in doing below. > > file: > > guava > fruit > > > mango > fruit > > > orange > fruit > > > need to delete from start to end if it contains mango in a file...

[issue26814] Add a new _PyObject_CallStack() function which avoids the creation of a tuple or dict for arguments

2016-04-21 Thread STINNER Victor
STINNER Victor added the comment: Microbenchmark on Python 3.6, best of 3 runs: ./python -m timeit -r 11 -s "from collections import namedtuple as n; a = n('n', 'a b c')(1, 2, 3)" -- "a.a; a.a; a.a; a.a; a.a; a.a; a.a; a.a; a.a; a.a; a.a; a.a; a.a; a.a; a.a; a.a; a.a; a.a; a.a" * Python 3.6

[issue26814] Add a new _PyObject_CallStack() function which avoids the creation of a tuple or dict for arguments

2016-04-21 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: "Stack" in the function name looks a little confusing. I understand that this is related to the stack of bytecode interpreter, but this looks as raising pretty deep implementation detail. The way of packing positional and keyword arguments in the continuous

[issue26815] SIGBUS in test_ssl.test_dealloc_warn() on "AMD64 FreeBSD 10.0 3.x" buildbot

2016-04-21 Thread STINNER Victor
STINNER Victor added the comment: The test: def test_dealloc_warn(self): ss = ssl.wrap_socket(socket.socket(socket.AF_INET)) r = repr(ss) with self.assertWarns(ResourceWarning) as cm: ss = None support.gc_collect() <~ SIGBUG occurred

[issue26815] SIGBUS in test_ssl.test_dealloc_warn() on "AMD64 FreeBSD 10.0 3.x" buildbot

2016-04-21 Thread STINNER Victor
New submission from STINNER Victor: Oh oh, that's not good. test_ssl crashed in test_dealloc_warn() on the "AMD64 FreeBSD 10.0 3.x" buildbot. http://buildbot.python.org/all/builders/AMD64%20FreeBSD%2010.0%203.x/builds/4348/steps/test/logs/stdio [ 39/400] test_ssl Fatal Python error: Bus error

[issue26811] segfault due to null pointer in tuple

2016-04-21 Thread STINNER Victor
STINNER Victor added the comment: Oh, I see "The property() getter calls are up to 25% faster. (Contributed by Joe Jevnik in issue 23910.)" in https://docs.python.org/dev/whatsnew/3.5.html#optimizations Hum... This is embarrassing :-/ Ok, let's keep it, but we must fix it ;-) --

  1   2   >