[issue28480] Compile error on Modules/socketmodule.c

2016-10-19 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 9316b4ebf3fa by Martin Panter in branch '3.6':
Issue #28480: Avoid label at end of compound statement --without-threads
https://hg.python.org/cpython/rev/9316b4ebf3fa

New changeset 7cb86d404866 by Martin Panter in branch '3.6':
Issue #28480: Adjust or skip tests if multithreading is disabled
https://hg.python.org/cpython/rev/7cb86d404866

New changeset 948cf38793ce by Martin Panter in branch 'default':
Issue #28480: Merge multithreading fixes from 3.6
https://hg.python.org/cpython/rev/948cf38793ce

--

___
Python tracker 

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



[issue28481] Weird string comparison bug

2016-10-19 Thread Eryk Sun

Eryk Sun added the comment:

Interning of strings is an implementation detail for the efficient storage of 
variable and attribute names. A string with ':' in it cannot be a variable or 
attribute name and thus is not interned. But you don't need to know which 
strings are interned or why they're interned because correct Python code should 
never compare strings by identity. Use an equality comparison, e.g. (var2 == 
':bb'). Generally identity comparisons are of limited use in Python, such as 
checking for a singleton object such as None.

--
nosy: +eryksun
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



[issue28482] test_typing fails if asyncio unavailable

2016-10-19 Thread Martin Panter

New submission from Martin Panter:

If you compile with “configure --without-threads”, various tests are already 
skipped because they rely on multithreading. However test_typing does not seem 
to handle this. It tries to import “asyncio”, which seems to depend on 
multithreading. I presume it is expected that asyncio requires multithreading, 
so perhaps the affected tests should be skipped in test_typing. Here is my 
attempt to skip them; please review.

--
components: Tests
files: st-typing.patch
keywords: patch
messages: 279013
nosy: gvanrossum, martin.panter
priority: normal
severity: normal
stage: patch review
status: open
title: test_typing fails if asyncio unavailable
type: behavior
versions: Python 3.5, Python 3.6, Python 3.7
Added file: http://bugs.python.org/file45147/st-typing.patch

___
Python tracker 

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



[issue28447] socket.getpeername() failure on broken TCP/IP connection

2016-10-19 Thread Georgey

Georgey added the comment:

The socket close accident is not caused by queue or calling handle_sock_error 
at all, it happened right after select error

After changing the Exception handling of main Thread:

except Exception as err:
print("error:"+str(err))
print(sock.getpeername())
mailbox.put( (("sock_err",sock), 'Server') )
continue
 
server_sock.close()


I also get the same type of error:


Traceback (most recent call last):
  File "C:\Users\user\Desktop\SelectWinServer.py", line 112, in 
data = sock.recv(BUFSIZ)
ConnectionResetError: [WinError 10054] connection forcibly close

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\user\Desktop\SelectWinServer.py", line 123, in 
print(sock.getpeername())
OSError: [WinError 10038] not a socket


--

___
Python tracker 

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



[issue28481] Weird string comparison bug

2016-10-19 Thread MinJae Kwon

New submission from MinJae Kwon:

I found bug i think about string comparison

> var1 = 'aa'
> var1 is 'aa' # This is True

But if the string literal has special chacter (e.g., colon), the comparison 
results in False

> var2 = ':bb'
> var2 is ':bb' # This is False

Check it please.

--
components: Unicode
messages: 279011
nosy: MinJae Kwon, ezio.melotti, haypo
priority: normal
severity: normal
status: open
title: Weird string comparison bug
type: behavior
versions: Python 2.7, Python 3.3, Python 3.4, Python 3.5, 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



[issue28480] Compile error on Modules/socketmodule.c

2016-10-19 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 17629dee23ca by Martin Panter in branch '2.7':
Issue #28480: Avoid label at end of compound statement --without-threads
https://hg.python.org/cpython/rev/17629dee23ca

--
nosy: +python-dev

___
Python tracker 

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



[issue28474] WinError(): Python int too large to convert to C long

2016-10-19 Thread Kelvin You

Kelvin You added the comment:

Here is the full list of windows error code:
https://msdn.microsoft.com/en-us/library/cc231196.aspx
You can see a lot of error codes is above 0x8000.

--

___
Python tracker 

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



[issue26240] Docstring of the subprocess module should be cleaned up

2016-10-19 Thread Martin Panter

Martin Panter added the comment:

.
I left some comments on the code review.

Also, I’m not sure about the links to the online documentation. We don’t do 
this for other modules as far as I know. The pydoc module and help() commands 
already add their own links, which can be configured via PYTHONDOCS.

--

___
Python tracker 

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



[issue28474] WinError(): Python int too large to convert to C long

2016-10-19 Thread Kelvin You

Kelvin You added the comment:

I report this issue because the function 
WlanScan(https://msdn.microsoft.com/zh-cn/library/windows/desktop/ms706783(v=vs.85).aspx)
 returns a error code 0x80342002 when the WLAN is disabled on Windows 10.  
ctypes.WinError() raise an exception of 'Python int too large to convert to C 
long' when handle this error code.

--

___
Python tracker 

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



[issue28474] WinError(): Python int too large to convert to C long

2016-10-19 Thread Josh Rosenberg

Josh Rosenberg added the comment:

You can't use I as a format code safely; it silently ignores/wraps overflow on 
the conversion, where i raises on overflow. The unsigned converters are 
basically useless for resilient code in 99% of cases.

I *think* I remember some private utility functions for doing this using O& 
though, not sure if they're available in callproc.c...

--
nosy: +josh.r

___
Python tracker 

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



[issue28447] socket.getpeername() failure on broken TCP/IP connection

2016-10-19 Thread Georgey

Georgey added the comment:

I have changed the code to report any error that occurs in receiving message,

and it reports: [WinError10054] An existing connection was forcibly closed by 
the remote host

Well, this error is the one we need to handle, right? A server need to deal 
with abrupt offlines of clients. Yes the romote host has dropped and connection 
has been broken, but that does not mean we cannot recall its address. 

If this is not a bug, I don't know what is a bug in socket module.

--
import socket
import select, time
import queue, threading

ISOTIMEFORMAT = '%Y-%m-%d %X'
BUFSIZ = 2048
TIMEOUT = 10
ADDR = ('', 15625)

SEG = "◎◎"
SEG_ = SEG.encode()

active_socks = []
socks2addr = {}


server_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server_sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) 
server_sock.bind(ADDR)
server_sock.listen(10)
active_socks.append(server_sock)

mailbox = queue.Queue()

#

def send(mail):   
mail_ = SEG_+ mail.encode()
##The SEG_ at the beginning can seperate messeges for recepient when 
internet busy

for sock in active_socks[1:]:
try:
sock.send(mail_)
except:
handle_sock_err(sock)

def handle_sock_err(sock): 
try:
addr_del = sock.getpeername() 
except:
addr_del = socks2addr[sock]


active_socks.remove(sock) 
socks2addr.pop(sock) 
sock.close()

send("OFFLIN"+str(addr_del) )

#
class Sender(threading.Thread):
#process 'mails' - save and send
def __init__(self, mailbox):
super().__init__()
self.queue = mailbox

def analyze(self, mail, fromwhere):
send( ' : '.join((fromwhere, mail)) )

def run(self):

while True:
msg, addr = mailbox.get()  ###
  
if msg[0] =="sock_err":
print("sock_err @ ", msg[1]) 
#alternative> print("sock_err @ " + repr( msg[1] ) )
#the alternaive command greatly reduces socket closing

handle_sock_err(msg[1])
continue 

self.analyze(msg, addr)

sender = Sender(mailbox)
sender.daemon = True
sender.start()

#
while True:
onlines = list(socks2addr.values()) 
print( '\n'+time.strftime(ISOTIMEFORMAT, time.localtime(time.time())) )
print( 'online: '+str(onlines))

read_sockets, write_sockets, error_sockets = 
select.select(active_socks,[],[],TIMEOUT)

for sock in read_sockets:
#New connection
if sock ==server_sock:
# New Client coming in
clisock, addr = server_sock.accept() 
ip = addr[0]

active_socks.append(clisock)
socks2addr[clisock] = addr
 
#Some incoming message from a client
else:
# Data recieved from client, process it
try:
data = sock.recv(BUFSIZ)
if data:
fromwhere = sock.getpeername()
mail_s = data.split(SEG_)   ##seperate messages
del mail_s[0]
for mail_ in mail_s:
mail = mail_.decode()
print("recv>"+ mail)
   
except Exception as err:
print( "SOCKET ERROR: "+str(err) )
mailbox.put( (("sock_err",sock), 'Server') )
continue
 
server_sock.close()
  

==

--
resolution: not a bug -> wont fix
status: closed -> open

___
Python tracker 

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



[issue28480] Compile error on Modules/socketmodule.c

2016-10-19 Thread Masayuki Yamamoto

Masayuki Yamamoto added the comment:

Oh, that's enough to work, Martin.
I confirmed too.

--

___
Python tracker 

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



[issue28480] Compile error on Modules/socketmodule.c

2016-10-19 Thread Martin Panter

Martin Panter added the comment:

Thanks for the report and patch. I think an empty statement might be better 
than the dummy assignment. Let me know if the following would work and I will 
commit it:

   done:
+;  /* necessary for --without-threads flag */
 Py_END_ALLOW_THREADS

--
nosy: +martin.panter
stage:  -> patch review

___
Python tracker 

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



[issue28447] socket.getpeername() failure on broken TCP/IP connection

2016-10-19 Thread Martin Panter

Martin Panter added the comment:

When I run your program on Linux (natively, and I also tried Wine), the worst 
behaviour I get is a busy loop as soon as a client shuts down the connection 
and recv() returns an empty string. I would have to force an exception in the 
top level code to trigger the rest of the code.

Anyway, my theory is your socket is closed in a previous handle_sock_err() 
call. Your KeyError from socks2addr is further evidence of this. I suggest to 
look at why handle_sock_err() is being called, what exceptions are being 
handled, where they were raised, what the contents and size of “mailbox” is, 
etc.

I suggest you go elsewhere for general help with Python programming (e.g. the 
python-list mailing list), unless it actually looks like a bug in Python.

--
resolution: remind -> not a bug
status: open -> closed
type: crash -> behavior

___
Python tracker 

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



[issue28480] Compile error on Modules/socketmodule.c

2016-10-19 Thread Masayuki Yamamoto

New submission from Masayuki Yamamoto:

_socket module has failed to compile with --without-threads flag since 
554fb699af8c, because Py_END_ALLOW_THREADS macro exists behind the done label ( 
Modules/socketmodule.c:666 ).

If --without-threads flag goes on, Py_END_ALLOW_THREADS macro replaces to just 
right curly bracket. Therefore, between label and end of block have no 
statements. There needs meaningless statement (e.g. result = result;) to avoid 
compile error.
I wrote a one line patch as a test.

--
components: Build, Extension Modules
files: socketmodule-behind-label.patch
keywords: patch
messages: 279000
nosy: masamoto
priority: normal
severity: normal
status: open
title: Compile error on Modules/socketmodule.c
type: compile error
versions: Python 3.6, Python 3.7
Added file: http://bugs.python.org/file45146/socketmodule-behind-label.patch

___
Python tracker 

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



[issue28444] Missing extensions modules when cross compiling python 3.5.2 for arm on Linux

2016-10-19 Thread Martin Panter

Martin Panter added the comment:

Your second patch looks better, given my limited understanding of the scripts 
involved. :) I left one more suggestion though.

--

___
Python tracker 

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



[issue28479] Missing indentation in using/windows.rst

2016-10-19 Thread STINNER Victor

STINNER Victor added the comment:

Thanks for your contribution Julien.

--
nosy: +haypo

___
Python tracker 

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



[issue28479] Missing indentation in using/windows.rst

2016-10-19 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 39ac5093bdbb by Victor Stinner in branch '3.6':
Close #28479: Fix reST syntax in windows.rst
https://hg.python.org/cpython/rev/39ac5093bdbb

--
nosy: +python-dev
resolution:  -> fixed
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



[issue28479] Missing indentation in using/windows.rst

2016-10-19 Thread Julien

New submission from Julien:

Hi,

In https://docs.python.org/3.7/using/windows.html, right before 
https://docs.python.org/3.7/using/windows.html#additional-modules, the "Changed 
in version 3.6:" content lacks an indentation.

It look like it's nothing, but it breaks the PDF generation, by generating 
invalid latex.

I attached the simple patch to fix this, and tested it, it's now rendered with 
the correct indentation and the PDF builds successfully.

A grep -A10 -r 'versionchanged::$' show no other problems of indentation on 
those blocks (and shows this is the right way to fix it).

--
assignee: docs@python
components: Documentation
files: using_windows_versionchanged.patch
keywords: patch
messages: 278996
nosy: docs@python, sizeof
priority: normal
severity: normal
status: open
title: Missing indentation in using/windows.rst
type: enhancement
versions: Python 3.6, Python 3.7
Added file: http://bugs.python.org/file45145/using_windows_versionchanged.patch

___
Python tracker 

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



[issue22431] Change format of test runner output

2016-10-19 Thread Jon Dufresne

Changes by Jon Dufresne :


--
nosy: +jdufresne

___
Python tracker 

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



[issue20361] -W command line options and PYTHONWARNINGS environmental variable should not override -b / -bb command line options

2016-10-19 Thread Jon Dufresne

Changes by Jon Dufresne :


--
nosy: +jdufresne

___
Python tracker 

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



[issue1520879] make install change: Allow $DESTDIR to be relative

2016-10-19 Thread Douglas Greiman

Douglas Greiman added the comment:

Duplicate of http://bugs.python.org/issue11411

--

___
Python tracker 

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



[issue1520879] make install change: Allow $DESTDIR to be relative

2016-10-19 Thread Douglas Greiman

Changes by Douglas Greiman :


--
status: open -> closed

___
Python tracker 

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



[issue28478] Built-in module 'Time' does not enable functions if -Wno-error specified in the build environment

2016-10-19 Thread toast12

toast12 added the comment:

Excuse my typo. I meant -Werror and not -Wno-error

--

___
Python tracker 

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



[issue28478] Built-in module 'Time' does not enable functions if -Wno-error specified in the build environment

2016-10-19 Thread toast12

New submission from toast12:

Our build environment uses -Wno-error. However, this causes problems enabling 
all the functions in built-in module 'time':

configure:11130: checking for strftime
-
-
cc1: warnings being treated as errors
conftest.c:236: error: conflicting types for built-in function 'strftime'

Because strftime was not enabled, we had problems running xmlrpc.client:

>>> from xmlrpc import client 
Traceback (most recent call last):   File "", line 1, inFile 
"XXX/lib64/python3.5/xmlrpc/client.py", line 267, in  if 
_day0.strftime('%Y') == '0001':  # Mac OS X AttributeError: module 'time' 
has no attribute 'strftime' >>>

As a workaround, I am passing -fno-builtin now. But I believe this should be 
handled on the python end

--
components: Extension Modules
messages: 278993
nosy: toast12
priority: normal
severity: normal
status: open
title: Built-in module 'Time' does not enable functions if -Wno-error specified 
in the build environment
versions: Python 3.5

___
Python tracker 

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



[issue28475] Misleading error on random.sample when k < 0

2016-10-19 Thread Francisco Couzo

Changes by Francisco Couzo :


Added file: http://bugs.python.org/file45144/random_sample2.patch

___
Python tracker 

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



[issue28475] Misleading error on random.sample when k < 0

2016-10-19 Thread Raymond Hettinger

Raymond Hettinger added the comment:

I would rather revise the existing message to say that it cannot be negative or 
larger that population.

--

___
Python tracker 

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



[issue26685] Raise errors from socket.close()

2016-10-19 Thread Yury Selivanov

Yury Selivanov added the comment:

>> Would you mind to open an issue specific for asyncio?

> I'll open an issue on GH today to discuss with you/Guido/asyncio devs.

Guido, Victor, please take a look: https://github.com/python/asyncio/pull/449

--

___
Python tracker 

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



[issue28444] Missing extensions modules when cross compiling python 3.5.2 for arm on Linux

2016-10-19 Thread Xavier de Gaye

Xavier de Gaye added the comment:

Thanks for reviewing the patch Martin.

> Why do you remove the code that loops over Modules/Setup? Maybe is it 
> redundant with the other code for removing the already-built-in modules?

Yes because this is redundant, maybe not the case when this was written 15 
years ago.


> The logic matching MODOBJS doesn’t look super robust.

Agreed on both points.


> if you added Modules/Setup.config to the list of Setup files to process, 
> would that eliminate the need to look at both MODOBJS and 
> sys.builtin_module_names?

The processing of the Setup files done by setup.py is not robust either. It 
does not handle the lines of the form ' = '. The syntax described 
in Setup.dist allows for:
mod_form1 mod_form2 _mod_source.c
where both the 'mod_form1' and 'mod_form2' modules depend on the same source 
file and one would like to build them statically. makesetup handles that case 
while setup.py does not.
There is no guarantee that a change in the makesetup machinery would be 
systematically reflected in a change to setup.py. And indeed this is the case 
now - as you point it out - setup.py is currently missing the parsing of 
Setup.config.

Here is a new patch that uses the result of the parsing done by makesetup in 
setup.py.

--
Added file: http://bugs.python.org/file45143/removed_modules_2.patch

___
Python tracker 

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



[issue28477] Add optional user argument to pathlib.Path.home()

2016-10-19 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

pathlib.Path.home() don't support the user argument for reasons.

The main problem is that os.path.expanduser() for other users is faked on 
Windows. It uses guessing, and perhaps it returns correct result in most cases. 
But in non-standard situations, if current user or other users have non-default 
home directory, it returns wrong result. I don't know wherever it works for 
users with non-ascii names or names containing special characters.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue28477] Add optional user argument to pathlib.Path.home()

2016-10-19 Thread Josh Rosenberg

New submission from Josh Rosenberg:

os.path.expanduser supports both '~' and '~username` constructs to get home 
directories. It seems reasonable for pathlib.Path.home to default to getting 
the current user's home directory, but support passing an argument to get the 
home directory for another user. It means no need to use os.path.expanduser for 
the purpose (which always strikes me as a little "ugly" for portable code; the 
~ works, but it's using UNIX syntax in a way that makes it feel non-portable), 
making pathlib a more complete replacement.

--
components: Library (Lib)
messages: 278988
nosy: josh.r
priority: normal
severity: normal
status: open
title: Add optional user argument to pathlib.Path.home()
versions: Python 3.7

___
Python tracker 

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



[issue19795] Formatting of True/False/None in docs

2016-10-19 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thanks Zachary.

--

___
Python tracker 

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



[issue19795] Formatting of True/False/None in docs

2016-10-19 Thread Roundup Robot

Roundup Robot added the comment:

New changeset c445746d0846 by Serhiy Storchaka in branch '3.5':
Issue #19795: Fixed formatting a table.
https://hg.python.org/cpython/rev/c445746d0846

New changeset 3b554c9ea1c4 by Serhiy Storchaka in branch '3.6':
Issue #19795: Fixed formatting a table.
https://hg.python.org/cpython/rev/3b554c9ea1c4

New changeset 884c9d9159dc by Serhiy Storchaka in branch 'default':
Issue #19795: Fixed formatting a table.
https://hg.python.org/cpython/rev/884c9d9159dc

New changeset ddf32a646457 by Serhiy Storchaka in branch '2.7':
Issue #19795: Fixed formatting a table.
https://hg.python.org/cpython/rev/ddf32a646457

--

___
Python tracker 

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



[issue26685] Raise errors from socket.close()

2016-10-19 Thread Yury Selivanov

Yury Selivanov added the comment:

> Ah, you became reasonable :-D

Come on... :)

> Would you mind to open an issue specific for asyncio?

I'll open an issue on GH today to discuss with you/Guido/asyncio devs.

--

___
Python tracker 

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



[issue26685] Raise errors from socket.close()

2016-10-19 Thread STINNER Victor

STINNER Victor added the comment:

"After thinking about this problem for a while, I arrived to the conclusion 
that we need to fix asyncio."

Ah, you became reasonable :-D

"Essentially, when a user passes a socket object to the event loop API like 
'create_server', they give up the control of the socket to the loop.  The loop 
should detach the socket object and have a full control over it."

I don't know how asyncio should be modified exactly, but I agree that someone 
should change in asyncio. The question is more about how to reduce headache 
because of the backward compatibility and don't kill performances.

Would you mind to open an issue specific for asyncio?

--

___
Python tracker 

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



[issue26685] Raise errors from socket.close()

2016-10-19 Thread Yury Selivanov

Yury Selivanov added the comment:

After thinking about this problem for a while, I arrived to the conclusion that 
we need to fix asyncio.  Essentially, when a user passes a socket object to the 
event loop API like 'create_server', they give up the control of the socket to 
the loop.  The loop should detach the socket object and have a full control 
over it.

--
status: open -> closed

___
Python tracker 

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



[issue19795] Formatting of True/False/None in docs

2016-10-19 Thread Zachary Ware

Zachary Ware added the comment:

There's also an issue with a table in Doc/library/logging.rst, see 
http://buildbot.python.org/all/builders/Docs%203.x/builds/2675/steps/docbuild/logs/stdio

I'm not sure why that doesn't cause the build to fail, though, it's marked as 
an error.

--
nosy: +zach.ware

___
Python tracker 

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



[issue19795] Formatting of True/False/None in docs

2016-10-19 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you for noticing this Victor.

--

___
Python tracker 

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



[issue19795] Formatting of True/False/None in docs

2016-10-19 Thread Roundup Robot

Roundup Robot added the comment:

New changeset e4aa34a7ca53 by Serhiy Storchaka in branch '3.5':
Issue #19795: Improved more markups of True/False.
https://hg.python.org/cpython/rev/e4aa34a7ca53

New changeset dd7e48e3e5b0 by Serhiy Storchaka in branch '2.7':
Issue #19795: Improved more markups of True/False.
https://hg.python.org/cpython/rev/dd7e48e3e5b0

New changeset 7b143d6834cf by Serhiy Storchaka in branch '3.6':
Issue #19795: Improved more markups of True/False.
https://hg.python.org/cpython/rev/7b143d6834cf

New changeset 9fc0f20ea7de by Serhiy Storchaka in branch 'default':
Issue #19795: Improved more markups of True/False.
https://hg.python.org/cpython/rev/9fc0f20ea7de

--

___
Python tracker 

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



[issue19795] Formatting of True/False/None in docs

2016-10-19 Thread STINNER Victor

STINNER Victor added the comment:

Thanks, "build #1563 of Docs 3.5 is complete: Success [build successful]": the 
bot is happy again ;-)

--

___
Python tracker 

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



[issue19795] Formatting of True/False/None in docs

2016-10-19 Thread Fred L. Drake, Jr.

Fred L. Drake, Jr. added the comment:

Without the star would be right.  ReST does not support nested markup, and in 
this case, I don't think it would make sense anyway.

--
nosy: +fdrake

___
Python tracker 

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



[issue19795] Formatting of True/False/None in docs

2016-10-19 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 9ef78351d2e9 by Serhiy Storchaka in branch '3.5':
Issue #19795: Fixed markup errors.
https://hg.python.org/cpython/rev/9ef78351d2e9

New changeset 6c8a26e60728 by Serhiy Storchaka in branch '3.6':
Issue #19795: Fixed markup errors.
https://hg.python.org/cpython/rev/6c8a26e60728

New changeset 2127ef3b7660 by Serhiy Storchaka in branch 'default':
Issue #19795: Fixed markup errors.
https://hg.python.org/cpython/rev/2127ef3b7660

--

___
Python tracker 

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



[issue26568] Add a new warnings.showwarnmsg() function taking a warnings.WarningMessage object

2016-10-19 Thread Sebastian Berg

Sebastian Berg added the comment:

To make warning testing saner, in numpy we added basically my own version of 
catch_warnings on steroids, which needed/will need changing because of this.

Unless I missed it somewhere, this change should maybe put into the release 
notes to warn make it a bit easier to track down what is going on.

--
nosy: +seberg

___
Python tracker 

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



[issue19795] Formatting of True/False/None in docs

2016-10-19 Thread STINNER Victor

STINNER Victor added the comment:

The "Docs" bot doesn't like your change:

http://buildbot.python.org/all/builders/Docs%203.x/builds/2673/steps/suspicious/logs/stdio


WARNING: [whatsnew/3.1:549] "`" found in "``False``"


WARNING: [whatsnew/3.4:163] "`" found in "to ``None`"
WARNING: [whatsnew/3.4:163] "`" found in " during finalization 
` ("
/buildbot/buildarea/3.x.ware-docs/build/Doc/whatsnew/3.4.rst:163: WARNING: 
undefined label: module globals are no longer set to ``none` (if the link has 
no caption the label must precede a section header)

Extract of the change:

-  protocol 3.  Another solution is to set the *fix_imports* option to 
**False**.
+  protocol 3.  Another solution is to set the *fix_imports* option to 
*``False``*.


I guess that it should ``False`` without star?

--
nosy: +haypo

___
Python tracker 

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



[issue28240] Enhance the timeit module: display average +- std dev instead of minimum

2016-10-19 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 4e4d4e9183f5 by Victor Stinner in branch 'default':
Issue #28240: Fix formatting of the warning.
https://hg.python.org/cpython/rev/4e4d4e9183f5

--

___
Python tracker 

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



[issue19795] Formatting of True/False/None in docs

2016-10-19 Thread Roundup Robot

Roundup Robot added the comment:

New changeset cef2373f31bb by Serhiy Storchaka in branch '2.7':
Issue #19795: Mark up None as literal text.
https://hg.python.org/cpython/rev/cef2373f31bb

New changeset a8d5b433bb36 by Serhiy Storchaka in branch '3.5':
Issue #19795: Mark up None as literal text.
https://hg.python.org/cpython/rev/a8d5b433bb36

New changeset 2e97ed8e7e3c by Serhiy Storchaka in branch '3.6':
Issue #19795: Mark up None as literal text.
https://hg.python.org/cpython/rev/2e97ed8e7e3c

New changeset 5f997b3cb59c by Serhiy Storchaka in branch 'default':
Issue #19795: Mark up None as literal text.
https://hg.python.org/cpython/rev/5f997b3cb59c

New changeset b7df6c09ddf9 by Serhiy Storchaka in branch '2.7':
Issue #19795: Mark up True and False as literal text instead of bold.
https://hg.python.org/cpython/rev/b7df6c09ddf9

New changeset 477a82ec81fc by Serhiy Storchaka in branch '3.5':
Issue #19795: Mark up True and False as literal text instead of bold.
https://hg.python.org/cpython/rev/477a82ec81fc

New changeset 91992ea3c6b1 by Serhiy Storchaka in branch '3.6':
Issue #19795: Mark up True and False as literal text instead of bold.
https://hg.python.org/cpython/rev/91992ea3c6b1

New changeset 8cc9ad294ea9 by Serhiy Storchaka in branch 'default':
Issue #19795: Mark up True and False as literal text instead of bold.
https://hg.python.org/cpython/rev/8cc9ad294ea9

--

___
Python tracker 

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



[issue28473] mailbox.MH crashes on certain Claws Mail .mh_sequences files

2016-10-19 Thread R. David Murray

R. David Murray added the comment:

I meant 'nmh'.  Also, if the problem is that mailbox blows up on an 
.mh_sequences file with bad records and doesn't provide any way to access the 
valid records (like nmh mostly manages to do), then that is something that 
could be fixed, and we can reopen the issue.

--
versions: +Python 3.6, Python 3.7 -Python 3.5

___
Python tracker 

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



[issue28447] socket.getpeername() failure on broken TCP/IP connection

2016-10-19 Thread Georgey

Georgey added the comment:

so when do you think the error socket closes?

--

___
Python tracker 

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



[issue28447] socket.getpeername() failure on broken TCP/IP connection

2016-10-19 Thread Martin Panter

Martin Panter added the comment:

I haven’t tried running your program, but I don’t see anything stopping 
multiple references to the same socket appearing in the “mailbox” queue. Once 
the first reference has been processed, the socket will be closed, so 
subsequent getpeername() calls will be invalid.

--

___
Python tracker 

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



[issue26944] test_posix: Android 'id -G' is entirely wrong or missing the effective gid

2016-10-19 Thread Xavier de Gaye

Changes by Xavier de Gaye :


--
resolution:  -> fixed
stage: commit 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



[issue26944] test_posix: Android 'id -G' is entirely wrong or missing the effective gid

2016-10-19 Thread Roundup Robot

Roundup Robot added the comment:

New changeset fb3e65aff225 by Xavier de Gaye in branch '3.6':
Issue #26944: Fix test_posix for Android where 'id -G' is entirely wrong
https://hg.python.org/cpython/rev/fb3e65aff225

New changeset 465c09937e85 by Xavier de Gaye in branch 'default':
Issue #26944: Merge with 3.6.
https://hg.python.org/cpython/rev/465c09937e85

--
nosy: +python-dev

___
Python tracker 

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



[issue28447] socket.getpeername() failure on broken TCP/IP connection

2016-10-19 Thread Georgey

Georgey added the comment:

As your request, I simplify the server here:
--
import socket
import select, time
import queue, threading

ISOTIMEFORMAT = '%Y-%m-%d %X'
BUFSIZ = 2048
TIMEOUT = 10
ADDR = ('', 15625)

SEG = "◎◎"
SEG_ = SEG.encode()

active_socks = []
socks2addr = {}


server_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server_sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) 
server_sock.bind(ADDR)
server_sock.listen(10)
active_socks.append(server_sock)

mailbox = queue.Queue()

#

def send(mail):   
mail_ = SEG_+ mail.encode()
##The SEG_ at the beginning can seperate messeges for recepient when 
internet busy

for sock in active_socks[1:]:
try:
sock.send(mail_)
except:
handle_sock_err(sock)

def handle_sock_err(sock): 
try:
addr_del = sock.getpeername() 
except:
addr_del = socks2addr[sock]


active_socks.remove(sock) 
socks2addr.pop(sock) 
sock.close()

send("OFFLIN"+str(addr_del) )

#
class Sender(threading.Thread):
#process 'mails' - save and send
def __init__(self, mailbox):
super().__init__()
self.queue = mailbox

def analyze(self, mail, fromwhere):
send( ' : '.join((fromwhere, mail)) )

def run(self):

while True:
msg, addr = mailbox.get()  ###
  
if msg[0] =="sock_err":
print("sock_err @ ", msg[1]) 
#alternative> print("sock_err @ " + repr( msg[1] ) )
#the alternaive command greatly reduces socket closing

handle_sock_err(msg[1])
continue 

self.analyze(msg, addr)

sender = Sender(mailbox)
sender.daemon = True
sender.start()

#
while True:
onlines = list(socks2addr.values()) 
print( '\n'+time.strftime(ISOTIMEFORMAT, time.localtime(time.time())) )
print( 'online: '+str(onlines))

read_sockets, write_sockets, error_sockets = 
select.select(active_socks,[],[],TIMEOUT)

for sock in read_sockets:
#New connection
if sock ==server_sock:
# New Client coming in
clisock, addr = server_sock.accept() 
ip = addr[0]

active_socks.append(clisock)
socks2addr[clisock] = addr
 
#Some incoming message from a client
else:
# Data recieved from client, process it
try:
data = sock.recv(BUFSIZ)
if data:
fromwhere = sock.getpeername()
mail_s = data.split(SEG_)   ##seperate messages
del mail_s[0]
for mail_ in mail_s:
mail = mail_.decode()
print("recv>"+ mail)
   
except:
mailbox.put( (("sock_err",sock), 'Server') )
continue
 
server_sock.close()
  

==

The client side can be anything that tries to connect the server.
The original server has a bulletin function that basically echoes every message 
from any client to all clients. But you can ignore this function and limit the 
client from just connecting to this server and do nothing before close.

I find the error again:
--
sock_err @ 

Exception in thread Thread-1:
Traceback (most recent call last):
  File "C:/Users/user/Desktop/SelectWinServer.py", line 39, in handle_sock_err
addr_del = sock.getpeername()
OSError: [WinError 10038] 

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Python34\lib\threading.py", line 911, in _bootstrap_inner
self.run()
  File "C:/Users/user/Desktop/SelectWinServer.py", line 67, in run
handle_sock_err(msg[1])
  File "C:/Users/user/Desktop/SelectWinServer.py", line 41, in handle_sock_err
addr_del = socks2addr[sock]
KeyError: 
=

It seems that "socks2addr" has little help when socket is closed and 
"getpeername()" fails - it will fail too.

However, I do find that altering

print("sock_err @ ", msg[1])
to
print("sock_err @ " + repr( msg[1] ) )

can reduce socket closing. Don't understand why and how important it is. 

BTW, on Windows 7 or Windows 10.

--

___
Python tracker 

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



[issue23188] Provide a C helper function to chain raised (but not yet caught) exceptions

2016-10-19 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

This helper is convenient in many cases, but it is very limited. It raises an 
exception with single string argument. It doesn't work in cases when the 
exception doesn't take arguments (PyErr_SetNone) or takes multiple or 
non-string arguments (PyErr_SetFromErrnoWithFilenameObject, 
PyErr_SetImportError). I think for public API we need more general solution. 
Something like this:

PyObject *cause = get_current_exception();
PyErr_SetImportError(msg, name, path);
set_cause_of_current_exception(cause);

--

___
Python tracker 

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



[issue28476] Remove redundant definition of factorial on test_random

2016-10-19 Thread STINNER Victor

STINNER Victor added the comment:

Thanks for your contribution Francisco.

test_random still pass. I pushed your safe and well contained patch. It don't 
see any good reason why test_random had its own pure (and slow) Python 
implementation of factorial(), it's probably because test_random.py was written 
before math.factorial() was added (Python 2.6).

--
nosy: +haypo

___
Python tracker 

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



[issue28476] Remove redundant definition of factorial on test_random

2016-10-19 Thread Roundup Robot

New submission from Roundup Robot:

New changeset c6588a7443a4 by Victor Stinner in branch 'default':
Close #28476: Reuse math.factorial() in test_random
https://hg.python.org/cpython/rev/c6588a7443a4

--
nosy: +python-dev
resolution:  -> fixed
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



[issue26944] test_posix: Android 'id -G' is entirely wrong or missing the effective gid

2016-10-19 Thread Xavier de Gaye

Changes by Xavier de Gaye :


--
title: android: test_posix fails -> test_posix: Android 'id -G' is entirely 
wrong or missing the effective gid

___
Python tracker 

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



[issue28476] Remove redundant definition of factorial on test_random

2016-10-19 Thread Francisco Couzo

Changes by Francisco Couzo :


--
components: Tests
files: test_random.patch
keywords: patch
nosy: franciscouzo
priority: normal
severity: normal
status: open
title: Remove redundant definition of factorial on test_random
Added file: http://bugs.python.org/file45142/test_random.patch

___
Python tracker 

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



[issue26944] android: test_posix fails

2016-10-19 Thread Xavier de Gaye

Changes by Xavier de Gaye :


--
dependencies:  -add the 'is_android' attribute to test.support

___
Python tracker 

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



[issue25731] Assigning and deleting __new__ attr on the class does not allow to create instances of this class

2016-10-19 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
resolution: fixed -> 
stage: resolved -> 
versions: +Python 3.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



[issue28474] WinError(): Python int too large to convert to C long

2016-10-19 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
components: +Windows
nosy: +amaury.forgeotdarc, belopolsky, meador.inge, paul.moore, steve.dower, 
tim.golden, zach.ware
type: crash -> behavior
versions: +Python 3.7 -Python 3.3, Python 3.4

___
Python tracker 

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



[issue28475] Misleading error on random.sample when k < 0

2016-10-19 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
assignee: docs@python -> rhettinger
components:  -Tests
nosy: +mark.dickinson, rhettinger
stage:  -> patch review
type:  -> behavior
versions: +Python 2.7, Python 3.5, 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



[issue28475] Misleading error on random.sample when k < 0

2016-10-19 Thread Francisco Couzo

New submission from Francisco Couzo:

Improved a bit the error message when k < 0, and also added a comment about it 
on the documentation and an additional test case.

--
assignee: docs@python
components: Documentation, Library (Lib), Tests
files: random_sample.patch
keywords: patch
messages: 278964
nosy: docs@python, franciscouzo
priority: normal
severity: normal
status: open
title: Misleading error on random.sample when k < 0
Added file: http://bugs.python.org/file45141/random_sample.patch

___
Python tracker 

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



[issue28474] WinError(): Python int too large to convert to C long

2016-10-19 Thread Kelvin You

New submission from Kelvin You:

// callproc.c
static PyObject *format_error(PyObject *self, PyObject *args)
{
PyObject *result;
wchar_t *lpMsgBuf;
DWORD code = 0;
if (!PyArg_ParseTuple(args, "|i:FormatError", &code))  
  ^ Here the format string should be 
"|I:FormatError"
return NULL;
if (code == 0)
code = GetLastError();
lpMsgBuf = FormatError(code);
if (lpMsgBuf) {
result = PyUnicode_FromWideChar(lpMsgBuf, wcslen(lpMsgBuf));
LocalFree(lpMsgBuf);
} else {
result = PyUnicode_FromString("");
}
return result;
}

--
components: ctypes
messages: 278963
nosy: Kelvin You
priority: normal
severity: normal
status: open
title: WinError(): Python int too large to convert to C long
type: crash
versions: Python 2.7, Python 3.3, Python 3.4, Python 3.5, Python 3.6

___
Python tracker 

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



[issue25731] Assigning and deleting __new__ attr on the class does not allow to create instances of this class

2016-10-19 Thread Bohuslav "Slavek" Kabrda

Bohuslav "Slavek" Kabrda added the comment:

Hi all, it seems to me that this change has been reverted not only in 2.7, but 
also in 3.5 (changeset: 101549:c8df1877d1bc). Benjamin, was this intentional? 
If so, perhaps this issue should be reopened and not marked as resolved.

Thanks a lot!

--

___
Python tracker 

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