Re: async enumeration - possible?

2016-11-29 Thread Marko Rauhamaa
Chris Angelico :

> On Wed, Nov 30, 2016 at 7:07 AM, Marko Rauhamaa  wrote:
> Any of these that depend on pumping the entire iterable can simply
> synchronify [1] the iterable:

One of the more useful ones might be:

o = await anext(ait)

> list(x async for x in aiterable)
>
> Interestingly, I can't do that in a list comp:

I have a couple of points to make with my question:

 * We are seeing the reduplication of a large subset of Python's
   facilities. I really wonder if the coroutine fad is worth the price.

 * I don't think bulk iteration in asynchronous programming is ever that
   great of an idea. You want to be prepared for more than one possible
   stimulus in any given state. IOW, a state machine matrix might be
   sparse but it is never diagonal.


Marko
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue27647] Update Windows build to Tcl/Tk 8.6.6

2016-11-29 Thread Benjamin Peterson

Benjamin Peterson added the comment:

Doesn't seem terribly urgent, so maybe not 2.7.13.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5322] Python 2.6 object.__new__ argument calling autodetection faulty

2016-11-29 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
assignee:  -> serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: async enumeration - possible?

2016-11-29 Thread Frank Millman

"Frank Millman"  wrote in message news:o1k355$da5$1...@blaine.gmane.org...


Hi all

Python 3.6 has introduced Asynchronous Generators, which work very well.


[...]


However, it does not allow you to enumerate over the generator output -


[...]


Is there any technical reason for this, or is it just that no-one has got 
around to writing an asynchronous version yet?


Thanks for the replies.

@Ian
Thanks for your explanation and example.
The example is perfect for my simple requirement.

@Terry
I should have googled for aenumerate - didn't think of it.

However, this recipe is based on Python 3.5 and earlier.
Asynchronous Generators, introduced in 3.6, make it much easier.
See PEP 525 for the details -
   https://www.python.org/dev/peps/pep-0525/

@Chris
I agree, there is a big difference between functions which consume the 
entire iterable before returning the result, and those which behave 
asynchronously and return the value on-the-fly.


I happened upon enumerate. You mentioned zip and map, which are also likely 
to be useful in the right circumstances.


I did not quite follow your example, as I get the opposite result -

Python 3.6.0b4 (default, Nov 22 2016, 05:30:12) [MSC v.1900 64 bit (AMD64)] 
on win32

Type "help", "copyright", "credits" or "license" for more information.

import asyncio
loop = asyncio.get_event_loop()



async def gen(n):

...   for i in range(n):
... yield i
...

async def main():

...   print([x async for x in gen(5)])
...

loop.run_until_complete(main())

[0, 1, 2, 3, 4]


async def main():

...   print(list(x async for x in gen(5)))
...

loop.run_until_complete(main())

Traceback (most recent call last):
 File "", line 1, in 
 File 
"C:\Users\User\AppData\Local\Programs\Python\Python36\lib\asyncio\base_events.py", 
line 466, in run_until_complete

   return future.result()
TypeError: 'async_generator' object is not iterable




Frank


--
https://mail.python.org/mailman/listinfo/python-list


[issue27142] Default int value with xmlrpclib / xmlrpc.client

2016-11-29 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
nosy: +rhettinger

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Request Help With Byte/String Problem

2016-11-29 Thread Wildman via Python-list
On Tue, 29 Nov 2016 18:29:51 -0800, Paul Rubin wrote:

> Wildman  writes:
>> names = array.array("B", '\0' * bytes)
>> TypeError: cannot use a str to initialize an array with typecode 'B'
> 
> In Python 2, str is a byte string and you can do that.  In Python 3,
> str is a unicode string, and if you want a byte string you have to
> specify that explicitly, like b'foo' instead of 'foo'.  I.e.
> 
>  names = array.array("B", b'\0' * bytes)
> 
> should work.

I really appreciate your reply.  Your suggestion fixed that
problem, however, a new error appeared.  I am doing some
research to try to figure it out but no luck so far.

Traceback (most recent call last):
  File "./ifaces.py", line 33, in 
ifs = all_interfaces()
  File "./ifaces.py", line 21, in all_interfaces
name = namestr[i:i+16].split('\0', 1)[0]
TypeError: Type str doesn't support the buffer API


-- 
 GNU/Linux user #557453
The cow died so I don't need your bull!
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue28754] Argument Clinic for bisect.bisect_left

2016-11-29 Thread Raymond Hettinger

Raymond Hettinger added the comment:

> If adding proper support for hi=None, maybe lo=None should
> also be supported.

That would be gratuitous.  Lo already has a reasonable, useful, and 
self-explanatory value.  This would add more complexity to the signature while 
reducing clarity.  I really don't want to see calls like bisect(arr, x, None).

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: correct way to catch exception with Python 'with' statement

2016-11-29 Thread Steven D'Aprano
On Wednesday 30 November 2016 10:59, woo...@gmail.com wrote:

> If you want to do something only if the file exists (or does not), use
> os.path.isfile(filename)

No, don't do that. Just because the file exists, doesn't mean that you have 
permission to read or write to it.

Worse, the code is vulnerable to race conditions. Look at this:

if os.path.isfile(filename):
with open(filename) as f:
process(f)


Just because the file exists when you test it, doesn't mean it still exists a 
millisecond later when you go to open the file. On a modern multi-processing 
system, like Windows, OS X or Linux, a lot can happen in the microseconds 
between checking for the file's existence and actually accessing the file.

This is called a "Time Of Check To Time Of Use" bug, and it can be a security 
vulnerability.



-- 
Steven
"Ever since I learned about confirmation bias, I've been seeing 
it everywhere." - Jon Ronson

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: async enumeration - possible?

2016-11-29 Thread Chris Angelico
On Wed, Nov 30, 2016 at 7:07 AM, Marko Rauhamaa  wrote:
> Ok, so how about:
>
>aall(aiterable)
>aany(aiterable)
>class abytearray(aiterable[, encoding[, errors]])
>class adict(aiterable, **kwarg)
>class afilter(coro, aiterable)
>class afrozenset(aiterable)
>aiter(object[, sentinel])
>class alist(aiterable)
>amap(coro, aiterable, ...)
>amax(aiterable, *[, key, default])
>amin(aiterable, *[, key, default])
>anext(aiterator[, default])
>class aset(aiterable)
>asorted(aiterable[, key][, reverse])
>asum(aiterable[, start])
>atuple(aiterable)
>azip(*aiterables)
>
> to name a few...
>
> How about awaitable comprehensions?

Any of these that depend on pumping the entire iterable can simply
synchronify [1] the iterable:

list(x async for x in aiterable)

Interestingly, I can't do that in a list comp:

>>> [x async for x in aiterable]
  File "", line 1
[x async for x in aiterable]
   ^
SyntaxError: invalid syntax

Not sure why. Anyhow. That removes the need for alist, atuple, amax,
etc. All you would need are the ones that process an iterable and
yield values individually, like azip and amap. Those can be provided
as recipes, third-party modules, or stdlib modules, until they prove
their worth as potential builtins.

ChrisA

[1] is that even a word?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Request Help With Byte/String Problem

2016-11-29 Thread Paul Rubin
Wildman  writes:
> names = array.array("B", '\0' * bytes)
> TypeError: cannot use a str to initialize an array with typecode 'B'

In Python 2, str is a byte string and you can do that.  In Python 3,
str is a unicode string, and if you want a byte string you have to
specify that explicitly, like b'foo' instead of 'foo'.  I.e.

 names = array.array("B", b'\0' * bytes)

should work.
-- 
https://mail.python.org/mailman/listinfo/python-list


Request Help With Byte/String Problem

2016-11-29 Thread Wildman via Python-list
For the purpose of learning I am writing a script that will
return different information about the Linux machine where
it is running.  Sort of like the inxi utility.

Below is some code that I found that returns a list of the
network interface devices on the system.  It runs as is
perfectly on Python2 but I get the error pasted below the
code when run on Python3, the desired version.  I know it
has something to do with bytes vs. strings but I can' seem
to figure it out.  Any help appreciated.

import array
import socket
import struct

def all_interfaces():
max_possible = 128  # arbitrary. raise if needed.
bytes = max_possible * 32
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
names = array.array("B", '\0' * bytes)
outbytes = struct.unpack('iL', fcntl.ioctl(
s.fileno(),
0x8912,  # SIOCGIFCONF
struct.pack('iL', bytes, names.buffer_info()[0])
))[0]
namestr = names.tostring()
lst = []
for i in range(0, outbytes, 40):
name = namestr[i:i+16].split('\0', 1)[0]
ip   = namestr[i+20:i+24]
lst.append((name, ip))
return lst

def format_ip(addr):
return str(ord(addr[0])) + '.' + \
   str(ord(addr[1])) + '.' + \
   str(ord(addr[2])) + '.' + \
   str(ord(addr[3]))


ifs = all_interfaces()
for i in ifs:
print("%12s   %s" % (i[0], format_ip(i[1])))


Traceback (most recent call last):
  File "./ifaces.py", line 32, in 
ifs = all_interfaces()
  File "./ifaces.py", line 11, in all_interfaces
names = array.array("B", '\0' * bytes)
TypeError: cannot use a str to initialize an array with typecode 'B'

-- 
 GNU/Linux user #557453
The cow died so I don't need your bull!
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue28836] Throw concurrent.futures.TimeoutError instead of concurrent.futures.__base.TimeoutError

2016-11-29 Thread Decorater

Decorater added the comment:

Wait actually BotErrors.CommandTimeoutError cubaclasses 
concurrent.futures.TimeoutError

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28836] Throw concurrent.futures.TimeoutError instead of concurrent.futures.__base.TimeoutError

2016-11-29 Thread Decorater

Decorater added the comment:

oh wait nvm

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28836] Throw concurrent.futures.TimeoutError instead of concurrent.futures.__base.TimeoutError

2016-11-29 Thread Decorater

Decorater added the comment:

Here is my corouytine and the traceback on it to verify my issue too:

Task exception was never retrieved
future: 
 exception=TimeoutError()>
Traceback (most recent call last):
  File "asyncio\tasks.py", line 239, in _step
  File 
"E:\Users\Elsword\Desktop\DecoraterBot\Async\resources\Dependencies\DecoraterBotCore\commands\botvoicecommands.py",
 line 257, in __load
self.voice = yield from self.bot.join_voice_channel(self.vchannel)
  File "discord\client.py", line 3166, in join_voice_channel
  File "asyncio\tasks.py", line 396, in wait_for
concurrent.futures._base.TimeoutError

@async
def __load(self):
"""
Makes bot able to join a voice channel when the commands are loaded.
"""
try:
vchannel_2 = 
str(self.botvoicechannel['Bot_Current_Voice_Channel'][0])
vmserver = str(self.botvoicechannel['Bot_Current_Voice_Channel'][1])
vmchannel = 
str(self.botvoicechannel['Bot_Current_Voice_Channel'][2])
self.voice_message_server_name = 
str(self.botvoicechannel['Bot_Current_Voice_Channel'][3])
self.vchannel_name = 
str(self.botvoicechannel['Bot_Current_Voice_Channel'][4])
self.vchannel = discord.Object(id=vchannel_2)
self.voice_message_server = discord.Object(id=vmserver)
self.voice_message_channel = discord.Object(id=vmchannel)
try:
self.voice = yield from 
self.bot.join_voice_channel(self.vchannel)
self.verror = False
except discord.errors.ConnectionClosed:
pass
except discord.errors.InvalidArgument:
self.voice_message_server_name = None
self.vchannel_name = None
self.vchannel = None
self.voice_message_server = None
self.voice_message_channel = None
self.voice = None
self.verror = True
except BotErrors.CommandTimeoutError:
yield from self.bot.send_message(self.voice_message_channel,
 content=str(
 
self.bot.botmessages['reload_commands_voice_channels_bypass2'][0]))
self.voice_message_server_name = None
self.vchannel_name = None
self.vchannel = None
self.voice_message_server = None
self.voice_message_channel = None
self.voice = None
self.verror = True
except RuntimeError:
self.voice_message_server_name = None
self.vchannel_name = None
self.vchannel = None
self.voice_message_server = None
self.voice = None
self.verror = True
msgdata = 
str(self.bot.botmessages['reload_commands_voice_channels_bypass2'][1])
yield from self.bot.send_message(self.voice_message_channel, 
content=msgdata)
self.voice_message_channel = None
if self.verror is not True:
message_data = 
str(self.bot.botmessages['reload_commands_voice_channels_bypass2'][2]).format(
self.vchannel_name)
yield from self.bot.send_message(self.voice_message_channel, 
content=message_data)
except IndexError:
self.voice_message_server_name = None
self.vchannel_name = None
self.vchannel = None
self.voice_message_server = None
self.voice_message_channel = None
self.voice = None
except discord.errors.ClientException:
pass  # already in a voice channel so lots not set those values to 
None.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28836] Throw concurrent.futures.TimeoutError instead of concurrent.futures.__base.TimeoutError

2016-11-29 Thread Decorater

Decorater added the comment:

I handle concurrent.futures.TimeoutError on my coroutine that is fired with 
create_task yet it sitll don't handle it though... so it still is a issue

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28836] Throw concurrent.futures.TimeoutError instead of concurrent.futures.__base.TimeoutError

2016-11-29 Thread Guido van Rossum

Guido van Rossum added the comment:

concurrent.futures.TimeoutError and concurrent.futures.__base.TimeoutError are 
the same class. So there is nothing to do here.

--
resolution:  -> rejected
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28836] Throw concurrent.futures.TimeoutError instead of concurrent.futures.__base.TimeoutError

2016-11-29 Thread Decorater

New submission from Decorater:

So, concurrent.futures.TimeoutError subclasses 
concurrent.futures.__base.TimeoutError. Why not have asyncio throw that instead 
of the __base class for Timeout Error?

There is a huge issue with this for starters for those know knows this they 
cannot handle it easily without having to use that private class in the Error 
handler which is totally unclean practice.

It is also unclean to raise that exception in asyncio at least change it to 
concurrent.futures.TimeoutError or asyncio.TimeoutError.

This change would be much beneficial for projects that has to handle as many 
exceptions as possible to tell the end user that an exception happens custom 
based on what was thrown.

With this it could benefit everyone who use the parts of asyncio that can throw 
such exceptions.

I hope you guys would agree with my idea to clean up the parts of asyncio that 
throws these as it becomes tricky if people don't like to use private functions 
of another python code file in the standard library in their code or even as 
little as possible.

It happens in python versions from 3.4 to 3.5.2 and can get annoying.

--
components: Library (Lib), asyncio
messages: 282057
nosy: Decorater, gvanrossum, yselivanov
priority: normal
severity: normal
status: open
title: Throw concurrent.futures.TimeoutError instead of 
concurrent.futures.__base.TimeoutError
versions: Python 3.6, Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: correct way to catch exception with Python 'with' statement

2016-11-29 Thread Matt Wheeler
On Tue, 29 Nov 2016 at 23:59  wrote:

> If you want to do something only if the file exists (or does not), use
> os.path.isfile(filename)
>

This opens you up to a potential race condition (and has potential security
implications, depending on the application), as you're using LBYL[0].
If you want to write robust code, you'll need to catch the
FileNotFoundError anyway, so unless you're doing many* file lookups and
expecting a large number of them* to not exist, you're probably better off
with EAFP[1] unless you're really sure (i.e. you've followed the 3 rules of
performance optimisation[2])


*I'm being quite vague here as you'd have to actually profile the
application to work out which way is quicker and if the difference is worth
worrying about.
Catching the exception in theory might be more expensive, but that cost
might be insignificant compared to the IO cost which you'll have either way.

[0] https://docs.python.org/2/glossary.html#term-lbyl
[1] https://docs.python.org/2/glossary.html#term-eafp
[2] http://wiki.c2.com/?RulesOfOptimization
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python while loop

2016-11-29 Thread BartC

On 29/11/2016 23:58, paul.garcia2...@gmail.com wrote:

Write a program which prints the sum of numbers from 1 to 101 ( 1 and 101 are 
included) that are divisible by 5 (Use while loop)

This is the code:

x=0
count=0
while x<=100:
if x%5==0:
count=count+x
x=x+1
print(count)


This looks at numbers from 0 to 100 inclusive, not 1 to 101. Although it 
doesn't affect the result. (It will add in 0 which is divisible by 5, 
but that doesn't change it either. If this is an exercise however, 
checking the correct range might be important!)


--
Bartc
--
https://mail.python.org/mailman/listinfo/python-list


Re: Python while loop

2016-11-29 Thread MRAB

On 2016-11-29 23:58, paul.garcia2...@gmail.com wrote:

Write a program which prints the sum of numbers from 1 to 101 ( 1 and 101 are 
included) that are divisible by 5 (Use while loop)

This is the code:

x=0
count=0
while x<=100:
if x%5==0:
count=count+x
x=x+1
print(count)


Question: How does python know what count means ? I see that its declared. What i wanna 
know is how does it know the iteration or each number it finds divisible by 5 is the 
"Count" ??


It doesn't, it's just a name, and, anyway, in the code, 'x' is the count...

If it _did_ know (which is doesn't), wouldn't it be complaining that 
'count' isn't the count but the sum? :-)


--
https://mail.python.org/mailman/listinfo/python-list


[issue28835] Change in behavior when overriding warnings.showwarning and with catch_warnings(record=True)

2016-11-29 Thread Thomas Robitaille

New submission from Thomas Robitaille:

In Python 3.5, the following code:

import warnings

def deal_with_warning(*args, **kwargs):
print("warning emitted")

with warnings.catch_warnings(record=True):
warnings.showwarning = deal_with_warning
warnings.warn("This is a warning")

results in "warning emitted" being printed to the terminal.

In Python 3.6 however (at least in 3.6b1), nothing is printed, meaning that 
``deal_with_warning`` is not getting called. I bisected the CPython history and 
tracked it down to the changes in this issue:

https://bugs.python.org/issue26568

However it doesn't look like this was an intentional change in behavior, since 
it says in the description of that issue:

"For backward compatibility, warnings.showmsg() calls warnings.showwarning() if 
warnings.showwarning() was replaced. Same for warnings.formatmsg(): call 
warnings.formatwarning() if replaced."

So I believe this is a bug? (since backward-compatibility is not preserved). If 
not, should the change in behavior be mentioned in the changelog?

--
messages: 282056
nosy: Thomas.Robitaille
priority: normal
severity: normal
status: open
title: Change in behavior when overriding warnings.showwarning and with 
catch_warnings(record=True)
versions: Python 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26363] __builtins__ propagation is misleading described in exec and eval documentation

2016-11-29 Thread Xavier Combelle

Xavier Combelle added the comment:

It is not the dictionary of builtin module, which is inserted in , but the 
current __builtin__ global which happen to be normally the dictionnary of 
builtin. Hence in the following code, the builtins propagation works has 
expected.

>>> eval("""eval('spam("hello 
>>> world")',{})""",{"__builtins__":{"eval":eval,"spam":print}})
hello world

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: correct way to catch exception with Python 'with' statement

2016-11-29 Thread woooee
If you want to do something only if the file exists (or does not), use 
os.path.isfile(filename)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: csv into multiple columns using split function using python

2016-11-29 Thread woooee
Add some print statements to see what is happening, especially after the for 
elem in mylist1: statement
-- 
https://mail.python.org/mailman/listinfo/python-list


Python while loop

2016-11-29 Thread paul . garcia2345
Write a program which prints the sum of numbers from 1 to 101 ( 1 and 101 are 
included) that are divisible by 5 (Use while loop)

This is the code: 

x=0
count=0
while x<=100:
if x%5==0:
count=count+x
x=x+1
print(count)


Question: How does python know what count means ? I see that its declared. What 
i wanna know is how does it know the iteration or each number it finds 
divisible by 5 is the "Count" ??
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue20215] socketserver.TCPServer can not listen IPv6 address

2016-11-29 Thread Jan Pokorný

Changes by Jan Pokorný :


--
nosy: +jpokorny

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28427] WeakValueDictionary next bug (with multithreading)

2016-11-29 Thread Antoine Pitrou

Antoine Pitrou added the comment:

(or we bite the bullet and add a C helper function for the atomic 
test-and-delete thing)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28427] WeakValueDictionary next bug (with multithreading)

2016-11-29 Thread Antoine Pitrou

Antoine Pitrou added the comment:

One possibility would be to always delay removals (always put them in 
_pending_removals).
We would then have to enforce removals from time to time, but synchronously.

--
nosy: +pitrou, tim.peters

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Asyncio -- delayed calculation

2016-11-29 Thread Steve D'Aprano
On Wed, 30 Nov 2016 05:41 am, Ian Kelly wrote:

> You mean how do you create something that can be awaited that doesn't
> await something else in turn? With a Future.
> 
> import asyncio
> 
> class Awaitable(asyncio.Future):
>   def wake_up_later(self):
> asyncio.get_event_loop().call_later(3, self.set_result, 42)

Not to be confused with concurrent.Futures.

https://docs.python.org/3.5/library/concurrent.futures.html

https://docs.python.org/3.5/library/asyncio-task.html#asyncio.Future




-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: async enumeration - possible?

2016-11-29 Thread Steve D'Aprano
On Wed, 30 Nov 2016 07:07 am, Marko Rauhamaa wrote:

> Terry Reedy :
> 
>> On 11/29/2016 9:25 AM, Frank Millman wrote:
>>
>>> Is there any technical reason for this, or is it just that no-one has
>>> got around to writing an asynchronous version yet?
>>
>> Google's first hit for 'aenumerate' is
>>
https://pythonwise.blogspot.com/2015/11/aenumerate-enumerate-for-async-for.html
> 
> Ok, so how about:
> 
>aall(aiterable)
>aany(aiterable)
>class abytearray(aiterable[, encoding[, errors]])
[...]


What about them? What's your question?





-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: best way to read a huge ascii file.

2016-11-29 Thread Steve D'Aprano
On Wed, 30 Nov 2016 01:17 am, Heli wrote:

> The following line which reads the entire 7.4 GB file increments the
> memory usage by 3206.898 MiB (3.36 GB). First question is Why it does not
> increment the memory usage by 7.4 GB?
>
> f=np.loadtxt(os.path.join(dir,myfile),delimiter=None,skiprows=0)

Floating point numbers as strings typically take up far more space than do
floats. On disk, a string like "3.141592653589793" requires 13 bytes. Plus
there are additional bytes used as separators between fields, and at least
one more byte (a newline) at the end of each record. Whereas, once
converted to a float (a C 64-bit double) it only requires 8 bytes. In a
numpy array, there's no separator needed and the values are tightly packed.

So its quite reasonable to expect a saving of around 50%.

> The following 4 lines do not increment the memory at all.
> x=f[:,1]
> y=f[:,2]
> z=f[:,3]
> id=f[:,0]

Numpy slices are views, not copies.


> Finally I still would appreciate if you could recommend me what is the
> most optimized way to read/write to files in python? are numpy np.loadtxt
> and np.savetxt the best?

You're not just reading a file. You're reading a file and converting
millions of strings to floats.

You are processing 7GB of data in 80 minutes, or around 1.5MB per second. Do
you have reason to think that's unreasonably slow? (Apart from wishing that
it were faster.) Where are you reading the file from? How much RAM do you
have?



-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.

-- 
https://mail.python.org/mailman/listinfo/python-list


[issue15533] subprocess.Popen(cwd) documentation

2016-11-29 Thread Jan Lachnitt

Jan Lachnitt added the comment:

Thank Wolfgang Maier for reminding this issue and providing various details and 
observations. Having taken a look at my old comments (and at others' comments, 
too), I feel that the cwd issue deserves a clearer description.

Let's use the following simple C program as the callee:

#include 
#include 
int main(int argc, char* argv[]) {
char cwd[FILENAME_MAX+1];
for (int i = 0; i < argc; ++i)
printf("argv[%d] = %s\n", i, argv[i]);
getcwd(cwd, FILENAME_MAX);
printf("cwd = %s\n", cwd);
return 0;
}

As is evident, this program merely prints its arguments and working directory. 
I have built it using gcc, called it "print_argv+cwd", and placed it in the 
"subdir" subdirectory of the current directory.

Next, let's use the following Python 3 script for testing:

import os
from subprocess import run  # substitute run->call in Python < 3.5
prg_name = 'print_argv+cwd'
if os.name == 'nt':
prg_name += '.exe'
else:
prg_name = os.path.join('.',prg_name)
dir_name = 'subdir'
def execute(path, cwd):
print('Executing "{}" in "{}":'.format(path,cwd))
try:
run([path], cwd=cwd)  # substitute run->call in Python < 3.5
except Exception as err:
print(type(err).__qualname__+':', err)
print('Script\'s cwd =', os.getcwd())
execute(prg_name, dir_name)
execute(os.path.join(dir_name,prg_name), dir_name)
execute(os.path.abspath(os.path.join(dir_name,prg_name)), dir_name)

Output on Linux with Python 3.5.2:

Script's cwd = /home/jenda/Bug reports/Python/subprocess
Executing "./print_argv+cwd" in "subdir":
argv[0] = ./print_argv+cwd
cwd = /home/jenda/Bug reports/Python/subprocess/subdir
Executing "subdir/./print_argv+cwd" in "subdir":
FileNotFoundError: [Errno 2] No such file or directory: 
'subdir/./print_argv+cwd'
Executing "/home/jenda/Bug reports/Python/subprocess/subdir/print_argv+cwd" in 
"subdir":
argv[0] = /home/jenda/Bug reports/Python/subprocess/subdir/print_argv+cwd
cwd = /home/jenda/Bug reports/Python/subprocess/subdir

Output on Windows with Python 3.5.2:

Script's cwd = C:\Users\Jenda\Bug reports\Python\subprocess
Executing "print_argv+cwd.exe" in "subdir":
FileNotFoundError: [WinError 2] Systém nemůže nalézt uvedený soubor
Executing "subdir\print_argv+cwd.exe" in "subdir":
argv[0] = subdir\print_argv+cwd.exe
cwd = C:\Users\Jenda\Bug reports\Python\subprocess\subdir
Executing "C:\Users\Jenda\Bug 
reports\Python\subprocess\subdir\print_argv+cwd.exe" in "subdir":
argv[0] = C:\Users\Jenda\Bug reports\Python\subprocess\subdir\print_argv+cwd.exe
cwd = C:\Users\Jenda\Bug reports\Python\subprocess\subdir

Summary: On Linux, subprocess.run (or call or Popen) behaves correctly, in 
accordance with current documentation. On Windows, both possible relative paths 
produce incorrect results. With the first one, relative to "subdir", Python 
fails to find the executable. With the other one, relative to the script's cwd, 
Python actually executes the program, but argv[0] is inconsistent with cwd. 
Imagine that the called program wants to resolve its own path: It joins cwd and 
argv[0] and gets "C:\Users\Jenda\Bug 
reports\Python\subprocess\subdir\subdir\print_argv+cwd.exe", which is an 
incorrect (and nonexistent) path. This is why the cwd issue is not just a 
documentation issue.

The only option working correctly on Windows is the last one, using absolute 
path of the executable.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26861] shutil.copyfile() doesn't close the opened files

2016-11-29 Thread Josh Rosenberg

Josh Rosenberg added the comment:

Agreed. 2.7 source is definitely using with: 
https://hg.python.org/cpython/file/2.7/Lib/shutil.py#l82

--
nosy: +josh.r
status: pending -> open

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15533] subprocess.Popen(cwd) documentation

2016-11-29 Thread Wolfgang Maier

Wolfgang Maier added the comment:

Just found issue15451, which reports a similar inconsistency between Windows 
and POSIX for 'PATH' provided through the Popen env parameter as for cwd. It 
seems that, on POSIX-platforms, the PATH environment variable passed through 
env affects the executable lookup if executable does *not* contain a dirname, 
but on Windows the new PATH never affects executable lookup. So, again, 
relative executable paths are causing platform-specific behavior.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28754] Argument Clinic for bisect.bisect_left

2016-11-29 Thread Martin Panter

Martin Panter added the comment:

If adding proper support for hi=None, maybe lo=None should also be supported. 
Also, I would think the main Doc/library/bisect.rst documentation needs 
updating, and a test and What’s New entry added.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24339] iso6937 encoding missing

2016-11-29 Thread John Helour

John Helour added the comment:

> Please also check whether it's not possible to reuse the charmap codec 
> functions we have
 I've found nothing useful, maybe you (as the author) can find something really 
useful which can improve code readability or increase the performance.

Please look at the newest codec version, particularly on line:

tmp += bytearray(encoding_map[c], 'latin1', 'ignore')

It is about extended ascii inheritance. Is it reliable and fast enough?

--
Added file: http://bugs.python.org/file45697/iso6937.py

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28795] Misleading stating, that SIGINT handler is installed by default

2016-11-29 Thread Julien Palard

Changes by Julien Palard :


Added file: http://bugs.python.org/file45696/issue28795-2.7.diff

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28795] Misleading stating, that SIGINT handler is installed by default

2016-11-29 Thread Julien Palard

Julien Palard added the comment:

Proposed as patches but english is not my native language so please review 
carefully.

--
keywords: +patch
Added file: http://bugs.python.org/file45695/issue28795-tip.diff

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25750] tp_descr_get(self, obj, type) is called without owning a reference to "self"

2016-11-29 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
assignee:  -> serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27142] Default int value with xmlrpclib / xmlrpc.client

2016-11-29 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

This format doesn't conform the XML-RPC specification. Adding the support of it 
is a new feature. The question is whether there is a need of this feature. Are 
there some common XML-RPC servers or clients that produce such format?

--
type: behavior -> enhancement
versions: +Python 3.7 -Python 2.7, Python 3.4

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28820] Typo in section 6 of the Python 3.4 documentation

2016-11-29 Thread R. David Murray

R. David Murray added the comment:

We at least used to point to Apple's style guide.  I'm not sure where we point 
at the moment (it's in the documentation somewhere :).  But yes, it's pretty 
much formal American English, though I'm sure there are places where other 
spelling has crept in.

--
nosy: +r.david.murray

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28833] cross compilation of third-party extension modules

2016-11-29 Thread Xavier de Gaye

Changes by Xavier de Gaye :


--
nosy: +Chi Hsuan Yen

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28833] cross compilation of third-party extension modules

2016-11-29 Thread Xavier de Gaye

Xavier de Gaye added the comment:

> This approach will not work with a "multiarch" enabled environment, and break 
> cross builds on Debian and Ubuntu.

No, the patch does not break cross builds on Debian and Ubuntu, unless you can 
demonstrate it does.

> Afaics, the proposal assumes that the python executable for the target 
> architecture is installed (which it is not for the multiarch cross-build 
> layout), and that each target architecture has to be identified by it's own 
> directory tree (again, not in the multiarch environment, you can install 
> multiple targets into the same path).

No, you are mistaken, the path name of the build tree may be used to cross 
build third-party extension modules as stated in case a) of msg281993, and this 
should also work with debian. BTW the same code is run to cross build a 
standard library extension module and a third-party extension module, and 
obviously python is not yet installed by the time the standard library 
extension modules are built ;-)

> The idea here is to use the platform identifier which we already had in the 
> trunk before the PLATDIR was removed (the multiarch id or if not defined the 
> platform). So by having a  specifier, you could deduce a path, or a 
> -python-config executable and you're done. No need to know about a 
> path directly.  Of course python cross builds would have to install the 
> -python-config executable or symlink.

It is not clear why, because debian has this multiarch design, this should 
constrain our build system to follow their paradigm. After all, debian has 
already found some ways to cross-build the extension modules for their 
supported multiarch platforms since it is not possible, as of today, with 
upstream CPython.

> Minor issue: please s/xbuild/cross_build/.

Agreed.

> > * The sysconfigdata file name was terminated with a dangling
> >   underscore when 'multiarch' is not defined.
> 
> That only solves part of the problem in that the kernel/os version gets 
> encoded as well, e.g. gnukfreebsd9, gnukfreebsd10, which is nasty when the 
> version of your runtime and build time kernel differ.

No idea what is the problem you are refering to. It cannot be the "dangling 
underscore" problem since this is a cosmetic issue. Please explain.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28820] Typo in section 6 of the Python 3.4 documentation

2016-11-29 Thread Josh Rosenberg

Josh Rosenberg added the comment:

Just OOC, what version of English are the docs supposed to use? In American 
English, noun vs. verb doesn't matter, it's always "practice" (there is no such 
word as "practise").

In this case it doesn't matter (it's a noun, and everyone agrees on the 
spelling), but is there a defined standard?

--
nosy: +josh.r

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26861] shutil.copyfile() doesn't close the opened files

2016-11-29 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

As I see, shutil.copyfile() uses the "with" statements and closes files just 
after copying.

--
status: open -> pending

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28754] Argument Clinic for bisect.bisect_left

2016-11-29 Thread Stefan Krah

Stefan Krah added the comment:

Signature and docstring can be done manually with very little effort.
Currently METH_FASTCALL is AC only, but I hope that will change.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28833] cross compilation of third-party extension modules

2016-11-29 Thread Barry A. Warsaw

Changes by Barry A. Warsaw :


--
nosy: +barry

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28834] Type checking in set comparisons.

2016-11-29 Thread nyoshimizu

nyoshimizu added the comment:

I see. Sorry & thanks!

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: async enumeration - possible?

2016-11-29 Thread Marko Rauhamaa
Terry Reedy :

> On 11/29/2016 9:25 AM, Frank Millman wrote:
>
>> Is there any technical reason for this, or is it just that no-one has
>> got around to writing an asynchronous version yet?
>
> Google's first hit for 'aenumerate' is
> https://pythonwise.blogspot.com/2015/11/aenumerate-enumerate-for-async-for.html

Ok, so how about:

   aall(aiterable)
   aany(aiterable)
   class abytearray(aiterable[, encoding[, errors]])
   class adict(aiterable, **kwarg)
   class afilter(coro, aiterable)
   class afrozenset(aiterable)
   aiter(object[, sentinel])
   class alist(aiterable)
   amap(coro, aiterable, ...)
   amax(aiterable, *[, key, default])
   amin(aiterable, *[, key, default])
   anext(aiterator[, default])
   class aset(aiterable)
   asorted(aiterable[, key][, reverse])
   asum(aiterable[, start])
   atuple(aiterable)
   azip(*aiterables)

to name a few...

How about awaitable comprehensions?


Marko
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue28834] Type checking in set comparisons.

2016-11-29 Thread SilentGhost

SilentGhost added the comment:

You seem to be misunderstanding how the intersection/union/etc are supposed to 
be used:

>>> ab = {'a', 'b'}
>>> ab.intersection('bc')
{'b'}

Using set.intersection (where set is a built-in class, rather than an instance 
thereof) requires the first argument to be set (which is the actual instance of 
set class). This is no different from usage of any other class / object across 
Python, however, it is highly uncommon.

--
nosy: +SilentGhost
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28754] Argument Clinic for bisect.bisect_left

2016-11-29 Thread STINNER Victor

STINNER Victor added the comment:

Stefan Krah added the comment:
> Julien, the syntax converters look pretty clever.  Do we need AC
> everywhere though?

Please see previous comments for advantages of AC (signature object,
docstring, speed).

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24015] timeit should start with 1 loop, not 10

2016-11-29 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

That was implemented in issue28240.

$ time ./python -m timeit "import time; time.sleep(1.0)"
1 loop, best of 5: 1 sec per loop

real0m6.176s
user0m0.160s
sys 0m0.004s

--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Enhance the timeit module: display average +- std dev instead 
of minimum

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28834] Type checking in set comparisons.

2016-11-29 Thread nyoshimizu

New submission from nyoshimizu:

The non-operator versions of set comparisons (intersection(), union(), etc.) 
exhibit
inconsistent type checking. They only check the first input before deciding 
whether or not to raise a TypeError exception. 

Therefore, it's possible to pass a set first, then other objects (e.g. lists, 
dicts, tuples) and a correct 'intersection' is returned (apparently by ignoring 
ordering and using the keys in dicts). I've attached demonstrative example for 
Python 3.5, although Python 2.7 appears to exhibit the same behavior.

I'm not sure what the intended behavior was (whether or not to require sets). 
8.7.1 Set Objects states: "Note, the non-operator versions of union(), 
intersection(), difference(), and symmetric_difference() will accept any 
iterable as an argument."

Note that #8743 and #17626 appear to confirm that the operator versions should 
not accept non-sets and matches the observed behavior. As the latter issue 
points out, it's documented -- again in 8.7.1 -- that "...their operator based 
counterparts require their arguments to be sets." 

Is this behavior necessary but just not documented? The documentation states 
that "This precludes error-prone constructions like Set('abc') & 'cbs' in favor 
of the more readable Set('abc').intersection('cbs')." In the second example, a 
first set is needed to do the intersection, then 'cbs' gets typecast into a set 
(although I guess so was 'abc'). Then should the first inputs also be typecast 
as sets?

--
files: test_comparison.py
messages: 282036
nosy: nyoshimizu
priority: normal
severity: normal
status: open
title: Type checking in set comparisons.
type: behavior
versions: Python 2.7, Python 3.5
Added file: http://bugs.python.org/file45694/test_comparison.py

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: async enumeration - possible?

2016-11-29 Thread Terry Reedy

On 11/29/2016 9:25 AM, Frank Millman wrote:


Is there any technical reason for this, or is it just that no-one has
got around to writing an asynchronous version yet?


Google's first hit for 'aenumerate' is
https://pythonwise.blogspot.com/2015/11/aenumerate-enumerate-for-async-for.html

Note that updated 3.5.2+ code is in response to my comment.

--
Terry Jan Reedy

--
https://mail.python.org/mailman/listinfo/python-list


[issue28791] update sqlite to 3.15.2

2016-11-29 Thread Ned Deily

Ned Deily added the comment:

Yes, we're not going to change library versions for the 3.6.0 installers at 
this point.  Upgrade for 3.7.0 is fine and possibly for a 3.6.x maintenance 
release if warranted.  I suggest holding off on any patches until we're closer 
to those releases as there may be subsequent SQLite updates.

--
stage:  -> needs patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



csv into multiple columns using split function using python

2016-11-29 Thread handar94
I am trying to split a specific column of csv into multiple column and then 
appending the split values at the end of each row.

`enter code here`

import csv
fOpen1=open('Meta_D1.txt')

reader=csv.reader(fOpen1)
mylist=[elem[1].split(',') for elem in reader]
mylist1=[]

for elem in mylist1:
mylist1.append(elem)


#writing to a csv file
with open('out1.csv', 'wb') as fp:
myf = csv.writer(fp, delimiter=',')
myf.writerows(mylist1)

---
Here is the link to file I am working on 2 column. 
https://spaces.hightail.com/space/4hFTj

Can someone guide me further?

-- 
https://mail.python.org/mailman/listinfo/python-list


[issue28790] Error when using Generic and __slots__

2016-11-29 Thread Ned Deily

Changes by Ned Deily :


--
stage: commit review -> resolved

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20612] cElementTree has problems with StringIO object containing unicode content

2016-11-29 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
status: open -> pending

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22039] PyObject_SetAttr doesn't mention value = NULL

2016-11-29 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +martin.panter

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21818] cookielib documentation references Cookie module, not cookielib.Cookie class

2016-11-29 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thus the only way to fix links is to specify full names? Does 
docs_class_links-2.7.patch look good to you?

--
stage:  -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25658] PyThread assumes pthread_key_t is an integer, which is against POSIX

2016-11-29 Thread Masayuki Yamamoto

Masayuki Yamamoto added the comment:

Elik, Ed,

I have overlooked tracemalloc module raises deadlock if apply the patch.
I found out a source comment on Modules/_tracemalloc.c:161

/* If your OS does not provide native thread local storage, you can implement
   it manually using a lock. Functions of thread.c cannot be used because
   they use PyMem_RawMalloc() which leads to a reentrant call. */
#if !(defined(_POSIX_THREADS) || defined(NT_THREADS))
#  error "need native thread local storage (TLS)"
#endif

Py_HAVE_NATIVE_TLS is used only on thread source code. Therefore C Compiler 
couldn't report error about tracemalloc. I'm sorry that I didn't check test.
Currently I'm trying to implement new API based on msg281227.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28208] update sqlite to 3.14.2

2016-11-29 Thread Big Stone

Big Stone added the comment:

As far as I test, the novelties from 0.15.2 don't break any API (just nice 
SQL-syntax sugar), and correct some old 3.8.0 bugs.

and ".2" is the same level of stabilisation as current "0.14.2"

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11145] '%o' % user-defined instance

2016-11-29 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I read the code multiple times but still don't see any issues with the last 
path. If anybody know issues with it, please point on them. Otherwise I'll 
commit the patch.

--
assignee:  -> serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28754] Argument Clinic for bisect.bisect_left

2016-11-29 Thread Stefan Krah

Stefan Krah added the comment:

Julien, the syntax converters look pretty clever.  Do we need AC
everywhere though?  I wonder (once again) if this is really more
readable than the existing code.

--
nosy: +skrah

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24469] Py2.x int free list can grow without bounds

2016-11-29 Thread Roundup Robot

Roundup Robot added the comment:

New changeset fd0842f34602 by Serhiy Storchaka in branch '2.7':
Issue #24469: Fixed memory leak caused by int subclasses without overridden
https://hg.python.org/cpython/rev/fd0842f34602

--
nosy: +python-dev

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24469] Py2.x int free list can grow without bounds

2016-11-29 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Asyncio -- delayed calculation

2016-11-29 Thread Ian Kelly
On Mon, Nov 28, 2016 at 10:42 PM, Chris Angelico  wrote:
> On Tue, Nov 29, 2016 at 4:13 PM, Paul Rubin  wrote:
>>
>> I haven't gotten my head around Python asyncio and have been wanting
>> to read this:
>>
>>http://lucumr.pocoo.org/2016/10/30/i-dont-understand-asyncio/
>
> It's talking a lot about how we got here, which isn't all necessary if
> you just want to give asyncio a whirl. The conclusion at the end says
> that you should just use 'async def' and not bother with all the older
> forms, which I agree with (subject to the usual caveat that this
> implies no support for older Pythons).
>
> There's one thing that I really struggle with, though, and that's that
> there's no easy and obvious way to demonstrate the lowest level of
> operation. If "await x()" is like "yield from x()", how do you do the
> innermost "yield" that actually does something? I have the same
> confusion with Node.js, too. It's as if async primitives can't be
> implemented in application code at all, they just have to be given to
> you. Certainly it's not something made clear anywhere in the docs that
> I've found.

You mean how do you create something that can be awaited that doesn't
await something else in turn? With a Future.

import asyncio

class Awaitable(asyncio.Future):
  def wake_up_later(self):
asyncio.get_event_loop().call_later(3, self.set_result, 42)

async def main():
  awaitable = Awaitable()
  awaitable.wake_up_later()
  print(await awaitable)

asyncio.get_event_loop().run_until_complete(main())

The trick is in arranging for the future's result to be set. For I/O
events you would typically do that by associating a callback with a
file descriptor on the event loop:

https://docs.python.org/3/library/asyncio-eventloop.html#watch-file-descriptors

If you need to do something particulary abstruse you can always write
a custom Selector or event loop:

https://docs.python.org/3/library/selectors.html#module-selectors
https://docs.python.org/3/library/asyncio-eventloop.html#base-event-loop
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue28754] Argument Clinic for bisect.bisect_left

2016-11-29 Thread Julien Palard

Julien Palard added the comment:

I tried myself at Argument Clinic custom converters to create the "optional 
ssize_t converter" and it works, so as advised by Raymond, pydoc now shows 
None, and the C implementation now allows for both default values None and -1, 
as the custom converter returns -1 for none.

--
Added file: http://bugs.python.org/file45693/issue28754-7.diff

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28663] Higher virtual memory usage on recent Linux versions

2016-11-29 Thread ProgVal

ProgVal added the comment:

Sorry. That's the result of |||get_traced_memory|on Python 3.5 and Linux
4.7.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28781] On Installation of 3.5 Python get error message

2016-11-29 Thread Steve Dower

Steve Dower added the comment:

That's only the most recent set, and all it shows is that the per-user install 
didn't help.

Do you have the earlier sets of install logs for the per-user install and 
uninstall? I'd like to see why those didn't have the effect I expected.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28790] Error when using Generic and __slots__

2016-11-29 Thread Guido van Rossum

Changes by Guido van Rossum :


--
resolution:  -> fixed
stage:  -> commit review
status: open -> closed
type:  -> behavior

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28790] Error when using Generic and __slots__

2016-11-29 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 0bbd29405c9d by Guido van Rossum in branch '3.5':
Issue #28790: Fix error when using Generic and __slots__ (Ivan L)
https://hg.python.org/cpython/rev/0bbd29405c9d

New changeset 2dd08b5b5ee6 by Guido van Rossum in branch '3.6':
Issue #28790: Fix error when using Generic and __slots__ (Ivan L) (3.5->3.6)
https://hg.python.org/cpython/rev/2dd08b5b5ee6

New changeset b9915ca4b3da by Guido van Rossum in branch 'default':
Issue #28790: Fix error when using Generic and __slots__ (Ivan L) (3.6->3.7)
https://hg.python.org/cpython/rev/b9915ca4b3da

--
nosy: +python-dev

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25658] PyThread assumes pthread_key_t is an integer, which is against POSIX

2016-11-29 Thread Ed Schouten

Ed Schouten added the comment:

Looks good to me!

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28790] Error when using Generic and __slots__

2016-11-29 Thread Guido van Rossum

Guido van Rossum added the comment:

OK, having thought about it some more, given that you don't seem to object too 
strenuously, I'm going to merge the fix. May it be the last one!

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28208] update sqlite to 3.14.2

2016-11-29 Thread Mariatta Wijaya

Mariatta Wijaya added the comment:

sqlite 3.15.2 was just released.
I can prepare a patch if that's what we want.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: best way to read a huge ascii file.

2016-11-29 Thread BartC

On 29/11/2016 14:17, Heli wrote:

Hi all,

Let me update my question, I have an ascii file(7G) which has around 100M 
lines.  I read this file using :

f=np.loadtxt(os.path.join(dir,myfile),delimiter=None,skiprows=0)

x=f[:,1]
y=f[:,2]
z=f[:,3]
id=f[:,0]

I will need the x,y,z and id arrays later for interpolations. The problem is 
reading the file takes around 80 min while the interpolation only takes 15 mins.

I tried to get the memory increment used by each line of the script using 
python memory_profiler module.

The following line which reads the entire 7.4 GB file increments the memory 
usage by 3206.898 MiB (3.36 GB). First question is Why it does not increment 
the memory usage by 7.4 GB?


Is there enough total RAM capacity for another 4.2GB?

But if the file is text, and being read into binary data in memory, it 
will be different. Usually binary data takes less space. I assume the 
loader doesn't load the entire text file first, do the conversions to 
binary, then unloads file, as that would then require 10.6GB during that 
process!



f=np.loadtxt(os.path.join(dir,myfile),delimiter=None,skiprows=0)

The following 4 lines do not increment the memory at all.
x=f[:,1]
y=f[:,2]
z=f[:,3]
id=f[:,0]


That's surprising because if those are slices, they would normally 
create a copy (I suppose you don't set f to 0 or something after those 
lines). But if numpy data is involved, I seem to remember that slices 
are actually views into the data.



Finally I still would appreciate if you could recommend me what is the most 
optimized way to read/write to files in python? are numpy np.loadtxt and 
np.savetxt the best?


Why not post a sample couple of lines from the file? (We don't need the 
other 99,999,998 assuming they are all have the same format.) Then we 
can see if there's anything obviously inefficient about it.


--
Bartc
--
https://mail.python.org/mailman/listinfo/python-list


[issue28822] Fix indices handling in PyUnicode_FindChar

2016-11-29 Thread Xiang Zhang

Xiang Zhang added the comment:

> Remaining question: what is the behaviour for direction=0, direction=100 or 
> direction=-2? Maybe we can add a few unit tests for strange values of 
> direction? (Not sure if it's worth it.)

It's not documented so I also doubt it. Expect Serhiy's comment.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28791] update sqlite to 3.15.2

2016-11-29 Thread Mariatta Wijaya

Changes by Mariatta Wijaya :


--
components: +Installation, Windows, macOS
nosy: +ned.deily, paul.moore, ronaldoussoren, steve.dower, tim.golden, zach.ware

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26273] Expose TCP_CONGESTION and TCP_USER_TIMEOUT to the socket module

2016-11-29 Thread STINNER Victor

STINNER Victor added the comment:

Serhiy Storchaka: "Shouldn't we add something like versionadded/versionchanged 
or a mentioning in What's New?"

Oh right, we did that for other new constants added to Python 3.6 like 
SO_DOMAIN.

Attached socket_doc.patch documents the additional of the two new constants. It 
seems like "hg transplant" putted the NEWS entry in the wrong section :-/ The 
patch also fixes that.

--
Added file: http://bugs.python.org/file45692/socket_doc.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26273] Expose TCP_CONGESTION and TCP_USER_TIMEOUT to the socket module

2016-11-29 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 6d69da76be6a by Victor Stinner in branch '3.6':
Add TCP_CONGESTION and TCP_USER_TIMEOUT
https://hg.python.org/cpython/rev/6d69da76be6a

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28832] Reduce memset in dict creation

2016-11-29 Thread STINNER Victor

STINNER Victor added the comment:

You might experiment Python_Calloc().

I'm not sure that this allocator is well optimized (especially the pymalloc 
allocator) :-/ Last time I played with it, it was slower, especially for 
allocations smaller than 1 MB.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28822] Fix indices handling in PyUnicode_FindChar

2016-11-29 Thread STINNER Victor

STINNER Victor added the comment:

PyUnicode_FindChar-v2.patch LGTM with a minor comment on the review, but I 
would prefer that Serhiy also reviews it ;-)

Remaining question: what is the behaviour for direction=0, direction=100 or 
direction=-2? Maybe we can add a few unit tests for strange values of 
direction? (Not sure if it's worth it.)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26273] Expose TCP_CONGESTION and TCP_USER_TIMEOUT to the socket module

2016-11-29 Thread Ned Deily

Ned Deily added the comment:

OK for 3.6.0rc1 (before it times out)

--
stage: patch review -> commit review
versions: +Python 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28663] Higher virtual memory usage on recent Linux versions

2016-11-29 Thread STINNER Victor

STINNER Victor added the comment:

ProgVal: "(4350362, 4376669)" is it the same result on Python 3.4 and Python 
3.5? I don't understand your comment :-/ Can you please elaborate?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: best way to read a huge ascii file.

2016-11-29 Thread marco . nawijn
On Tuesday, November 29, 2016 at 3:18:29 PM UTC+1, Heli wrote:
> Hi all, 
> 
> Let me update my question, I have an ascii file(7G) which has around 100M 
> lines.  I read this file using : 
> 
> f=np.loadtxt(os.path.join(dir,myfile),delimiter=None,skiprows=0) 
> 
> x=f[:,1] 
> y=f[:,2] 
> z=f[:,3] 
> id=f[:,0] 
> 
> I will need the x,y,z and id arrays later for interpolations. The problem is 
> reading the file takes around 80 min while the interpolation only takes 15 
> mins.
> 
> I tried to get the memory increment used by each line of the script using 
> python memory_profiler module.
> 
> The following line which reads the entire 7.4 GB file increments the memory 
> usage by 3206.898 MiB (3.36 GB). First question is Why it does not increment 
> the memory usage by 7.4 GB?
> 
> f=np.loadtxt(os.path.join(dir,myfile),delimiter=None,skiprows=0) 
> 
> The following 4 lines do not increment the memory at all. 
> x=f[:,1] 
> y=f[:,2] 
> z=f[:,3] 
> id=f[:,0] 
> 
> Finally I still would appreciate if you could recommend me what is the most 
> optimized way to read/write to files in python? are numpy np.loadtxt and 
> np.savetxt the best?
> 
> Thanks in Advance,

Hi,

Have you considered storing the data in HDF5? There is an excellent Python
interface for this (see: http://www.h5py.org/). The advantage that you will
have is that no text to number conversion has to applied anymore. You can
directly operate on the datasets in the HDF5 database. 

If you would go this direction, the following would get you started:

>>> import h5py
>>> import numpy
>>> from numpy import uint32, float32, arange

>>> fd = h5py.File('demo.h5', mode='w') # Note that this will truncate
# the file, use 'r' or 'a' if you
# want to open an existing file
>>> observations = fd.create_group('/observations')
>>> N = 100 
>>> observations.create_dataset('id', data=arange(0, N, dtype=uint32))
>>> observations.create_dataset('x', data=numpy.random.random(N), dtype=float32)
>>> observations.create_dataset('y', data=numpy.random.random(N), dtype=float32)
>>> observations.create_dataset('z', data=numpy.random.random(N), dtype=float32)
>>> 
>>> fd.close()

Note that you can also combine x,y and z in a single dataset if you want to.
See the documentation for datasets for more information 
http://docs.h5py.org/en/latest/high/dataset.html

I would also advise you to carefully select the proper dtype for the arrays.
In particular if you know the value range for your datasets. This can save
you a lot of disk space and probably will increase the performance a little.

Marco
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue28832] Reduce memset in dict creation

2016-11-29 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I think that clearing 120 bytes at a time is faster than clear it later 
entry-by-entry.

Your patch removes some asserts, this looks not good.

Could your provide microbenchmarks that show the largest speed up and the 
largest slow down? So we would see what type of code gets the benefit.

--
nosy: +serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28663] Higher virtual memory usage on recent Linux versions

2016-11-29 Thread ProgVal

ProgVal added the comment:

(4350362, 4376669)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26273] Expose TCP_CONGESTION and TCP_USER_TIMEOUT to the socket module

2016-11-29 Thread Yury Selivanov

Yury Selivanov added the comment:

Would be nice to have in 3.6.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26273] Expose TCP_CONGESTION and TCP_USER_TIMEOUT to the socket module

2016-11-29 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Shouldn't we add something like versionadded/versionchanged or a mentioning in 
What's New?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28832] Reduce memset in dict creation

2016-11-29 Thread STINNER Victor

STINNER Victor added the comment:

Can you please attached the two JSON files, compressed with gzip (.gz files). 
perf is also to read gzipped JSON.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28663] Higher virtual memory usage on recent Linux versions

2016-11-29 Thread STINNER Victor

STINNER Victor added the comment:

rlimit_tracemalloc.txt: Oh, my idea was only to see the total,
https://docs.python.org/dev/library/tracemalloc.html#tracemalloc.get_traced_memory

Current and peak memory usage.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: async enumeration - possible?

2016-11-29 Thread Ian Kelly
On Tue, Nov 29, 2016 at 7:25 AM, Frank Millman  wrote:
> However, it does not allow you to enumerate over the generator output -
>
 async def main():
>
> ...   c = counter(5)
> ...   async for j, k in enumerate(c):
> ... print(j, k)
> ...   print('done')
> ...

 loop.run_until_complete(main())
>
> Traceback (most recent call last):
>  File "", line 1, in 
>  File
> "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\asyncio\base_events.py",
> line 466, in run_until_complete
>return future.result()
> TypeError: 'async_generator' object is not iterable


>
> Is there any technical reason for this, or is it just that no-one has got
> around to writing an asynchronous version yet?

No one has written an async enumerate afaik. You may be interested in
the aitertools package in PyPI:

https://pypi.python.org/pypi/aitertools/0.1.0

It also doesn't have an async enumerate. It does have an aiter
function that can wrap an ordinary iterable into an async iterable, so
one way to write that would be aiter(enumerate(c)), with the caveat
that the wrapped iterator is still running synchronously.

Otherwise, you can write one yourself. This doesn't support all the
features of enumerate, but it serves as demonstration:

from itertools import count

async def aenumerate(aiterable):
counter = count()
async for x in aiterable:
 yield next(counter), x
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue26273] Expose TCP_CONGESTION and TCP_USER_TIMEOUT to the socket module

2016-11-29 Thread Omar Sandoval

Omar Sandoval added the comment:

Glad to see this finally get in :)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28663] Higher virtual memory usage on recent Linux versions

2016-11-29 Thread STINNER Victor

STINNER Victor added the comment:

It's very hard to estimate the water high-mark for memory because the memory 
includes different things: read-only memory, mmap() on files, read-only memory 
pages shared between multiple processes for libraries, etc.

I suggest to use the tracemalloc module to have a better idea of the memory 
usage of the memory directly allocated by Python.

--
nosy: +haypo

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28832] Reduce memset in dict creation

2016-11-29 Thread INADA Naoki

INADA Naoki added the comment:

$ ./python-default -m perf compare_to default.json patched.json  -G
Slower (2):
- xml_etree_iterparse: 328 ms +- 26 ms -> 350 ms +- 29 ms: 1.07x slower
- fannkuch: 1.58 sec +- 0.09 sec -> 1.65 sec +- 0.09 sec: 1.05x slower

Faster (9):
- scimark_sor: 870 ms +- 59 ms -> 800 ms +- 54 ms: 1.09x faster
- deltablue: 28.0 ms +- 2.1 ms -> 26.4 ms +- 1.6 ms: 1.06x faster
- regex_dna: 423 ms +- 26 ms -> 399 ms +- 26 ms: 1.06x faster
- scimark_sparse_mat_mult: 13.9 ms +- 1.0 ms -> 13.2 ms +- 0.9 ms: 1.06x faster
- raytrace: 2.16 sec +- 0.12 sec -> 2.07 sec +- 0.11 sec: 1.05x faster
- unpickle_pure_python: 1.36 ms +- 0.11 ms -> 1.31 ms +- 0.07 ms: 1.04x faster
- pickle_dict: 103 us +- 11 us -> 99.7 us +- 7.7 us: 1.03x faster
- scimark_monte_carlo: 408 ms +- 35 ms -> 397 ms +- 25 ms: 1.03x faster
- scimark_lu: 765 ms +- 49 ms -> 746 ms +- 55 ms: 1.03x faster

Benchmark hidden because not significant (53): 2to3, call_method, 
call_method_slots, call_method_unknown, call_simple, chameleon, chaos, 
crypto_pyaes, django_template, dulwich_log, float, genshi_text, gen
shi_xml, go, hexiom, html5lib, json_dumps, json_loads, logging_format, 
logging_silent, logging_simple, mako, meteor_contest, nbody, nqueens, pathlib, 
pickle, pickle_list, pickle_pure_python, pidigits, pyt
hon_startup, python_startup_no_site, regex_compile, regex_effbot, regex_v8, 
richards, scimark_fft, spectral_norm, sqlalchemy_declarative, 
sqlalchemy_imperative, sqlite_synth, sympy_expand, sympy_integrate
, sympy_str, sympy_sum, telco, tornado_http, unpack_sequence, unpickle, 
unpickle_list, xml_etree_generate, xml_etree_parse, xml_etree_process

--
nosy: +haypo

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26273] Expose TCP_CONGESTION and TCP_USER_TIMEOUT to the socket module

2016-11-29 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Le 29/11/2016 à 16:59, STINNER Victor a écrit :
> 
> TCP_USER_TIMEOUT is super useful!

It is :-)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26273] Expose TCP_CONGESTION and TCP_USER_TIMEOUT to the socket module

2016-11-29 Thread STINNER Victor

STINNER Victor added the comment:

Sorry, I missed this issue.

TCP_USER_TIMEOUT is super useful! It helps a lot to detect when a server is 
down, especially when using keep alive: at kernel level (TCP keepalive) or 
application level (ex: RabbitMQ heart beat).

Linux default timeout is more something like 15 minutes. A few years ago, it 
was longer than 2 days :-)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26273] Expose TCP_CONGESTION and TCP_USER_TIMEOUT to the socket module

2016-11-29 Thread STINNER Victor

STINNER Victor added the comment:

@Ned Deily: Would you be ok to add these two constants to Python 3.6? I cannot 
image any regression if 674fb9644eaa is backported to Python 3.6.

@Serhiy, Yury: Any opinion on the backport?

--
nosy: +haypo, ned.deily, serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26273] Expose TCP_CONGESTION and TCP_USER_TIMEOUT to the socket module

2016-11-29 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 674fb9644eaa by Victor Stinner in branch 'default':
Add TCP_CONGESTION and TCP_USER_TIMEOUT
https://hg.python.org/cpython/rev/674fb9644eaa

--
nosy: +python-dev

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28822] Fix indices handling in PyUnicode_FindChar

2016-11-29 Thread Xiang Zhang

Xiang Zhang added the comment:

Thanks for your reviews. :-)

v2 updated the test codes.

--
Added file: http://bugs.python.org/file45690/PyUnicode_FindChar-v2.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



  1   2   >