Re: Awful code of the week

2016-08-08 Thread Chris Angelico
On Tue, Aug 9, 2016 at 3:20 PM, Steven D'Aprano
 wrote:
>> def process(self, stuff):
>> files = self.files
>> files = [] # to save memory
>> files = self.files
>> for file in files:
>> file.process(stuff)
>> return 1
>
> def process(self, stuff):
> try:
> files = self.files
> del files  # to save memory
> files = []  # just to be sure
> files = self.files
> for file in files:
> file.process(stuff)
> return 1
> finally:
> del files
> del file
> del stuff
> del self  # this has to come last
>
>
> You can't be too careful with memory management.

Right. Of course, it gets very onerous, so we tend to use a context
manager instead.

def process(self, stuff):
with deallocate() as cleanup:
cleanup(self)
cleanup(stuff)
files = self.files
cleanup(files)
del files
files = []
cleanup(files)
files = self.files
cleanup(files)
for file in files:
cleanup(file)
file.process(stuff)
return 1

There, isn't that so much better?

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


Re: Awful code of the week

2016-08-08 Thread Steven D'Aprano
On Tuesday 09 August 2016 13:59, Chris Angelico wrote:

> On Tue, Aug 9, 2016 at 1:46 PM, Rick Johnson
>  wrote:
>> On Sunday, August 7, 2016 at 1:54:51 AM UTC-5, Steven D'Aprano wrote:
>>> Seen in the office IRC channel:
>>>
>>>
>>> (13:23:07) fred: near_limit = []
>>> (13:23:07) fred: near_limit.append(1)
>>> (13:23:07) fred: near_limit = len(near_limit)
>>> (13:23:09) fred: WTF
>>
>> Sure, this code smells of nauseous superfluity, but what
>> comes after these three lines? Is this _all_ there is? Or
>> are these three lines merely the initial setup stage for a
>> complex looping algorithm? Cherry picking a few lines from a
>> script and then judging them "unworthy", would not be a
>> fair. We should never attempt to purposely mimic the abysmal
>> state of justice in the USA.
> 
> I agree. There's nothing wrong with that code. I routinely have
> constructs like this:
> 
> def register(self, obj):
> self.files.append(obj)
> return None
> return None # just in case
> return None

That's buggy. It should be:

def register(self, obj):
self.files.append(obj)
return None and None or None
return None # just in case
return None

That way you're protected in case the boolean value of None is ever changed.



> def process(self, stuff):
> files = self.files
> files = [] # to save memory
> files = self.files
> for file in files:
> file.process(stuff)
> return 1

def process(self, stuff):
try:
files = self.files
del files  # to save memory
files = []  # just to be sure
files = self.files
for file in files:
file.process(stuff)
return 1
finally:
del files
del file
del stuff
del self  # this has to come last


You can't be too careful with memory management.




-- 
Steve

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


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

2016-08-08 Thread Gregory P. Smith

Gregory P. Smith added the comment:

Probably just Amaury and I forgetting that existed.  Amaury, 
inspect.isdatadescriptor's implementation is a bit different than this change's 
_is_data_descriptor.  Thoughts?

--
stage: resolved -> commit review

___
Python tracker 

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



[issue27181] Add geometric mean to `statistics` module

2016-08-08 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 9eb5edfcf604 by Steven D'Aprano in branch 'default':
Issue27181 add geometric mean.
https://hg.python.org/cpython/rev/9eb5edfcf604

--
nosy: +python-dev

___
Python tracker 

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



[issue27701] [posixmodule] [Refactoring patch] Simply call into *at() functions unconditionally when present

2016-08-08 Thread Alex Willmer

Changes by Alex Willmer :


--
nosy: +Alex.Willmer

___
Python tracker 

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



[issue27703] Replace two Py_XDECREFs with Py_DECREFs in do_raise

2016-08-08 Thread Antti Haapala

Antti Haapala added the comment:

No, I was just trying to explain why your change could be considered beneficial.

--

___
Python tracker 

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



Re: Awful code of the week

2016-08-08 Thread Chris Angelico
On Tue, Aug 9, 2016 at 1:46 PM, Rick Johnson
 wrote:
> On Sunday, August 7, 2016 at 1:54:51 AM UTC-5, Steven D'Aprano wrote:
>> Seen in the office IRC channel:
>>
>>
>> (13:23:07) fred: near_limit = []
>> (13:23:07) fred: near_limit.append(1)
>> (13:23:07) fred: near_limit = len(near_limit)
>> (13:23:09) fred: WTF
>
> Sure, this code smells of nauseous superfluity, but what
> comes after these three lines? Is this _all_ there is? Or
> are these three lines merely the initial setup stage for a
> complex looping algorithm? Cherry picking a few lines from a
> script and then judging them "unworthy", would not be a
> fair. We should never attempt to purposely mimic the abysmal
> state of justice in the USA.

I agree. There's nothing wrong with that code. I routinely have
constructs like this:

def register(self, obj):
self.files.append(obj)
return None
return None # just in case
return None

def process(self, stuff):
files = self.files
files = [] # to save memory
files = self.files
for file in files:
file.process(stuff)
return 1

It's perfectly good code, and Fred was flat out wrong to say "WTF" about this.

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


Re: Awful code of the week

2016-08-08 Thread Rick Johnson
On Sunday, August 7, 2016 at 1:54:51 AM UTC-5, Steven D'Aprano wrote:
> Seen in the office IRC channel:
> 
> 
> (13:23:07) fred: near_limit = []
> (13:23:07) fred: near_limit.append(1)
> (13:23:07) fred: near_limit = len(near_limit)
> (13:23:09) fred: WTF

Sure, this code smells of nauseous superfluity, but what
comes after these three lines? Is this _all_ there is? Or
are these three lines merely the initial setup stage for a
complex looping algorithm? Cherry picking a few lines from a
script and then judging them "unworthy", would not be a
fair. We should never attempt to purposely mimic the abysmal
state of justice in the USA.

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


[issue27715] call-matcher breaks if a method is mocked with spec=True

2016-08-08 Thread Carl Meyer

Carl Meyer added the comment:

`hg clean --all` resolved the compilation issues; confirmed that 
https://hg.python.org/cpython/rev/b888c9043566/ is at fault.

Also, the exception trace I provided above looks wrong; it must be from when I 
was messing about with `autospec=True` or passing in the instance. The actual 
trace from the sample code in the original report  has no mention of the 
instance:

```
TypeError: missing a required argument: 'x'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "../mock-method.example.py", line 11, in 
mock_bar.assert_called_once_with(7)
  File "/home/carljm/projects/python/cpython/Lib/unittest/mock.py", line 822, 
in assert_called_once_with
return self.assert_called_with(*args, **kwargs)
  File "/home/carljm/projects/python/cpython/Lib/unittest/mock.py", line 811, 
in assert_called_with
raise AssertionError(_error_message()) from cause
AssertionError: Expected call: bar(7)
Actual call: bar(7)

```

--

___
Python tracker 

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



[issue27715] call-matcher breaks if a method is mocked with spec=True

2016-08-08 Thread Carl Meyer

Changes by Carl Meyer :


Removed file: http://bugs.python.org/file44054/mock-method.example.py

___
Python tracker 

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



[issue27715] call-matcher breaks if a method is mocked with spec=True

2016-08-08 Thread Carl Meyer

Carl Meyer added the comment:

It seems likely that this regression originated with 
https://hg.python.org/cpython/rev/b888c9043566/ (can't confirm via bisection as 
the commits around that time fail to compile for me).

--
nosy: +michael.foord, pitrou

___
Python tracker 

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



[issue27715] call-matcher breaks if a method is mocked with spec=True

2016-08-08 Thread Carl Meyer

Carl Meyer added the comment:

(This bug is also present in Python 3.4.4.)

--
type:  -> crash
versions: +Python 3.4

___
Python tracker 

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



[issue27715] call-matcher breaks if a method is mocked with spec=True

2016-08-08 Thread Carl Meyer

New submission from Carl Meyer:

When constructing call-matchers to match expected vs actual calls, if 
`spec=True` was used when patching a function, mock attempts to bind the 
recorded (and expected) call args to the function signature. But if a method 
was mocked, the signature includes `self` and the recorded call args don't. 
This can easily lead to a `TypeError`:

```
from unittest.mock import patch

class Foo:
def bar(self, x):
return x

with patch.object(Foo, 'bar', spec=True) as mock_bar:
f = Foo()
f.bar(7)

mock_bar.assert_called_once_with(7)

```

The above code worked in mock 1.0, but fails in Python 3.5 and 3.6 tip with 
this error:

```
TypeError: missing a required argument: 'x'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "../mock-method.example.py", line 11, in 
mock_bar.assert_called_once_with(7)
  File "/home/carljm/projects/python/cpython/Lib/unittest/mock.py", line 203, 
in assert_called_once_with
return mock.assert_called_once_with(*args, **kwargs)
  File "/home/carljm/projects/python/cpython/Lib/unittest/mock.py", line 822, 
in assert_called_once_with
return self.assert_called_with(*args, **kwargs)
  File "/home/carljm/projects/python/cpython/Lib/unittest/mock.py", line 811, 
in assert_called_with
raise AssertionError(_error_message()) from cause
AssertionError: Expected call: bar(7)
Actual call: bar(<__main__.Foo object at 0x7fdca80b7550>, 7)
```
```

If you try to pass in the instance as an expected call arg, the error goes away 
but it just fails to match:

```
AssertionError: Expected call: bar(<__main__.Foo object at 0x7f5cbab35fd0>, 7)
Actual call: bar(7)
```

So AFAICT there is no way to successfully use `spec=True` when patching a 
method of a class.

Oddly, using `autospec=True` instead of `spec=True` _does_ record the instance 
as an argument in the recorded call args, meaning that you have to pass it in 
as an argument to e.g. `assert_called_with`. But in many (most?) cases where 
you're patching a method of a class, your test doesn't have access to the 
instance, elsewise you'd likely just patch the instance instead of the class in 
the first place.

I don't see a good reason why `autospec=True` and `spec=True` should differ in 
this way (if both options are needed, there should be a separate flag to 
control that behavior; it doesn't seem related to the documented differences 
between autospec and spec). I do think a) there needs to be some way to record 
call args to a method and assert against those call args without needing the 
instance (or resorting to manual assertions against a sliced `call_args`), and 
b) there should be some way to successfully use `spec=True` when patching a 
method of a class.

--
components: Library (Lib)
files: mock-method.example.py
messages: 272209
nosy: carljm
priority: normal
severity: normal
status: open
title: call-matcher breaks if a method is mocked with spec=True
versions: Python 3.5, Python 3.6
Added file: http://bugs.python.org/file44054/mock-method.example.py

___
Python tracker 

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



[issue27682] Windows Error 10053, ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine

2016-08-08 Thread Philip Lee

Philip Lee added the comment:

I use the following django view function also produce the same exception 

def sendFiles(request): 
fileName = request.GET['fileName']

pathToFile = os.path.join(filesDir, fileName)
response = FileResponse(open(pathToFile, 'rb'))

response['Content-Type'] = 'application/octet-stream'
response[
'Content-Disposition'] = 'attachment; fileName="{}"'.format(fileName)
response['Content-Length'] = os.path.getsize(pathToFile)
# HttpResponse(open(os.path.join(os.getcwd(), 'LYYDownloaderServer.log'), 
'r'), content_type='text/plain')
return response

Tested with sending file Git-2.8.4-32-bit.exe (29.8MB), if tested with sending 
file GitHubSetup.exe(670kb),then no exception occurred.

the exception like the following 

return self._sock.send(b)
ConnectionAbortedError: [WinError 10053] 您的主机中的软件中止了一个已建立的连接
。
[09/Aug/2016 10:30:13] "GET /FileHost/?fileName=Git-2.8.4-32-bit.exe HTTP/1.1" 5
00 59

Exception happened during processing of request from ('127.0.0.1', 62237)
Traceback (most recent call last):
  File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler
s.py", line 138, in run
self.finish_response()
  File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler
s.py", line 180, in finish_response
self.write(data)
  File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler
s.py", line 274, in write
self.send_headers()
  File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler
s.py", line 332, in send_headers
self.send_preamble()
  File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler
s.py", line 255, in send_preamble
('Date: %s\r\n' % format_date_time(time.time())).encode('iso-8859-1')
  File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler
s.py", line 453, in _write
result = self.stdout.write(data)
  File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\socket.py", lin
e 593, in write
return self._sock.send(b)
ConnectionAbortedError: [WinError 10053] 您的主机中的软件中止了一个已建立的连接
。

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler
s.py", line 141, in run
self.handle_error()
  File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\site-packages\d
jango\core\servers\basehttp.py", line 92, in handle_error
super(ServerHandler, self).handle_error()
  File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler
s.py", line 368, in handle_error
self.finish_response()
  File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler
s.py", line 180, in finish_response
self.write(data)
  File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler
s.py", line 274, in write
self.send_headers()
  File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler
s.py", line 331, in send_headers
if not self.origin_server or self.client_is_modern():
  File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler
s.py", line 344, in client_is_modern
return self.environ['SERVER_PROTOCOL'].upper() != 'HTTP/0.9'
TypeError: 'NoneType' object is not subscriptable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\socketserver.py
", line 625, in process_request_thread
self.finish_request(request, client_address)
  File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\socketserver.py
", line 354, in finish_request
self.RequestHandlerClass(request, client_address, self)
  File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\site-packages\d
jango\core\servers\basehttp.py", line 99, in __init__
super(WSGIRequestHandler, self).__init__(*args, **kwargs)
  File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\socketserver.py
", line 681, in __init__
self.handle()
  File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\site-packages\d
jango\core\servers\basehttp.py", line 179, in handle
handler.run(self.server.get_app())
  File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler
s.py", line 144, in run
self.close()
  File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\simple_
server.py", line 36, in close
self.status.split(' ',1)[0], self.bytes_sent
AttributeError: 'NoneType' object has no attribute 'split'

[09/Aug/2016 10:30:13] "GET /FileHost/?fileName=Git-2.8.4-32-bit.exe HTTP/1.1" 2
00 8192
Traceback (most recent call last):
  File "C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handler
s.py", line 138, in run
self.finish_response()
  

[issue27392] Add a server_side keyword parameter to create_connection

2016-08-08 Thread Guido van Rossum

Guido van Rossum added the comment:

I think it's okay if uvloop only handles those socket types. But if asyncio
may be able to handle other types we shouldn't reject them just because we
haven't heard about them. (E.g. IIRC someone was using Bluetooth sockets.)

--

___
Python tracker 

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



[issue27392] Add a server_side keyword parameter to create_connection

2016-08-08 Thread Yury Selivanov

Yury Selivanov added the comment:

> What would happen if some other socket type was passed? Would anything go
wrong, assuming it's a socket type that understands connections? (I think
checking for SOCK_STREAM is more important maybe).

In uvloop I have to create different libuv handles for AF_UNIX and AF_INET.  I 
think I can only support those families.  Cheking for SOCK_STREAM is also 
important.

--

___
Python tracker 

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



[issue27392] Add a server_side keyword parameter to create_connection

2016-08-08 Thread Guido van Rossum

Guido van Rossum added the comment:

Oh, I see. create_connection(..., ssl=True) creates a default SSLContext,
but create_server(..., ssl=True) is invalid, it requires
ssl=SSLContext(...). I like the latter for connect_accepted_socket(). I
think Jim will happily comply.

What would happen if some other socket type was passed? Would anything go
wrong, assuming it's a socket type that understands connections? (I think
checking for SOCK_STREAM is more important maybe).

--

___
Python tracker 

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



[issue27392] Add a server_side keyword parameter to create_connection

2016-08-08 Thread Yury Selivanov

Yury Selivanov added the comment:

Also I think we should add a check, that the passed socket is AF_UNIX or 
AF_INET(6)

--

___
Python tracker 

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



[issue27392] Add a server_side keyword parameter to create_connection

2016-08-08 Thread Yury Selivanov

Yury Selivanov added the comment:

Hm, I'm working on adding connect_accepted_socket to the uvloop.  There is one 
difference between connect_accepted_socket and 
create_server/create_unix_server:  the latter APIs forbid to pass boolean `ssl` 
argument, they require `ssl` to be an instance of `SSLContext`.

Should we have the same requirement for the 'ssl' argument of newly added 
'connect_accepted_socket'?

--

___
Python tracker 

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



[issue23591] Add Flags and IntFlags

2016-08-08 Thread Ethan Furman

Ethan Furman added the comment:

Flags -> int-backed, but not ints; useful for pure Python flags
IntFlags -> ints (like IntEnum); useful for interfacing with other systems

Are there better names?

--
title: Add IntFlags -> Add Flags and IntFlags

___
Python tracker 

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



[issue26988] Add AutoNumberedEnum to stdlib

2016-08-08 Thread Ethan Furman

Changes by Ethan Furman :


--
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



Specify the database for a Django ModelForm instance

2016-08-08 Thread Ben Finney
Howdy all,

How can I specify which database (by its alias name) a Django ModelForm
should use?

(I've had trouble getting this question in to the Django forum, so I'm
trying here as this is still Python-related.)

A Django ModelForm knows its corresponding model, and the fields
included.

The ModelForm instance clearly knows how to specify a database,
internally. It can validate its fields against the database, and can
save a new model instance to the database. This implies its operations
have knowledge of which database to use.

What I need is to access that as an external user, when creating the
instance. I can't find how to specify any database other than the
default, when creating the ModelForm nor when it interacts with the
database.

What is the equivalent for using='foo' when instantiating a ModelForm
for the model, or calling its methods (ModelForm.clean, ModelForm.save,
etc.)?

-- 
 \   “The sun never sets on the British Empire. But it rises every |
  `\morning. The sky must get awfully crowded.” —Steven Wright |
_o__)  |
Ben Finney

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


[issue27574] Faster parsing keyword arguments

2016-08-08 Thread STINNER Victor

STINNER Victor added the comment:

See also the old issue #17170 "string method lookup is too slow".

--
nosy: +haypo

___
Python tracker 

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



[issue27714] some test_idle tests are not re-runnable, producing false failures with regrtest -w option

2016-08-08 Thread Ned Deily

New submission from Ned Deily:

If you run test_idle using the standard Python regression test runner, 
regrtest, and use regrtest's -w option (to re-run failure test verbosely) 
*without* using regrtest's -j option (to run tests in separate processes), any 
real test failure triggering a rerun will cause a number of additional false 
IDLE test case failures because some test cases modify global state in such a 
way as to be not re-runable.

An example: at the moment there is a real IDLE test case failure (see 
Issue27830).  If I run test_idle with both -w and -j options:

$ /usr/local/bin/python3.6 -m test -w -j2 -uall test_idle
Run tests in parallel using 2 child processes
0:00:01 [1/1/1] test_idle failed
can't invoke "event" command:  application has been destroyed
while executing
"event generate $w <>"
(procedure "ttk::ThemeChanged" line 6)
invoked from within
"ttk::ThemeChanged"
test test_idle failed -- Traceback (most recent call last):
  File 
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/idlelib/idle_test/test_query.py",
 line 389, in test_click_help_source
Equal(dialog.result, ('__test__', __file__))
AssertionError: Tuples differ: ('__test__', 
'file:///Library/Frameworks/Python.framewo[58 chars].py') != ('__test__', 
'/Library/Frameworks/Python.framework/Vers[51 chars].py')

First differing element 1:
'file:///Library/Frameworks/Python.framewo[57 chars]y.py'
'/Library/Frameworks/Python.framework/Vers[50 chars]y.py'

  ('__test__',
-  
'file:///Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/idlelib/idle_test/test_query.py')
?   ---

+  
'/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/idlelib/idle_test/test_query.py')
1 test failed:
test_idle
Re-running failed tests in verbose mode
Re-running test 'test_idle' in verbose mode
test_autocomplete_event (idlelib.idle_test.test_autocomplete.AutoCompleteTest) 
... ok
test_delayed_open_completions 
(idlelib.idle_test.test_autocomplete.AutoCompleteTest) ... ok
[...]
test_shell_show (idlelib.idle_test.test_warning.ShellWarnTest) ... ok
test_showwarnings (idlelib.idle_test.test_warning.ShellWarnTest) ... ok

==
FAIL: test_click_help_source (idlelib.idle_test.test_query.HelpsourceGuiTest)
--
Traceback (most recent call last):
  File 
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/idlelib/idle_test/test_query.py",
 line 389, in test_click_help_source
Equal(dialog.result, ('__test__', __file__))
AssertionError: Tuples differ: ('__test__', 
'file:///Library/Frameworks/Python.framewo[58 chars].py') != ('__test__', 
'/Library/Frameworks/Python.framework/Vers[51 chars].py')

First differing element 1:
'file:///Library/Frameworks/Python.framewo[57 chars]y.py'
'/Library/Frameworks/Python.framework/Vers[50 chars]y.py'

  ('__test__',
-  
'file:///Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/idlelib/idle_test/test_query.py')
?   ---

+  
'/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/idlelib/idle_test/test_query.py')

--
Ran 219 tests in 0.977s

FAILED (failures=1)

only the 1 valid test case failure shows up.

But if I run test_idle with just -w (no -j) options:

$ /usr/local/bin/python3.6 -m test -w -uall test_idle
Run tests sequentially
0:00:00 [1/1] test_idle
can't invoke "event" command:  application has been destroyed
while executing
"event generate $w <>"
(procedure "ttk::ThemeChanged" line 6)
invoked from within
"ttk::ThemeChanged"
test test_idle failed -- Traceback (most recent call last):
  File 
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/idlelib/idle_test/test_query.py",
 line 389, in test_click_help_source
Equal(dialog.result, ('__test__', __file__))
AssertionError: Tuples differ: ('__test__', 
'file:///Library/Frameworks/Python.framewo[58 chars].py') != ('__test__', 
'/Library/Frameworks/Python.framework/Vers[51 chars].py')

First differing element 1:
'file:///Library/Frameworks/Python.framewo[57 chars]y.py'
'/Library/Frameworks/Python.framework/Vers[50 chars]y.py'

  ('__test__',
-  
'file:///Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/idlelib/idle_test/test_query.py')
?   ---

+  
'/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/idlelib/idle_test/test_query.py')

test_idle failed
1 test failed:
test_idle
Re-running failed tests in verbose mode
Re-running test 'test_idle' in verbose mode
test_autocomplete_event (idlelib.idle_test.test_autocomplete.AutoCompleteTest) 
... ok
test_delayed_open_completions 
(idlelib.idle_test.test_autocomplete.AutoCompleteTest) ... ok
[...]
test_no_delete (idlelib.idle_test.test_text.TkTextTest) ... ok
test_init_modal (idlelib.idle_test.test_textview.TextViewTest) ... ERROR
test_init_nonmodal 

[issue10910] pyport.h FreeBSD/Mac OS X "fix" causes errors in C++ compilation

2016-08-08 Thread Brett Cannon

Brett Cannon added the comment:

What do you think, Ned?

--
assignee: ronaldoussoren -> ned.deily
nosy: +benjamin.peterson, brett.cannon, georg.brandl, larry, ned.deily
priority: normal -> release blocker

___
Python tracker 

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



[issue27128] Add _PyObject_FastCall()

2016-08-08 Thread STINNER Victor

STINNER Victor added the comment:

I spent the last 3 months on making the CPython benchmark suite more stable and 
enhance my procedure to run benchmarks to ensure that benchmarks are more 
stable.

See my articles:
https://haypo-notes.readthedocs.io/microbenchmark.html#my-articles

I forked and enhanced the benchmark suite to use my perf module to run 
benchmarks in multiple processes:
https://hg.python.org/sandbox/benchmarks_perf

I ran this better benchmark suite on fastcall-2.patch on my laptop. The result 
is quite good: 

$ python3 -m perf compare_to ref.json fastcall.json -G  --min-speed=5
Slower (4):
- fastpickle/pickle_dict: 326 us +- 15 us -> 350 us +- 29 us: 1.07x slower
- regex_effbot: 49.4 ms +- 1.3 ms -> 53.0 ms +- 1.2 ms: 1.07x slower
- fastpickle/pickle: 432 us +- 8 us -> 457 us +- 10 us: 1.06x slower
- pybench.ComplexPythonFunctionCalls: 838 ns +- 11 ns -> 884 ns +- 8 ns: 1.05x 
slower

Faster (13):
- spectral_norm: 289 ms +- 6 ms -> 250 ms +- 5 ms: 1.16x faster
- pybench.SimpleIntFloatArithmetic: 622 ns +- 9 ns -> 559 ns +- 10 ns: 1.11x 
faster
- pybench.SimpleIntegerArithmetic: 621 ns +- 10 ns -> 560 ns +- 9 ns: 1.11x 
faster
- pybench.SimpleLongArithmetic: 891 ns +- 12 ns -> 816 ns +- 10 ns: 1.09x faster
- pybench.DictCreation: 852 ns +- 13 ns -> 788 ns +- 16 ns: 1.08x faster
- pybench.ForLoops: 10.8 ns +- 0.3 ns -> 9.99 ns +- 0.23 ns: 1.08x faster
- pybench.NormalClassAttribute: 1.85 us +- 0.02 us -> 1.72 us +- 0.04 us: 1.08x 
faster
- pybench.SpecialClassAttribute: 1.86 us +- 0.02 us -> 1.73 us +- 0.03 us: 
1.07x faster
- pybench.NestedForLoops: 21.9 ns +- 0.3 ns -> 20.7 ns +- 0.3 ns: 1.05x faster
- pybench.SimpleListManipulation: 501 ns +- 4 ns -> 476 ns +- 5 ns: 1.05x faster
- elementtree/process: 192 ms +- 3 ms -> 183 ms +- 2 ms: 1.05x faster
- elementtree/generate: 225 ms +- 5 ms -> 214 ms +- 4 ms: 1.05x faster
- hexiom2/level_25: 21.3 ms +- 0.3 ms -> 20.3 ms +- 0.1 ms: 1.05x faster

Benchmark hidden because not significant (84): (...)


Most benchmarks are not significant which is expected since fastcall-2.patch is 
really the most simple patch to start the work on "FASTCALL", it doesn't really 
implement any optimization, it only adds a new infrastructure to implement new 
optimizations.

A few benchmarks are faster (only benchmarks at least 5% faster are shown using 
--min-speed=5).

4 benchmarks are slower, but the slowdown should be temporarily: new 
optimizations should these benchmarks slower. See the issue #26814 for more a 
concrete implementation and a lot of benchmark results if you don't trust me :-)

I consider that benchmarks proved that there is no major slowdown, so 
fastcall-2.patch can be merged to be able to start working on real 
optimizations.

--

___
Python tracker 

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



[issue27380] IDLE: add base Query dialog with ttk widgets

2016-08-08 Thread Ned Deily

Ned Deily added the comment:

test_click_help_source fails on OS X:

==
FAIL: test_click_help_source (idlelib.idle_test.test_query.HelpsourceGuiTest)
--
Traceback (most recent call last):
  File 
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/idlelib/idle_test/test_query.py",
 line 389, in test_click_help_source
Equal(dialog.result, ('__test__', __file__))
AssertionError: Tuples differ: ('__test__', 
'file:///Library/Frameworks/Python.framewo[58 chars].py') != ('__test__', 
'/Library/Frameworks/Python.framework/Vers[51 chars].py')

First differing element 1:
'file:///Library/Frameworks/Python.framewo[57 chars]y.py'
'/Library/Frameworks/Python.framework/Vers[50 chars]y.py'

  ('__test__',
-  
'file:///Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/idlelib/idle_test/test_query.py')
?   ---

+  
'/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/idlelib/idle_test/test_query.py')

--
nosy: +ned.deily
resolution: fixed -> 
stage: resolved -> needs patch
status: closed -> open

___
Python tracker 

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



[issue27709] difflib.HtmlDiff produces different output from difflib.ndiff

2016-08-08 Thread SilentGhost

Changes by SilentGhost :


Removed file: http://bugs.python.org/file44049/donttrim.diff

___
Python tracker 

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



[issue27709] difflib.HtmlDiff produces different output from difflib.ndiff

2016-08-08 Thread SilentGhost

SilentGhost added the comment:

The degenerate behaviour appears ultimately due to the autojunk heuristic. 
Given that autojunk defaults to True and there isn't any way to change via most 
user-facing functions, I don't think there is an easy resolution that can be 
found here. I'm going to withdraw the earlier patch, since it feels like a 
half-measure which enable correct behaviour by accident.

--
nosy: +eli.bendersky, terry.reedy
stage: patch review -> needs patch

___
Python tracker 

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



[issue27700] Document asyncio.AbstractEventLoop, not asyncio.BaseEventLoop

2016-08-08 Thread Guido van Rossum

Changes by Guido van Rossum :


--
resolution:  -> fixed
status: open -> closed

___
Python tracker 

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



[issue27700] Document asyncio.AbstractEventLoop, not asyncio.BaseEventLoop

2016-08-08 Thread Guido van Rossum

Changes by Guido van Rossum :


--
stage: patch review -> resolved

___
Python tracker 

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



[issue27700] Document asyncio.AbstractEventLoop, not asyncio.BaseEventLoop

2016-08-08 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 87e3a58ed3c3 by Guido van Rossum in branch '3.5':
Issue #27700: Document AbstractEventLoop, not BaseEventLoop.
https://hg.python.org/cpython/rev/87e3a58ed3c3

New changeset d69f782d642d by Guido van Rossum in branch 'default':
Issue #27700: Document AbstractEventLoop, not BaseEventLoop. (Merge 3.5->3.6)
https://hg.python.org/cpython/rev/d69f782d642d

--
nosy: +python-dev

___
Python tracker 

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



[issue27700] Document asyncio.AbstractEventLoop, not asyncio.BaseEventLoop

2016-08-08 Thread Yury Selivanov

Yury Selivanov added the comment:

Fair enough.  I don't have any other questions about the patch.

--

___
Python tracker 

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



[issue27700] Document asyncio.AbstractEventLoop, not asyncio.BaseEventLoop

2016-08-08 Thread Guido van Rossum

Guido van Rossum added the comment:

The reason I kept some mention of BaseEventLoop is just that until now it
was the only thing documented and people might have references to it. It
would be good if searching for BaseEventLoop took them to a section
explaining they shouldn't use it, rather than just mysteriously failing to
turn up any search results at all.

And given that it *is* the base class I think we can't mark it as
deprecated (and I don't think that's needed yet).

--

___
Python tracker 

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



Re: Running Python from the source repo

2016-08-08 Thread Random832
On Mon, Aug 8, 2016, at 15:25, Terry Reedy wrote:
> Last January, I wrote a batch file to build all three versions with the 
> 'optional' extensions.  I started rebuilding more often after this.
> 
> 36\pcbuild\build.bat -e -d
> 35\pcbuild\build.bat -e -d
> 27\pcbuild\build.bat -e -d
> 
> Thanks for making this possible.  It initially worked, but now it stops 
> after the first command, even without errors.  Has a flag been changed 
> to treat warnings as errors?  How can I change the .bat to wrap each 
> command with the equivalent of try: except: pass?

I'm not sure how it ever worked, but you have to use "call" to run one
batch file from another batch file, otherwise it doesn't start a
recursive command interpreter and so it won't run anything else in the
outer batch file.

I don't know if .cmd files have this limitation.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Running Python from the source repo

2016-08-08 Thread Zachary Ware
On Mon, Aug 8, 2016 at 2:25 PM, Terry Reedy  wrote:
> Last January, I wrote a batch file to build all three versions with the
> 'optional' extensions.  I started rebuilding more often after this.
>
> 36\pcbuild\build.bat -e -d
> 35\pcbuild\build.bat -e -d
> 27\pcbuild\build.bat -e -d
>
> Thanks for making this possible.  It initially worked, but now it stops
> after the first command, even without errors.  Has a flag been changed to
> treat warnings as errors?  How can I change the .bat to wrap each command
> with the equivalent of try: except: pass?

I'm not sure why that would have stopped working, but the way to use a
.bat from a .bat is to 'call' it:

call 36\PCbuild\build.bat -e -d

.bat scripts don't care about the exit codes of what they run, errors
must be explicitly checked and 'exit' called if you want the script to
die early.  Try this for an unconditional build on all three branches,
with a report at the end if any of them failed:

call 36\PCbuild\build.bat -e -d
set rc36=%ERRORLEVEL%

call 35\PCbuild\build.bat -e -d
set rc35=%ERRORLEVEL%

call 27\PCbuild\build.bat -e -d
set rc27=%ERRORLEVEL%

@if %rc36% NEQ 0 (
echo 3.6 build failed, rc: %rc36%
)
@if %rc35% NEQ 0 (
echo 3.5 build failed, rc: %rc35%
)
@if %rc27% NEQ 0 (
echo 2.7 build failed, rc: %rc27%
)


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


[issue27710] Disallow fold not in [0, 1] in time and datetime constructors

2016-08-08 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 035778fdc641 by Alexander Belopolsky in branch 'default':
Closes #27710: Disallow fold not in [0, 1] in time and datetime constructors.
https://hg.python.org/cpython/rev/035778fdc641

--
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



[issue27700] Document asyncio.AbstractEventLoop, not asyncio.BaseEventLoop

2016-08-08 Thread Yury Selivanov

Yury Selivanov added the comment:

The patch looks good.

I have a question: do we actually want to document BaseEventLoop?  It's not a 
user-facing class, and the knowledge that it exists doesn't add to anything IMO.

--

___
Python tracker 

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



[issue27700] Document asyncio.AbstractEventLoop, not asyncio.BaseEventLoop

2016-08-08 Thread Guido van Rossum

Changes by Guido van Rossum :


--
stage: needs patch -> patch review

___
Python tracker 

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



Re: Python and 64bit Windows7

2016-08-08 Thread BartC

On 08/08/2016 13:44, James Santiago wrote:


4) I also went to DOS prompt or CMD screen, went to the directory where
Python was located as follows:
C:\Python>python exe -v.  This returns several lines of information.


I assume you meant "python.exe -v". (But the .exe is not needed.)


For example:
 the first line is import _frozen_importlib # frozen.


I get the same sort of stuff. It seems Python is there and it works.

What's PyCharm and what error does it give? What does its Help section 
say about telling it where Python is? You might need support for that 
application rather than Python.


(Perhaps it expects python.exe in a default path. Go to any other 
location, and type 'python'. If it can't find it, then its path is not 
set up. You can fix that temporarily by typing:


  set path=c:\python\;%path%

then trying again. However this path variable 'belongs' to this command 
window and may not be seen by PyCharm if started from elsewhere. Setting 
it more globally is fiddly but there is plenty of info out there. The 
problem could be something else of course...)


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


Re: Running Python from the source repo

2016-08-08 Thread Terry Reedy

On 8/8/2016 12:24 PM, Zachary Ware wrote:


I generally assume that if I'm testing a patch, I'm going to need to
rebuild regardless of what the patch actually touches.  I often wait
until the patch is applied before I do the rebuild, or if I'm manually
testing a bug I go ahead and do the rebuild immediately.  Most make
targets (including 'test') will go ahead make sure the build is up to
date without your input.  Usually the slowest part of a rebuild is
rerunning ./configure, which 'make' will do for you if it determines
that it should.  You can speed up ./configure by passing it the
'--config-cache' (or '-C') option.  If you're on a multi-core machine,
also remember to pass '-j' to make to speed up
building, and also to regrtest (which you can do with 'make test
TESTOPTS=-j9') to speed up testing.

[1]https://www.mercurial-scm.org/wiki/FetchExtension


Last January, I wrote a batch file to build all three versions with the 
'optional' extensions.  I started rebuilding more often after this.


36\pcbuild\build.bat -e -d
35\pcbuild\build.bat -e -d
27\pcbuild\build.bat -e -d

Thanks for making this possible.  It initially worked, but now it stops 
after the first command, even without errors.  Has a flag been changed 
to treat warnings as errors?  How can I change the .bat to wrap each 
command with the equivalent of try: except: pass?


--
Terry Jan Reedy

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


[issue27595] Document PEP 495 (Local Time Disambiguation) features

2016-08-08 Thread Alexander Belopolsky

Alexander Belopolsky added the comment:

I am attaching the first cut of the documentation changes.  Note that I am 
deliberately trying to keep the information about the fold to the minimum in 
the reference manual.  I don't think the details of how fold works are of 
interest to anyone other then those who implement the tzinfo subclasses.

--
keywords: +patch
Added file: http://bugs.python.org/file44053/issue27595.diff

___
Python tracker 

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



RE: python 3.5.2 lounch: api-ms-win-crt-runtime-l1-1-0.dll is missing ?

2016-08-08 Thread Joaquin Alzola
>I installed the version for windows 64. After a succesfull installation, the 
>same system error occurs on the lounch of the program:
>api-ms-win-crt-runtime-l1-1-0.dll   is missing.

 Sometimes google save you time more than the list:
https://www.smartftp.com/support/kb/the-program-cant-start-because-api-ms-win-crt-runtime-l1-1-0dll-is-missing-f2702.html

I think from there you can manage
This email is confidential and may be subject to privilege. If you are not the 
intended recipient, please do not copy or disclose its content but contact the 
sender immediately upon receipt.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue27698] socketpair not in socket.__all__ on Windows

2016-08-08 Thread Eryk Sun

Eryk Sun added the comment:

See issue 18643, which added a Windows implementation of socketpair(). Since 
it's not defined in the _socket extension module, it isn't added to 
socket.__all__. Someone simply forgot to add `__all__.append("socketpair")` 
after the definition on line 485.

--

___
Python tracker 

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



[issue27698] socketpair not in socket.__all__ on Windows

2016-08-08 Thread Eryk Sun

Changes by Eryk Sun :


--
Removed message: http://bugs.python.org/msg272188

___
Python tracker 

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



[issue27698] socketpair not in socket.__all__ on Windows

2016-08-08 Thread Eryk Sun

Eryk Sun added the comment:

See issue 18643, which added a Windows implementation of socketpair(). Since 
it's not defined in the _socket extension module, it isn't added to 
socket.__all__. Someone simply forgot to add 
`__all__.append("sockpetpair")` after the definition on line 485.

--
nosy: +eryksun

___
Python tracker 

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



[issue27698] socketpair not in socket.__all__ on Windows

2016-08-08 Thread SilentGhost

SilentGhost added the comment:

> nor do I see any mention of socketpair in the 3.5 whatsnew
socket.socketpair has a versionchanged 3.5: Windows support added.

--
nosy: +SilentGhost

___
Python tracker 

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



[issue27713] Spurious "platform dependent libraries" warnings when running make

2016-08-08 Thread Chris Jerdonek

New submission from Chris Jerdonek:

When installing Python 3.5.2 from source on Ubuntu 14.04 and running
make, I get the below "Could not find platform dependent libraries"
warnings (which I prefixed with "***" for better visibility).

>From this message which has more background, these warnings are
apparently harmless:

https://mail.python.org/pipermail/python-dev/2016-August/145783.html


  -DHGBRANCH="\"`LC_ALL=C `\"" \
  -o Modules/getbuildinfo.o ./Modules/getbuildinfo.c
gcc -pthread -c -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 
-Wall -Wstrict-prototypes-Werror=declaration-after-statement   -I. 
-IInclude -I./Include-DPy_BUILD_CORE -o Programs/_freeze_importlib.o 
Programs/_freeze_importlib.c
gcc -pthread   -o Programs/_freeze_importlib Programs/_freeze_importlib.o 
Modules/getbuildinfo.o Parser/acceler.o [**snipped for brevity**]  
Modules/xxsubtype.o -lpthread -ldl  -lutil   -lm  
if test "no" != "yes"; then \
./Programs/_freeze_importlib \
./Lib/importlib/_bootstrap.py Python/importlib.h; \
fi
***: Could not find platform dependent libraries 
***: Consider setting $PYTHONHOME to [:]
if test "no" != "yes"; then \
./Programs/_freeze_importlib \
./Lib/importlib/_bootstrap_external.py 
Python/importlib_external.h; \
fi
***: Could not find platform dependent libraries 
***: Consider setting $PYTHONHOME to [:]
gcc -pthread -c -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 
-Wall -Wstrict-prototypes-Werror=declaration-after-statement   -I. 
-IInclude -I./Include-DPy_BUILD_CORE -o Python/frozen.o Python/frozen.c
rm -f libpython3.5m.a
ar rc libpython3.5m.a Modules/getbuildinfo.o

--
components: Installation
messages: 272186
nosy: chris.jerdonek
priority: normal
severity: normal
status: open
title: Spurious "platform dependent libraries" warnings when running make
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



[issue27698] socketpair not in socket.__all__ on Windows

2016-08-08 Thread R. David Murray

R. David Murray added the comment:

I don't see any special casing for windows in the socketpair code in the 
current socket module, nor do I see any mention of socketpair in the 3.5 
whatsnew.  Based on a quick scan of the socket code I don't see how socketpair 
could be defined on a platform without also automatically being included in 
__all__.

--
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



[issue9998] ctypes find_library should search LD_LIBRARY_PATH on Linux

2016-08-08 Thread Daniel Blanchard

Changes by Daniel Blanchard :


--
nosy:  -Daniel.Blanchard

___
Python tracker 

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



Re: Network protocols, sans I/O,(Hopefully) the future of network protocols in Python

2016-08-08 Thread Irmen de Jong
On 8-8-2016 12:37, Mark Lawrence wrote:
> This may be of interest to some of you 
> http://www.snarky.ca/network-protocols-sans-i-o
> 

I sure find it interesting. Will also watch Cory's PyCon presentation that is 
mentioned!
Thanks for the link.


Irmen

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


[issue9998] ctypes find_library should search LD_LIBRARY_PATH on Linux

2016-08-08 Thread Vinay Sajip

Vinay Sajip added the comment:

Updated the last patch with code for handling the case where ld is not 
available.

--
Added file: http://bugs.python.org/file44052/refresh-2016-08-08.diff

___
Python tracker 

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



[issue27700] Document asyncio.AbstractEventLoop, not asyncio.BaseEventLoop

2016-08-08 Thread Guido van Rossum

Changes by Guido van Rossum :


--
Removed message: http://bugs.python.org/msg272183

___
Python tracker 

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



[issue27700] Document asyncio.AbstractEventLoop, not asyncio.BaseEventLoop

2016-08-08 Thread Guido van Rossum

Guido van Rossum added the comment:

Here's the file.

--
keywords: +patch
Added file: http://bugs.python.org/file44051/Base2Abstract.diff

___
Python tracker 

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



[issue27700] Document asyncio.AbstractEventLoop, not asyncio.BaseEventLoop

2016-08-08 Thread Guido van Rossum

Changes by Guido van Rossum :


--
Removed message: http://bugs.python.org/msg272182

___
Python tracker 

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



[issue27700] Document asyncio.AbstractEventLoop, not asyncio.BaseEventLoop

2016-08-08 Thread Guido van Rossum

Guido van Rossum added the comment:

Uploading the file.

--

___
Python tracker 

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



[issue27700] Document asyncio.AbstractEventLoop, not asyncio.BaseEventLoop

2016-08-08 Thread Guido van Rossum

Changes by Guido van Rossum :


--
Removed message: http://bugs.python.org/msg272181

___
Python tracker 

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



[issue27700] Document asyncio.AbstractEventLoop, not asyncio.BaseEventLoop

2016-08-08 Thread Guido van Rossum

Guido van Rossum added the comment:

Here's the file (I hope).

--

___
Python tracker 

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



[issue27700] Document asyncio.AbstractEventLoop, not asyncio.BaseEventLoop

2016-08-08 Thread Guido van Rossum

Guido van Rossum added the comment:

Here's a tentative diff. I did a global replace BaseEventLoop -> 
AbstractEventLoop and added an entry for BaseEventLoop (just above 
AbstractEventLoop) explaining that it should not be used.  Please review for 
obvious mistakes.

--

___
Python tracker 

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



[issue27392] Add a server_side keyword parameter to create_connection

2016-08-08 Thread Yury Selivanov

Yury Selivanov added the comment:

> Did the patch not get merged??

connect_accepted_socket was merged.  The docs patch is still pending (nothing 
wrong with it, I just need to commit it)

--

___
Python tracker 

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



Re: Running Python from the source repo

2016-08-08 Thread Zachary Ware
On Sun, Aug 7, 2016 at 9:11 PM, Steven D'Aprano
 wrote:
> I have cloned the Python source repo, and build CPython, as described here:
>
> https://docs.python.org/devguide/
>
>
> Now a little bit later, I want to update the repo, so I run:
>
> hg fetch

According to the hg docs [1], you should probably avoid 'hg fetch'.
Use 'hg pull -u' (or 'hg pull && hg update') instead.

> to get and apply any changes. How do I know if I need to rebuild Python? I
> don't want to have to rebuild after every fetch, because that's quite time
> consuming (I estimate about five minutes on my machine, just long enough to
> be a distraction but not long enough to get into something else). Plus the
> time to run the tests (significantly longer).
>
> What do others do?

I generally assume that if I'm testing a patch, I'm going to need to
rebuild regardless of what the patch actually touches.  I often wait
until the patch is applied before I do the rebuild, or if I'm manually
testing a bug I go ahead and do the rebuild immediately.  Most make
targets (including 'test') will go ahead make sure the build is up to
date without your input.  Usually the slowest part of a rebuild is
rerunning ./configure, which 'make' will do for you if it determines
that it should.  You can speed up ./configure by passing it the
'--config-cache' (or '-C') option.  If you're on a multi-core machine,
also remember to pass '-j' to make to speed up
building, and also to regrtest (which you can do with 'make test
TESTOPTS=-j9') to speed up testing.

[1]https://www.mercurial-scm.org/wiki/FetchExtension

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


[issue27392] Add a server_side keyword parameter to create_connection

2016-08-08 Thread Jim Fulton

Jim Fulton added the comment:

idk if the patch got merged.

I just added the last comment for informational purposes. :)

Perhaps this issue can be closed.

--

___
Python tracker 

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



[issue27392] Add a server_side keyword parameter to create_connection

2016-08-08 Thread Guido van Rossum

Guido van Rossum added the comment:

Did the patch not get merged??

On Sun, Aug 7, 2016 at 11:32 AM, Jim Fulton  wrote:

>
> Jim Fulton added the comment:
>
> FTR another use case for this. :)
>
> We have a ZEO applications where individual database users authenticate
> via self-signed certs. The server's SSL connection has to have this
> collection of certs. User CRUD operations can add and remove certs to
> authenticate against.  SSL contexts don't provide an API for removing (or
> even clearing) CAs used for authentication, so we need to create new SSL
> contexts when the set of valid certs change.  There's no way to update the
> SSL context used by a server, so we're wrapping accepted sockets ourselves,
> so we can use dynamic SSL contexts.
>
> Some alternatives:
>
> - Add an SSLContext API for removing or clearing CAs
>
> - Add a Server API to update the SSL context used for new connections.  (I
> may pursue this at some point. I spent a few minutes trying to find where a
> Server's SSL context is stored, but failed and can't spend more time ATM.)
>
> --
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



Re: Make sure you removed all debugging print statements error

2016-08-08 Thread Michael Torrie
On 08/08/2016 06:20 AM, aaryanrevi...@gmail.com wrote:
> Hello guys! I was answering a question on a piece of homework of
> mine. Sadly I can't answer it correctly due to the repetitive error
> being "Make sure you removed all debugging print statements."
> Hopefully one of you guys can help me solve this and also make me
> understand why I keep on getting this error.

Sounds like there's an automatic piece of software running your code and
comparing your output with the expected output.  Your code must be
giving different output than expected by your teacher.  The message is
simply a reminder that if you had any debugging print()'s in your code
that you should remove them before turning in your program.  Since you
don't have any debug print()'s that I can see, the problem must be that
your program is simply outputing something different than expected.

What output is expected?  What does the assignment say about it?
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue27712] Tiny typos in import.rst

2016-08-08 Thread Xiang Zhang

Changes by Xiang Zhang :


--
assignee: docs@python
components: Documentation
files: import_doc.patch
keywords: patch
nosy: docs@python, xiang.zhang
priority: normal
severity: normal
status: open
title: Tiny typos in import.rst
type: behavior
versions: Python 3.6
Added file: http://bugs.python.org/file44050/import_doc.patch

___
Python tracker 

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



Re: Make sure you removed all debugging print statements error

2016-08-08 Thread Chris Angelico
On Mon, Aug 8, 2016 at 10:20 PM,   wrote:
> class Person(object):
> def __init__(self, name):
> self.name = name
> try:
> firstBlank = name.rindex(' ')
> self.lastName = name[firstBlank+1:]
> except:
> self.lastName = name
> self.age = None

Please don't EVER do this kind of thing. EVER. Firstly, the bare
"except:" clause should basically never be used; instead, catch a very
specific exception and figure out what you want to do here - but
secondly, don't force people's names to be subdivided.

https://www.kalzumeus.com/2010/06/17/falsehoods-programmers-believe-about-names/

Even if you *must* split the name like this, there are far more
Pythonic ways to do so. But I won't tell you about them, because you
shouldn't even use a concept of "lastName".

> def getLastName(self):
> return self.lastName

Python is not Java. You don't need a public attribute "self.lastName"
and a getter "self.getLastName()".

> def setAge(self, age):
> self.age = age
> def getAge(self):
> if self.age == None:
> raise ValueError
> return self.age

Same again - you don't need getters and setters. Please don't write
code like this in Python.

> def __str__(self):
> return self.name

Hmm, I'm not sure this is a good idea - you're treating a person as
equivalent to his/her name. Normally you'd define the repr and/or str
of a class to show exactly what thing this is; it'll make debugging
easier.

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


[issue27711] datetime.utctimetuple() method should respect fold disambiguation

2016-08-08 Thread Alexander Belopolsky

Alexander Belopolsky added the comment:

This would be a feature not anticipated by PEP 495.

--
resolution:  -> rejected
status: open -> closed
type: behavior -> enhancement

___
Python tracker 

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



[issue27711] datetime.utctimetuple() method should respect fold disambiguation

2016-08-08 Thread Alexander Belopolsky

New submission from Alexander Belopolsky:

With TZ = America/New_York:

>>> t0 = datetime(2016, 11, 6, 1, 30, fold=0)
>>> t1 = datetime(2016, 11, 6, 1, 30, fold=1)
>>> t0.utctimetuple()[:6]
(2016, 11, 6, 1, 30, 0)
>>> t1.utctimetuple()[:6]
(2016, 11, 6, 1, 30, 0)
>>> t0.timestamp()
1478410200.0
>>> t1.timestamp()
1478413800.0

The correct values for utctimetuple() should be the same as

>>> datetime.utcfromtimestamp(t0.timestamp()).timetuple()[:6]
(2016, 11, 6, 5, 30, 0)
>>> datetime.utcfromtimestamp(t1.timestamp()).timetuple()[:6]
(2016, 11, 6, 6, 30, 0)

--
assignee: belopolsky
messages: 272175
nosy: belopolsky
priority: normal
severity: normal
status: open
title: datetime.utctimetuple() method should respect fold disambiguation
type: behavior
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



Re: api-ms-win-crt-runtime-l1-1-0.dll missing ?

2016-08-08 Thread eryk sun
On Sun, Aug 7, 2016 at 8:40 AM, zutix via Python-list
 wrote:
> I installed the version for windows 64. After a succesfull installation, the
> same system error occurs on the lounch of the program:
> api-ms-win-crt-runtime-l1-1-0.dll   is missing.
>
> Please would you let me know where I can get safely this .dll giving me the
> exact address because I'm a beginner ?  Thank you.

The Universal CRT update [1] should be applied by the installer, but
shouldn't even be required on an up-to-date system. Did you disable
Windows Update?

[1]: https://support.microsoft.com/en-us/kb/2999226
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python and 64bit Windows7

2016-08-08 Thread James Santiago
Hello:

Thank you for your reply.

Here are the steps I took, and the error messages I get:

I have a windows7 laptop with 64bit intel i3.  25Gb hard-drive space left,
5Gb usable RAM space. (at the time of installing Python)

1) on the first attempt I chose the default choice in installer.
Installation did not give any errors whatsoever.  I then installed PyCharm
- again with default choice and successful.  When I open PyCharm, it did
not locate the Interpreter automatically.  When I did guide it to the
correct path for Python location, a Python window (labeled Modify Setup)
opens with three choices: Modify, Repair, Uninstall.  I tried Repair in one
try (& repeated it couple of times later), and Modify choice in a later
attempt.  However every time I open a new Project in PyCharm I could not
get past the Modify Setup window.

2) I checked 'Uninstall or Change a Program' window of Windows7 and
confirmed Python 3.5.2(32-bit) and Python Launcher installed.  I also went
to the correct location in C:/Program Files (x86)/ directory and confirmed
Python being present.

3) I uninstalled Python and reinstalled.  This time I went with customized
installation choice.  I installed it in C:/Python/.
Installation was successful by itself.  However same error when I open
PyCharm and try to put the actual file location in the Interpreter field of
PyCharm.

4) I also went to DOS prompt or CMD screen, went to the directory where
Python was located as follows:
C:\Python>python exe -v.  This returns several lines of information.
For example:
 the first line is import _frozen_importlib # frozen.
second line is import _imp # builtin
import sys # builtin
There are some 15-20 lines like this which start with the term 'import'.
There are a few lines that start like this:
# C:\Python\lib\__pycache__\codecs.cpython-35.pyc matches
C:\Python\lib\codecs.py


Thank you in advance for your help.

Regards
James











On Mon, Aug 8, 2016 at 2:08 AM, Joaquin Alzola 
wrote:

> >I am having problems when installing Python on a 64bit windows7 laptop.
> >I am guessing that the problem is happening because of the 64bit
> architecture.
> >Could you please take a look at the attached file that has screen shots
> of the problem I am facing?
> >Could you tell me how I can fix these issues and get Python and PyCharm
> to work?
>
> Mailing list doesn't allow attachments so please post you error through
> writing it into text.
> This email is confidential and may be subject to privilege. If you are not
> the intended recipient, please do not copy or disclose its content but
> contact the sender immediately upon receipt.
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Network protocols, sans I/O,(Hopefully) the future of network protocols in Python

2016-08-08 Thread Mark Lawrence via Python-list
This may be of interest to some of you 
http://www.snarky.ca/network-protocols-sans-i-o


--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

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


[issue27710] Disallow fold not in [0, 1] in time and datetime constructors

2016-08-08 Thread Alexander Belopolsky

New submission from Alexander Belopolsky:

The current implementation does not restrict values accepted by the fold 
argument:

>>> from datetime import *
>>> time(fold=2)
datetime.time(0, 0, fold=2)
>>> datetime(1, 1, 1, fold=2)
datetime.datetime(1, 1, 1, 0, 0, fold=2)

--
assignee: belopolsky
messages: 272174
nosy: belopolsky
priority: normal
severity: normal
status: open
title: Disallow fold not in [0, 1] in time and datetime constructors
type: behavior
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



[issue27709] difflib.HtmlDiff produces different output from difflib.ndiff

2016-08-08 Thread SilentGhost

New submission from SilentGhost:

msg264842 in issue26945 reports an odd results of HtmlDiff.make_file, digging 
into it I've noticed couple of things: different output to one generated 
directly from difflib.ndiff and underlying issue further up the stack that 
generates same faulty output with a slightly modified files.

The patch I'm attaching fixes the issue with different outputs, from make_file 
and ndiff, by not removing EOL characters, I had to re-generate expected test 
output file.

--
components: Library (Lib)
files: donttrim.diff
keywords: patch
messages: 272173
nosy: SilentGhost, jlwing, loewis
priority: normal
severity: normal
stage: patch review
status: open
title: difflib.HtmlDiff produces different output from difflib.ndiff
type: behavior
versions: Python 3.5, Python 3.6
Added file: http://bugs.python.org/file44049/donttrim.diff

___
Python tracker 

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



Re: Make sure you removed all debugging print statements error

2016-08-08 Thread Christian Gollwitzer

Am 08.08.16 um 14:20 schrieb aaryanrevi...@gmail.com:>


Hello guys! I was answering a question on a piece of homework of
mine. Sadly I can't answer it correctly due to the repetitive error
being "Make sure you removed all debugging print statements."
Hopefully one of you guys can help me solve this and also make me
understand why I keep on getting this error.


This seems to be specific to the system where you hand in the solutions; 
here we can only guess. Does it help to comment out all print staments 
in your code? I can only see 2 print statements at the end of the script.


Christian


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


[issue26945] difflib.HtmlDiff().make_file() treat few change as whole line change

2016-08-08 Thread SilentGhost

SilentGhost added the comment:

JW, this doens't seem anything to do with the original issue. I'm going to 
close this issue and open a new one that's dealing with your case, I have a fix 
for it.

--
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



[issue20004] csv.DictReader classic class has a property with setter

2016-08-08 Thread R. David Murray

R. David Murray added the comment:

I don't believe it was ever committed to 3.x, nor do I see it there.

--

___
Python tracker 

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



[issue20004] csv.DictReader classic class has a property with setter

2016-08-08 Thread Mathieu Dupuy

Mathieu Dupuy added the comment:

Yeah, it turned out I was actually browsing Python 2.7 sources. My bad.

2016-08-08 16:39 GMT+02:00 R. David Murray :
>
> R. David Murray added the comment:
>
> I don't believe it was ever committed to 3.x, nor do I see it there.
>
> --
>
> ___
> Python tracker 
> 
> ___

--

___
Python tracker 

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



A bioinformatics module similar to DEseq in R

2016-08-08 Thread nir . yakovi1
Hi!
is there a Python module equivalent\as similar as possible to 'DEseq' in R?
It's just that my team's (many) scripts use it, and to start modifying them all 
to support some different bioinformatics module would be a nightmare.
Thanks!
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue27694] Socket incorrectly states IP address that start with a zero after a dot are illegal

2016-08-08 Thread R. David Murray

R. David Murray added the comment:

See also issue 27612.

--
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



[issue27708] Roudning/Large Int representation error with multiplication and division

2016-08-08 Thread Steven D'Aprano

Steven D'Aprano added the comment:

> Converting n to an int

Oops. Obviously I meant converting n *from* an int *to* a float.

--

___
Python tracker 

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



[issue27708] Roudning/Large Int representation error with multiplication and division

2016-08-08 Thread Steven D'Aprano

Steven D'Aprano added the comment:

Your description is hard to understand, and doesn't give enough detail, but I 
*think* I can guess what you might be referring to.

If you start with a really big integer, and divide, you get a float. But really 
big floats cannot represent every number exactly (they only have a limited 
precision). For example:

py> n = 12345678901234567
py> print(n, n/1)
12345678901234567 1.2345678901234568e+16

Converting n to an int (you don't need to use division, calling float() will do 
the same thing) rounds to the nearest possible 64-bit floating point value, 
which happens to be one larger.

If this is the error you are talking about, there's nothing that can be done 
about it. It is fundamental to the way floating point numbers work.

If you mean something different, please explain.

--
nosy: +steven.daprano

___
Python tracker 

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



[issue27687] Linux shutil.move between mountpoints as root does not retain ownership

2016-08-08 Thread R. David Murray

R. David Murray added the comment:

This is as documented (see copystat).  To do anything with user and group would 
be an enhancement.

--
nosy: +r.david.murray
type: behavior -> enhancement
versions: +Python 3.6 -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



[issue27690] os.path.normcase broken.

2016-08-08 Thread R. David Murray

Changes by R. David Murray :


--
type: crash -> behavior

___
Python tracker 

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



Re: Make sure you removed all debugging print statements error

2016-08-08 Thread Steven D'Aprano
On Mon, 8 Aug 2016 10:20 pm, aaryanrevi...@gmail.com wrote:

> Hello guys! I was answering a question on a piece of homework of mine.
> Sadly I can't answer it correctly due to the repetitive error being "Make
> sure you removed all debugging print statements." Hopefully one of you
> guys can help me solve this and also make me understand why I keep on
> getting this error.

You haven't given us enough information to answer this question. What error
do you get? What version of Python are you running? How are you running it?

Please copy and paste (NO SCREENSHOTS!) the exact commands you use to run
your code, and the actual error you get.




-- 
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: Cant download python libraries.

2016-08-08 Thread Steven D'Aprano
On Mon, 8 Aug 2016 04:37 am, Panayiotis Mangafas wrote:

> So i've downloaded python on a new laptop(Windows) and apparently i
> downloaded it in a wrong folder and now when i try to install a library i
> cant. I have tried both pip install and install setup.py but i cant make
> it work. It doesn't work if i just try to access python from cmd. I've
> tried to uninstall it but it still here. How can i fix that?

You haven't given us enough information to answer your question.

What do you mean, "it doesn't work"? Do you get an error message?

Please copy and paste (NO SCREENSHOTS!) exactly what commands you type, and
what errors you get.



-- 
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


[issue26470] Make OpenSSL module compatible with OpenSSL 1.1.0

2016-08-08 Thread Christian Heimes

Christian Heimes added the comment:

Stéphane, I have addressed your code review.

def __new__() no longer hard-codes protocol. We can change that in a later 
version of Python. OpenSSL has deprecated all SSL methods except of the generic 
TLS method. The TLS method was formerly known as SSLv23 method and does 
auto-negotiation of the latest supported method.

Lib/test/test_ssl.py:1183: LibreSSL does not support SSL_CA_PATH and SSL_CA_DIR 
env vars. I have changed the comment on the test.

Modules/_hashopenssl.c:127: _hashopenssl.c now does error checks on EVP digest 
copy. The copy operation can fail when an EVP ENGINE is involved.

HAS_FAST_PKCS5_PBKDF2_HMAC is defined in _hashopenssl.c. OpenSSL used to have a 
bad implementation of PKBDF2. I fixed it in 2013. The workaround is no longer 
required for OpenSSL >= 1.1.0. You can find more details in 
https://jbp.io/2015/08/11/pbkdf2-performance-matters/

--
Added file: 
http://bugs.python.org/file44048/Port-Python-s-SSL-module-to-OpenSSL-1.1.0-2.patch

___
Python tracker 

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



Make sure you removed all debugging print statements error

2016-08-08 Thread aaryanreviews
Hello guys! I was answering a question on a piece of homework of mine. Sadly I 
can't answer it correctly due to the repetitive error being "Make sure you 
removed all debugging print statements." Hopefully one of you guys can help me 
solve this and also make me understand why I keep on getting this error.

Piece of code:

class Person(object):
def __init__(self, name):
self.name = name
try:
firstBlank = name.rindex(' ')
self.lastName = name[firstBlank+1:]
except:
self.lastName = name
self.age = None
def getLastName(self):
return self.lastName
def setAge(self, age):
self.age = age
def getAge(self):
if self.age == None:
raise ValueError
return self.age
def __lt__(self, other):
if self.lastName == other.lastName:
return self.name < other.name
return self.lastName < other.lastName
def __str__(self):
return self.name

class USResident(Person):
def __init__(self, name, status):
self.name = name
self.status = status

def getStatus(self):
return self.status

# def getName(self):
# return self.name


a = USResident('Tim Beaver', 'citizen')
print a.getStatus()
# print(a.getName())

b = USResident('Tim Horton', 'non-resident')
print b.getStatus()

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


[issue12319] [http.client] HTTPConnection.request not support "chunked" Transfer-Encoding to send data

2016-08-08 Thread Rolf Krahl

Rolf Krahl added the comment:

Martin,

> I wonder if it would be safer to test for TextIOBase. With the
> read(0) hack, the zero size may be unexpected. A file object may
> need special handling to generate an empty result, or to not
> interpret it as an EOF indicator. See e.g. Issue 23804, about
> zero-sized SSL reads, where both of these problems happened. As long
> as we document that the text file logic has changed, I think it
> would be okay. IMO it is better to keep things simple and robust for
> byte files than add more hacks for text files.

The problem is that there is no accepted definition of what a file-like object 
is.  As a consequence, each test method will fail in some cases.  Not all 
file-like objects are derived from the base classes in the io module.  It is 
common praxis to simply define an object with a read() method and to consider 
this a file-like.  This pattern can even be found in the official Python test 
suite.  Testing for TextIOBase will fail in these cases.

There seem to be at least a minimal consensus that each file-like (that 
supports reading) must have the read() method implementing the interface as 
defined by the io base classes.  The read(0) test (I wouldn't call it a hack, 
as it only uses this documented API) has the advantage of making no other 
assumptions then this.  And I even would not accept Issue 23804 as a counter 
example as this was clearly a bug in the ssl module.

The current test using the mode attribute is certainly the worst one as it even 
fails for standard classes from the io module.

Anyway.  Even though I would prefer the read(0) test, I am happy to accept any 
other method.  Please tell me what I should use.


> However I still don’t see why the checks are worthwhile. Sure having
> both is a technical violation of the current HTTP protocols. But if
> a caller is likely to end up in one of these situations, it may
> indicate a problem with the API that we should fix instead. If the
> checks are unlikely to ever fail, then drop them.

The question is whether we should apply sanity checks on caller's input or 
whether we should rather send bullshit out and wait for the request to fail.  
I'd rather give the caller a somewhat helpful error message rather then a 
lesser helpful "400 Bad Request" from the server.  But if you really insist, I 
can also remove these checks.

I don't understand your remark on the API and what the likeliness of rubbish 
header values set by the caller has to do with it, sorry.

> Otherwise, I don’t think any of the bugs I pointed out have been
> addressed.

Could you elaborate on what bugs you are talking about?  I really don't know, 
sorry.

> I don’t like converting bytes-like to bytes. I understand one of the
> main purposes of accepting bytes-like objects is to avoid copying
> them, but converting to bytes defeats that. Also, the copying is
> inconsistent with the lack of copying in _read_iterable().

I added this conversion because you mentioned Issue 27340 and the problem to 
send byte-like objects with the ssl module.  I agree to leave this to Issue 
27340 to find a better solution and will remove the conversion.

> I am wondering if it would be best to keep new logic out of send();
> just put it into _send_output() instead. Once upon a time, send()
> was a simple wrapper around socket.sendall() without much bloat. But
> with the current patch, in order to send a single buffer, we have to
> jump through a bunch of checks, create a dummy lambda and singleton
> tuple, loop over the singleton, call the lambda, realize there is no
> chunked encoding, etc. IMO the existing support for iterables should
> have been put in _send_output() too (when that was an option). There
> is no need to use send() to send the whole body when endheaders()
> already supports that.

No problem, I can move all this to _send_output().  The only problem that I see 
then, is that the current library version of send() already accepts file-like 
(both text and byte streams), bytes, and iterables.  So we will end up with two 
different methods accepting this variety of data types and behaving differently 
in the respective cases.

Maybe, as a consequence, one should restrict send() to accept only bytes in 
order to tighten consistency.  But this is not in the scope of this Issue and 
will not be covered by my patch.


Please note that I will be in holidays starting with next Monday.  We should 
try to get this done during this week.

--

___
Python tracker 

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



[issue27708] Roudning/Large Int representation error with multiplication and division

2016-08-08 Thread Eric V. Smith

Eric V. Smith added the comment:

Actually, Python represents large integers exactly. Can you provide a specific 
example of a problem you're seeing?

--
components: +Interpreter Core -ctypes
nosy: +eric.smith

___
Python tracker 

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



[issue27702] Only use SOCK_RAW when defined

2016-08-08 Thread Berker Peksag

Berker Peksag added the comment:

Thanks!

--
nosy: +berker.peksag
resolution:  -> fixed
stage:  -> resolved
status: open -> closed
title: [Patch] Only use SOCK_RAW when defined -> Only use SOCK_RAW when defined
type:  -> enhancement

___
Python tracker 

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



[issue27702] [Patch] Only use SOCK_RAW when defined

2016-08-08 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 535f88ad80d8 by Berker Peksag in branch 'default':
Issue #27702: Only expose SOCK_RAW when defined
https://hg.python.org/cpython/rev/535f88ad80d8

--
nosy: +python-dev

___
Python tracker 

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



[issue27708] Roudning/Large Int representation error with multiplication and division

2016-08-08 Thread Ethan Glass

New submission from Ethan Glass:

Python represents large integers as floating-points, which may or may not be 
the cause or part of the cause of division of said large integers evaluating to 
a floating-point number usually within a 1-integer range of the correct result.

--
components: ctypes
messages: 272160
nosy: eglass
priority: normal
severity: normal
status: open
title: Roudning/Large Int representation error with multiplication and division
type: behavior
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



[issue26209] TypeError in smtpd module with string arguments

2016-08-08 Thread Berker Peksag

Changes by Berker Peksag :


--
stage: needs patch -> patch review

___
Python tracker 

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



[issue26209] TypeError in smtpd module with string arguments

2016-08-08 Thread Ram Vallury

Ram Vallury added the comment:

Submitting patch 2 for smtpd doc changes

--
Added file: http://bugs.python.org/file44047/smtpd_doc_updated_2.patch

___
Python tracker 

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



[issue23322] parser module docs missing second example

2016-08-08 Thread Roundup Robot

Roundup Robot added the comment:

New changeset b479e74f7706 by Berker Peksag in branch '3.5':
Issue #23322: Remove outdated reference to an example in parser docs
https://hg.python.org/cpython/rev/b479e74f7706

New changeset 099fd7954941 by Berker Peksag in branch 'default':
Issue #23322: Merge from 3.5
https://hg.python.org/cpython/rev/099fd7954941

--
nosy: +python-dev

___
Python tracker 

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



[issue23322] parser module docs missing second example

2016-08-08 Thread Berker Peksag

Berker Peksag added the comment:

Thanks, Sahil.

--
resolution:  -> fixed
stage: needs patch -> resolved
status: open -> closed
type:  -> behavior
versions: +Python 3.6 -Python 3.4

___
Python tracker 

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



[issue23369] integer overflow in _json.encode_basestring_ascii

2016-08-08 Thread immerse

immerse added the comment:

I noticed that this is only fixed for python 3.3 and 3.4, not for 2.7. Is that 
intentional? If so, why?

--
nosy: +immerse -pkt

___
Python tracker 

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



[issue26945] difflib.HtmlDiff().make_file() treat few change as whole line change

2016-08-08 Thread JW

JW added the comment:

please find attached the reproducer C.7z

this issue only happens with this format of data before and after the difference

--
Added file: http://bugs.python.org/file44046/C.7z

___
Python tracker 

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



[issue26209] TypeError in smtpd module with string arguments

2016-08-08 Thread Ram Vallury

Ram Vallury added the comment:

Updated the documentation of smtpd.
https://docs.python.org/3/library/smtpd.html#smtpserver-objects




* this is my first patch, please revert back to me or make learn if I do any 
mistake*

--
keywords: +patch
nosy: +rvallury
Added file: http://bugs.python.org/file44045/smtpd_doc_updated.patch

___
Python tracker 

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



RE: Python and 64bit Windows7

2016-08-08 Thread Joaquin Alzola
>I am having problems when installing Python on a 64bit windows7 laptop.
>I am guessing that the problem is happening because of the 64bit architecture.
>Could you please take a look at the attached file that has screen shots of the 
>problem I am facing?
>Could you tell me how I can fix these issues and get Python and PyCharm to 
>work?

Mailing list doesn't allow attachments so please post you error through writing 
it into text.
This email is confidential and may be subject to privilege. If you are not the 
intended recipient, please do not copy or disclose its content but contact the 
sender immediately upon receipt.
-- 
https://mail.python.org/mailman/listinfo/python-list


  1   2   >