[issue22464] Speed up fractions implementation

2014-09-24 Thread Stefan Behnel

Stefan Behnel added the comment:

BTW, the last two patches (int4 and redundant_property) are ready to be 
applied. Anyone?

--

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



[issue22464] Speed up fractions implementation

2014-09-24 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 646bc7d3544b by Georg Brandl in branch 'default':
#22464: Speed up common Fraction operations by special-casing several
https://hg.python.org/cpython/rev/646bc7d3544b

--
nosy: +python-dev

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



[issue22464] Speed up fractions implementation

2014-09-24 Thread Georg Brandl

Georg Brandl added the comment:

Left this open in case you have additional patches coming.

--
nosy: +georg.brandl

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



[issue12006] strptime should implement %V or %u directive from libc

2014-09-24 Thread Erik Cederstrand

Erik Cederstrand added the comment:

I don't have the repo handy to make a patch against 3.5, but would an addition 
like this do?


in Lib/_strptime.py:

+elif iso_week != -1 and iso_year == -1:
+raise ValueError('%Y' directive is ambiguous in combination with 
'%V'. Use '%G' instead.)
+elif julian == -1 and iso_week != -1 and iso_weekday != -1:
+year, julian = _calc_julian_from_V(iso_year, iso_week, iso_weekday)



In Lib/test/test_strptime.py:

def test_ValueError(self):
+# Make sure ValueError is raised when match fails or format is bad
+self.assertRaises(ValueError, _strptime._strptime, data_string=1905 
52,
+  format=%Y %V)

--

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



[issue22477] GCD in Fractions

2014-09-24 Thread Brian Gladman

New submission from Brian Gladman:

There is a discussion of this issue on comp.lang.python

The function known as 'the greatest common divisor' has a number of well 
defined mathematical properties for both positive and negative integers (see, 
for example, Elementary Number Theory by Kenneth Rosen). In particular gcd(a, 
b) = gcd(|a|, |b|).  

But the Python version of this function in the fractions module doesn't conform 
to these properties since it returns a negative value when its second parameter 
is negative.  

This behaviour is documented but I think it is undesirable to provide a 
function that has the well known and widely understood name 'gcd', but one that 
doesn't match the behaviour normally associated with this function.

I hence believe that consideration should be given to changing the behaviour of 
the Python greatest common divisor function to match the mathematical 
properties expected of this function.  If necessary a local function in the 
fractions module could maintain the current behaviour.

--
components: Library (Lib)
messages: 227410
nosy: b...@gladman.plus.com
priority: normal
severity: normal
status: open
title: GCD in Fractions
type: behavior
versions: Python 3.4

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



[issue5550] [urllib.request]: Comparison of HTTP headers should be insensitive to the case

2014-09-24 Thread karl

karl added the comment:

Ok my tests are ok.

→ ./python.exe -m unittest -v Lib/test/test_urllib2net.py 

test_close (Lib.test.test_urllib2net.CloseSocketTest) ... ok
test_custom_headers (Lib.test.test_urllib2net.OtherNetworkTests) ... FAIL
test_file (Lib.test.test_urllib2net.OtherNetworkTests) ... test_ftp 
(Lib.test.test_urllib2net.OtherNetworkTests) ... skipped Resource 
'ftp://gatekeeper.research.compaq.com/pub/DEC/SRC/research-reports/00README-Legal-Rules-Regs'
 is not available
test_headers_case_sensitivity (Lib.test.test_urllib2net.OtherNetworkTests) ... 
ok
test_redirect_url_withfrag (Lib.test.test_urllib2net.OtherNetworkTests) ... ok
test_sites_no_connection_close (Lib.test.test_urllib2net.OtherNetworkTests) ... 
ok
test_urlwithfrag (Lib.test.test_urllib2net.OtherNetworkTests) ... ok
test_ftp_basic (Lib.test.test_urllib2net.TimeoutTest) ... ok
test_ftp_default_timeout (Lib.test.test_urllib2net.TimeoutTest) ... ok
test_ftp_no_timeout (Lib.test.test_urllib2net.TimeoutTest) ... ok
test_ftp_timeout (Lib.test.test_urllib2net.TimeoutTest) ... ok
test_http_basic (Lib.test.test_urllib2net.TimeoutTest) ... ok
test_http_default_timeout (Lib.test.test_urllib2net.TimeoutTest) ... ok
test_http_no_timeout (Lib.test.test_urllib2net.TimeoutTest) ... ok
test_http_timeout (Lib.test.test_urllib2net.TimeoutTest) ... ok


I wonder if test_custom_headers fails because of my modifications.

--

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



[issue22477] GCD in Fractions

2014-09-24 Thread STINNER Victor

STINNER Victor added the comment:

See also issue #22464.

--
nosy: +haypo

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



[issue22477] GCD in Fractions

2014-09-24 Thread Mark Dickinson

Mark Dickinson added the comment:

+1 from me.

--
nosy: +mark.dickinson

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



[issue22408] Tkinter doesn't handle Unicode dead key combinations on Windows

2014-09-24 Thread Drekin

Drekin added the comment:

I installed wish and tried the demos shipped with Python. The behavior occurs 
during the demo basic editable text. So it's an issue of Tk itself. Actually 
the same behavior occurs even in the wish shell.

--

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



[issue17835] test_io broken on PPC64 Linux

2014-09-24 Thread James Spurin

James Spurin added the comment:

I encountered similar issues to those discussed in this issue whilst compiling 
3.4.1 on 'Red Hat Enterprise Linux Server release 6.5 (Santiago)'

In particular, the following tests were failing -

[root@lonlx90800 ~]# /local/0/python-3.4.1/bin/python3 
/local/0/python-3.4.1/lib/python3.4/test/test_asyncio/test_subprocess.py
F...F...
==
FAIL: test_broken_pipe (__main__.SubprocessFastWatcherTests)
--
Traceback (most recent call last):
  File 
/local/0/python-3.4.1/lib/python3.4/test/test_asyncio/test_subprocess.py, 
line 129, in test_broken_pipe
self.loop.run_until_complete(proc.communicate(large_data))
AssertionError: BrokenPipeError not raised

==
FAIL: test_broken_pipe (__main__.SubprocessSafeWatcherTests)
--
Traceback (most recent call last):
  File 
/local/0/python-3.4.1/lib/python3.4/test/test_asyncio/test_subprocess.py, 
line 129, in test_broken_pipe
self.loop.run_until_complete(proc.communicate(large_data))
AssertionError: BrokenPipeError not raised

In this case, the issues are being caused by the following kernel parameters 
that we have for our default build -

#
## TIBCO network tuning #
#
net.core.rmem_default = 33554432
net.core.wmem_default = 33554432
net.core.rmem_max = 33554432
net.core.wmem_max = 33554432

Toggling the support.PIPE_MAX_SIZE to +32MB or temporarily removing these 
parameters mitigates the issue.  Is there a better way of calculating 
support.PIPE_MAX_SIZE so it is reflective of the actual OS value?

--
nosy: +spurin

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



[issue22478] tests for urllib2net are in bad shapes

2014-09-24 Thread karl

New submission from karl:

→ ./python.exe -V
Python 3.4.2rc1+

→ hg tip
changeset:   92532:6dcc96fa3970
tag: tip
parent:  92530:ad45c2707006
parent:  92531:8eb4eec8626c
user:Benjamin Peterson benja...@python.org
date:Mon Sep 22 22:44:21 2014 -0400
summary: merge 3.4 (#22459)


When working on issue #5550, I realized that some tests are currently failing.

Here the log of running:
→ ./python.exe -m unittest -v Lib/test/test_urllib2net.py 


test_close (Lib.test.test_urllib2net.CloseSocketTest) ... ok
test_custom_headers (Lib.test.test_urllib2net.OtherNetworkTests) ... FAIL
test_file (Lib.test.test_urllib2net.OtherNetworkTests) ... test_ftp 
(Lib.test.test_urllib2net.OtherNetworkTests) ... skipped Resource 
'ftp://gatekeeper.research.compaq.com/pub/DEC/SRC/research-reports/00README-Legal-Rules-Regs'
 is not available
test_redirect_url_withfrag (Lib.test.test_urllib2net.OtherNetworkTests) ... ok
test_sites_no_connection_close (Lib.test.test_urllib2net.OtherNetworkTests) ... 
ok
test_urlwithfrag (Lib.test.test_urllib2net.OtherNetworkTests) ... ok
test_ftp_basic (Lib.test.test_urllib2net.TimeoutTest) ... ok
test_ftp_default_timeout (Lib.test.test_urllib2net.TimeoutTest) ... ok
test_ftp_no_timeout (Lib.test.test_urllib2net.TimeoutTest) ... ok
test_ftp_timeout (Lib.test.test_urllib2net.TimeoutTest) ... ok
test_http_basic (Lib.test.test_urllib2net.TimeoutTest) ... ok
test_http_default_timeout (Lib.test.test_urllib2net.TimeoutTest) ... ok
test_http_no_timeout (Lib.test.test_urllib2net.TimeoutTest) ... ok
test_http_timeout (Lib.test.test_urllib2net.TimeoutTest) ... ok

==
ERROR: test_file (Lib.test.test_urllib2net.OtherNetworkTests) 
(url='file:/Users/karl/code/cpython/%40test_61795_tmp')
--
Traceback (most recent call last):
  File /Users/karl/code/cpython/Lib/test/test_urllib2net.py, line 243, in 
_test_urls
f = urlopen(url, req, TIMEOUT)
  File /Users/karl/code/cpython/Lib/test/test_urllib2net.py, line 33, in 
wrapped
return _retry_thrice(func, exc, *args, **kwargs)
  File /Users/karl/code/cpython/Lib/test/test_urllib2net.py, line 23, in 
_retry_thrice
return func(*args, **kwargs)
  File /Users/karl/code/cpython/Lib/urllib/request.py, line 447, in open
req = Request(fullurl, data)
  File /Users/karl/code/cpython/Lib/urllib/request.py, line 267, in __init__
origin_req_host = request_host(self)
  File /Users/karl/code/cpython/Lib/urllib/request.py, line 250, in 
request_host
host = _cut_port_re.sub(, host, 1)
TypeError: expected string or buffer

==
ERROR: test_file (Lib.test.test_urllib2net.OtherNetworkTests) 
(url=('file:///nonsensename/etc/passwd', None, class 'urllib.error.URLError'))
--
Traceback (most recent call last):
  File /Users/karl/code/cpython/Lib/test/test_urllib2net.py, line 243, in 
_test_urls
f = urlopen(url, req, TIMEOUT)
  File /Users/karl/code/cpython/Lib/test/test_urllib2net.py, line 33, in 
wrapped
return _retry_thrice(func, exc, *args, **kwargs)
  File /Users/karl/code/cpython/Lib/test/test_urllib2net.py, line 23, in 
_retry_thrice
return func(*args, **kwargs)
  File /Users/karl/code/cpython/Lib/urllib/request.py, line 447, in open
req = Request(fullurl, data)
  File /Users/karl/code/cpython/Lib/urllib/request.py, line 267, in __init__
origin_req_host = request_host(self)
  File /Users/karl/code/cpython/Lib/urllib/request.py, line 250, in 
request_host
host = _cut_port_re.sub(, host, 1)
TypeError: expected string or buffer

==
FAIL: test_custom_headers (Lib.test.test_urllib2net.OtherNetworkTests)
--
Traceback (most recent call last):
  File /Users/karl/code/cpython/Lib/test/test_urllib2net.py, line 186, in 
test_custom_headers
self.assertEqual(request.get_header('User-agent'), 'Test-Agent')
AssertionError: 'Python-urllib/3.4' != 'Test-Agent'
- Python-urllib/3.4
+ Test-Agent


--
Ran 16 tests in 124.879s

FAILED (failures=1, errors=2, skipped=1)

--
components: Tests
messages: 227417
nosy: karlcow
priority: normal
severity: normal
status: open
title: tests for urllib2net are in bad shapes
versions: Python 3.5

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



[issue5550] [urllib.request]: Comparison of HTTP headers should be insensitive to the case

2014-09-24 Thread karl

karl added the comment:

Opened issue #22478 for the tests failing. Not related to my modification.

--

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



[issue22477] GCD in Fractions

2014-09-24 Thread Mark Dickinson

Mark Dickinson added the comment:

The current `gcd` definition is almost accidental, in that it just happens to 
be what's convenient for use in normalisation in the Fraction type.  If people 
are using it as a standalone implementation of gcd, independent of the 
fractions module, then defining the result to be always nonnegative is probably 
a little less surprising than the current behaviour.

BTW, I don't think there's a universally agreed definition for the extension of 
the gcd to negative numbers (and I certainly wouldn't take Rosen's book as 
authoritative: did you notice the bit where he talks about 35-bit machines 
being common?), so I don't regard the fraction module definition as wrong, per 
se.  But I do agree that the behaviour you propose would be less surprising.

One other thought: if we're really intending for gcd to be used independently 
of the fractions module, perhaps it should be exposed as math.gcd.  (That would 
also give the opportunity for an optimised C version.)

--

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



[issue22478] tests for urllib2net are in bad shapes

2014-09-24 Thread karl

karl added the comment:

ok let's see

→ ./python.exe -m unittest -v 
Lib.test.test_urllib2net.OtherNetworkTests.test_custom_headers
test_custom_headers (Lib.test.test_urllib2net.OtherNetworkTests) ... FAIL

==
FAIL: test_custom_headers (Lib.test.test_urllib2net.OtherNetworkTests)
--
Traceback (most recent call last):
  File /Users/karl/code/cpython/Lib/test/test_urllib2net.py, line 186, in 
test_custom_headers
self.assertEqual(request.get_header('User-agent'), 'Test-Agent')
AssertionError: 'Python-urllib/3.4' != 'Test-Agent'
- Python-urllib/3.4
+ Test-Agent


--
Ran 1 test in 0.551s

FAILED (failures=1)


→ ./python.exe
Python 3.4.2rc1+ (3.4:8eb4eec8626c+, Sep 23 2014, 21:53:11) 
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.51)] on darwin
Type help, copyright, credits or license for more information.
 import urllib.request
 url = 'http://127.0.0.1/'
 opener = urllib.request.build_opener()
 request = urllib.request.Request(url)
 request.header_items()
[]
 request.headers
{}
 request.add_header('User-Agent', 'Test-Agent')
 request.headers
{'User-agent': 'Test-Agent'}
 request.header_items()
[('User-agent', 'Test-Agent')]
 opener.open(request)
http.client.HTTPResponse object at 0x10c0aedc0
 request.get_header('User-agent'), 'Test-Agent'
('Test-Agent', 'Test-Agent')
 request.header_items()
[('User-agent', 'Test-Agent'), ('Host', '127.0.0.1')]
 request.headers
{'User-agent': 'Test-Agent'}


OK so far so good.
And my server recorded 
127.0.0.1 - - [24/Sep/2014:17:07:41 +0900] GET / HTTP/1.1 200 9897 - 
Test-Agent


Let's do it the way, the test has been designed.

→ ./python.exe
Python 3.4.2rc1+ (3.4:8eb4eec8626c+, Sep 23 2014, 21:53:11) 
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.51)] on darwin
Type help, copyright, credits or license for more information.
 import urllib.request
 url = 'http://127.0.0.1/'
 opener = urllib.request.build_opener()
 request = urllib.request.Request(url)
 request.header_items()
[]
 opener.open(request)
http.client.HTTPResponse object at 0x10e05aa80
 request.header_items()
[('User-agent', 'Python-urllib/3.4'), ('Host', '127.0.0.1')]
 request.has_header('User-agent')
True
 request.add_header('User-Agent', 'Test-Agent')
 opener.open(request)
http.client.HTTPResponse object at 0x10e05ab50
 request.get_header('User-agent'), 'Test-Agent'
('Python-urllib/3.4', 'Test-Agent')
 request.add_header('Foo', 'bar')
 request.header_items()
[('User-agent', 'Test-Agent'), ('Host', '127.0.0.1'), ('Foo', 'bar')]
 opener.open(request)
http.client.HTTPResponse object at 0x10e05ad58
 request.header_items()
[('User-agent', 'Test-Agent'), ('Host', '127.0.0.1'), ('Foo', 'bar')]
 request.get_header('User-agent'), 'Test-Agent'
('Python-urllib/3.4', 'Test-Agent')
 request.headers
{'User-agent': 'Test-Agent', 'Foo': 'bar'}


And the server recorded.

127.0.0.1 - - [24/Sep/2014:17:12:52 +0900] GET / HTTP/1.1 200 9897 - 
Python-urllib/3.4
127.0.0.1 - - [24/Sep/2014:17:12:52 +0900] GET / HTTP/1.1 200 9897 - 
Python-urllib/3.4
127.0.0.1 - - [24/Sep/2014:17:14:15 +0900] GET / HTTP/1.1 200 9897 - 
Python-urllib/3.4

So it seems that User-Agent is immutable once it has been set the first time. 
Not in  the same dictionary.


 request.unredirected_hdrs
{'User-agent': 'Python-urllib/3.4', 'Host': '127.0.0.1'}

--

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



[issue22408] Tkinter doesn't handle Unicode dead key combinations on Windows

2014-09-24 Thread Ned Deily

Ned Deily added the comment:

OK, then if you want to pursue the issue, I'd suggest asking on one of the 
Tcl/Tk forums (perhaps comp.lang.tcl) or Stackoverflow and/or checking the Tk 
issue tracker (https://core.tcl.tk/tk/reportlist).  Good luck!

--
resolution:  - third party
stage:  - resolved
status: open - closed

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



[issue22478] tests for urllib2net are in bad shapes

2014-09-24 Thread karl

karl added the comment:

Ah! the User-Agent (or anything which is in unredirected_hdrs) will not be 
updated if it has already been set once. 
https://hg.python.org/cpython/file/064f6baeb6bd/Lib/urllib/request.py#l1154


 headers = dict(request.unredirected_hdrs)
 headers
{'User-agent': 'Python-urllib/3.4', 'Host': '127.0.0.1'}
 request.headers
{'User-agent': 'Test-Agent', 'Foo': 'cool'}
 headers.update(dict((k, v) for k, v in request.headers.items() if k not in 
 headers))
 headers
{'User-agent': 'Python-urllib/3.4', 'Host': '127.0.0.1', 'Foo': 'cool'}

--

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



[issue22478] tests for urllib2net are in bad shapes

2014-09-24 Thread Ned Deily

Changes by Ned Deily n...@acm.org:


--
nosy: +orsenthil

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



[issue22477] GCD in Fractions

2014-09-24 Thread gladman

gladman added the comment:

On 24/09/2014 08:58, Mark Dickinson wrote:
 
 Mark Dickinson added the comment:
 
 The current `gcd` definition is almost accidental, in that it just happens to 
 be what's convenient for use in normalisation in the Fraction type.  If 
 people are using it as a standalone implementation of gcd, independent of the 
 fractions module, then defining the result to be always nonnegative is 
 probably a little less surprising than the current behaviour.
 
 BTW, I don't think there's a universally agreed definition for the extension 
 of the gcd to negative numbers (and I certainly wouldn't take Rosen's book as 
 authoritative: did you notice the bit where he talks about 35-bit machines 
 being common?), so I don't regard the fraction module definition as wrong, 
 per se.  But I do agree that the behaviour you propose would be less 
 surprising.

I only quoted Rosen because I had it immediately to hand.  I will
willingly supply more references if you need them.  Sadly even some
maths books don't cover this at all but then go on to rely on the
co-prime test gcd(a, b) == 1 even when a and/or b can be negative.
So I would agree that it is easy to conclude that the gcd is not defined
for negative numbers.  But, of those maths texts that explicitly cover
the behaviour of the gcd for negative numbers, I do not know of any that
do not define gcd(a, b) to be gcd(|a|, |b|).

 One other thought: if we're really intending for gcd to be used independently 
 of the fractions module, perhaps it should be exposed as math.gcd.  (That 
 would also give the opportunity for an optimised C version.)

To me it makes more sense to put this in math as this is where I would
expect to find it.  But a comment on comp.lang.python was not in favour
of this.

--
nosy: +gladman

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



[issue22475] asyncio task get_stack documentation seems to contradict itself

2014-09-24 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


--
nosy: +giampaolo.rodola, gvanrossum, haypo, pitrou, yselivanov

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



[issue22476] asyncio task chapter confusion about 'task', 'future', and 'schedule'

2014-09-24 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


--
nosy: +giampaolo.rodola, gvanrossum, haypo, pitrou, yselivanov

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



[issue22474] No explanation of how a task gets destroyed in asyncio 'task' documentation

2014-09-24 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


--
nosy: +giampaolo.rodola, gvanrossum, haypo, pitrou, yselivanov

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



[issue22473] The gloss on asyncio future with run_forever example is confusing

2014-09-24 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


--
nosy: +giampaolo.rodola, gvanrossum, haypo, pitrou, yselivanov

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



[issue18629] future division breaks timedelta division by integer

2014-09-24 Thread Antoine Pitrou

Antoine Pitrou added the comment:

It's not a duplicate.

--
status: pending - open

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



[issue18993] There is an overshadowed and invalid test in testmock.py

2014-09-24 Thread Berker Peksag

Berker Peksag added the comment:

This has been fixed in https://hg.python.org/cpython/rev/c8c11082bd0c.

--
nosy: +berker.peksag
resolution:  - out of date
stage:  - resolved
status: open - closed

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



[issue21049] Warning at interpreter exit triggers flood of “ImportWarning: sys.meta_path is empty”

2014-09-24 Thread Quentin Pradet

Quentin Pradet added the comment:

I've also been affected by this when testing integration with a third-party 
library (NLTK). NLTK does need to be fixed, but the ResourceWarning already say 
so.

The new one-liner doesn't seem contrived to me.

--
nosy: +Quentin.Pradet

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



[issue22477] GCD in Fractions

2014-09-24 Thread Mark Dickinson

Mark Dickinson added the comment:

 I will willingly supply more references if you need them.

I don't. :-) I've taught more elementary number classes and reviewed more 
elementary number theory texts (including Rosen's) than I care to remember, and 
I have plenty of my own references. I stand by my assertion that the fractions 
module gcd is not wrong:  it returns 'a' greatest common divisor for arbitrary 
integer inputs.

A bit more: the concept of greatest common divisor is slightly ambiguous:  you 
can define the notion of a greatest common divisor for an arbitrary 
commutative ring-with-a-1 R:  c is a greatest common divisor of a and b if c is 
a common divisor (i.e. c divides a and c divides b, where x divides y is 
synonymous with y is a multiple of x), and any other common divisor divides 
c.  No ordering is necessary: greatest here is with respect to the 
divisibility lattice rather than with respect to any kind of total ordering.  
One advantage of this definition is that it makes it clear that 0 is a greatest 
common divisor of 0 and 0.

If further R is an integral domain, then it follows immediately from the 
definition that any two greatest common divisors of a and b (if they exist) are 
associates: a is a unit times b.  In the particular case where R is the usual 
ring of rational integers, that means that the greatest common divisor of two 
numbers a and b is only really defined up to +/-;  that is, the sign of the 
result is unimportant.  (An alternative viewpoint is to think of the gcd, when 
it exists, as a principal ideal rather than an element of the ring.)

See 
https://proofwiki.org/wiki/Definition:Greatest_Common_Divisor/Integral_Domain 
for more along these lines.

So you're using one definition, I'm using another.  Like I said, there's no 
universal agreement. ;-).

--

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



[issue22479] strange behavior of importing random module

2014-09-24 Thread Bekket McClane

New submission from Bekket McClane:

When I import the random module using import random in the command line, it 
worked fine. But if I import it in the file, the program will throw a strange 
error, but sometimes it just exit right away after the import statement with no 
error. Moreover, if I execute the python command line again and import random 
after that, the command line python exit right away too(with exit code 0). Only 
if I restarted the whole terminal program did the strange behavior gone

--
components: Library (Lib)
files: Screenshot from 2014-09-24 17:04:58.png
messages: 227428
nosy: Bekket.McClane
priority: normal
severity: normal
status: open
title: strange behavior of importing random module
type: crash
versions: Python 2.7
Added file: http://bugs.python.org/file36705/Screenshot from 2014-09-24 
17:04:58.png

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



[issue22478] tests for urllib2net are in bad shapes

2014-09-24 Thread Senthil Kumaran

Senthil Kumaran added the comment:

I suspect that you have your interpreters confused. (For e.g, I see 3.4 run 
against the trunk and the error messages are leading me to believe that 2.7 
version in run on 3 code).

Or your local copy is not in right shape.

I tested it on 3.4 and cpython default and everything was OK.

[localhost 3.4]$ ./python.exe -m unittest -v Lib/test/test_urllib2net.py
...
Ran 15 tests in 36.672s

OK
[localhost 3.4]$ hg log -r 3.4
changeset:   92551:bce1594023f9
branch:  3.4
parent:  92548:381d6362c7bc
parent:  92546:ff2cb4dc36e7
user:Serhiy Storchaka storch...@gmail.com
date:Tue Sep 23 23:23:41 2014 +0300
description:
Merge heads

[localhost cpython]$ ./python.exe -m unittest -v Lib/test/test_urllib2net.py
...
Ran 15 tests in 32.779s

OK
[localhost cpython]$ hg log -r tip
changeset:   92555:064f6baeb6bd
tag: tip
user:Georg Brandl ge...@python.org
date:Wed Sep 24 09:08:12 2014 +0200
files:   Python/importlib.h
description:
Update importlib.h frozen bytecode (changed due to commit c0ca9d32aed4).

--

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



[issue22478] tests for urllib2net are in bad shapes

2014-09-24 Thread Senthil Kumaran

Senthil Kumaran added the comment:

The buildbots are not showing this error too. I suggest you reset your local 
copy with the pristine one from remote, do a make distclean; ./configure; make 
and then run the tests.

--
assignee:  - orsenthil
resolution:  - works for me
stage:  - resolved
status: open - closed
type:  - behavior

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



[issue22479] strange behavior of importing random module

2014-09-24 Thread STINNER Victor

STINNER Victor added the comment:

It's not a bug in Python. The problem is that your project contains a file 
called random.py which is used instead of the random from the standard 
library. Rename the file (and remove random.pyc).

--
nosy: +haypo
resolution:  - not a bug
status: open - closed

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



[issue21860] Correct FileIO docstrings

2014-09-24 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 2058d94f32dd by Berker Peksag in branch '3.4':
Issue #21860: Correct docstrings of FileIO.seek() and FileIO.truncate() methods.
https://hg.python.org/cpython/rev/2058d94f32dd

New changeset de645efe6a9b by Berker Peksag in branch 'default':
Issue #21860: Correct docstrings of FileIO.seek() and FileIO.truncate() methods.
https://hg.python.org/cpython/rev/de645efe6a9b

--
nosy: +python-dev

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



[issue21860] Correct FileIO docstrings

2014-09-24 Thread Berker Peksag

Berker Peksag added the comment:

Thanks for the patch, Terry.

--
assignee: haypo - berker.peksag
nosy: +berker.peksag
resolution:  - fixed
stage: commit review - resolved
status: open - closed
versions: +Python 3.5 -Python 3.3

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



[issue21860] Correct FileIO docstrings

2014-09-24 Thread Roundup Robot

Roundup Robot added the comment:

New changeset be2746c565c2 by Berker Peksag in branch '2.7':
Issue #21860: Correct docstrings of FileIO.seek() and FileIO.truncate() methods.
https://hg.python.org/cpython/rev/be2746c565c2

--

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



[issue22427] TemporaryDirectory attempts to clean up twice

2014-09-24 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 7ea2153eae87 by Serhiy Storchaka in branch '3.4':
Issue #22427: TemporaryDirectory no longer attempts to clean up twice when
https://hg.python.org/cpython/rev/7ea2153eae87

New changeset e9d4288c32de by Serhiy Storchaka in branch 'default':
Issue #22427: TemporaryDirectory no longer attempts to clean up twice when
https://hg.python.org/cpython/rev/e9d4288c32de

--
nosy: +python-dev

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



[issue22477] GCD in Fractions

2014-09-24 Thread gladman

gladman added the comment:

On 24/09/2014 10:13, Mark Dickinson wrote:
 
 Mark Dickinson added the comment:
 
 I will willingly supply more references if you need them.
 
 I don't. :-) I've taught more elementary number classes and reviewed more 
 elementary number theory texts (including Rosen's) than I care to remember, 
 and I have plenty of my own references. I stand by my assertion that the 
 fractions module gcd is not wrong:  it returns 'a' greatest common divisor 
 for arbitrary integer inputs.

Well we will just have to agree to disagree on this :-)

--

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



[issue22219] python -mzipfile fails to add empty folders to created zip

2014-09-24 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Hmm, looks as I forgot to attach a patch.

--
keywords: +patch
Added file: http://bugs.python.org/file36706/zipfile_add_dirs.patch

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



[issue22427] TemporaryDirectory attempts to clean up twice

2014-09-24 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Committed without this test.

Thank you Victor and Yury for your comments.

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

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



[issue22477] GCD in Fractions

2014-09-24 Thread Mark Dickinson

Mark Dickinson added the comment:

 Well we will just have to agree to disagree on this :-)

Sure.  In the mean time, would you be interested in writing a patch targeting 
Python 3.5?  (Irrespective of the arguments about the definition, I don't think 
this is a change that could be applied in a 3.4 bugfix release.)

--
type: behavior - enhancement
versions: +Python 3.5 -Python 3.4

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



[issue22480] SystemExit out of run_until_complete causes AttributeError when using python3 -m

2014-09-24 Thread chrysn

New submission from chrysn:

the attached test.py snipplet, which runs an asyncio main loop to the 
completion of a coroutine raising SystemExit, runs cleanly when invoked using 
`python3 test.py`, but shows a logging error from the Task.__del__ method when 
invoked using `python3 -m test`.

the error message (attached as test.err) indicates that the builtins module has 
already been emptied by the time the Task's destructor is run.

i could reproduce the problem with an easier test case without asyncio 
(destructoretest.py), but then again, there the issue is slightly more obvious 
(one could argue a don't do that, then), and it occurs no matter how the 
program is run. i'm leaving this initially assigned to asyncio, because (to the 
best of my knowledge) test.py does not do bad things by itself, and the 
behavior is inconsistent only there.

--
components: asyncio
messages: 227440
nosy: chrysn, gvanrossum, haypo, yselivanov
priority: normal
severity: normal
status: open
title: SystemExit out of run_until_complete causes AttributeError when using 
python3 -m
versions: Python 3.4

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



[issue22480] SystemExit out of run_until_complete causes AttributeError when using python3 -m

2014-09-24 Thread chrysn

Changes by chrysn chr...@fsfe.org:


Added file: http://bugs.python.org/file36707/test.py

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



[issue22480] SystemExit out of run_until_complete causes AttributeError when using python3 -m

2014-09-24 Thread chrysn

Changes by chrysn chr...@fsfe.org:


Added file: http://bugs.python.org/file36708/test.err

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



[issue22480] SystemExit out of run_until_complete causes AttributeError when using python3 -m

2014-09-24 Thread chrysn

Changes by chrysn chr...@fsfe.org:


Added file: http://bugs.python.org/file36709/destructortest.py

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



[issue1602] windows console doesn't print or input Unicode

2014-09-24 Thread Stefan Champailler

Stefan Champailler added the comment:

Thank you all for your quick and good answers. This level of responsiveness is 
truly amazing.

I've played a bit with IPython and it works just fine. I can type the eurosign 
drectly with Alt Gr - E (so I didn't enter a unicode code). So the bug is 
basically solved for me. But the python-repl behaviour still looks strange to 
me. So here's a successful IPython session :

C:\PORT-STCA2\pl-PRIVATE\horsechcp 65001
Active code page: 65001

C:\PORT-STCA2\pl-PRIVATE\horseipython
Python 3.4.1 (v3.4.1:c0e311e010fc, May 18 2014, 10:38:22) [MSC v.1600 32 bit 
(Intel)]
Type copyright, credits or license for more information.

IPython 2.2.0 -- An enhanced Interactive Python.
? - Introduction and overview of IPython's features.
%quickref - Quick reference.
help  - Python's own help system.
object?   - Details about 'object', use 'object??' for extra details.
   
In [1]: print('€') 
€   
   
In [2]:

--

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



[issue22477] GCD in Fractions

2014-09-24 Thread gladman

gladman added the comment:

On 24/09/2014 11:54, Mark Dickinson wrote:
 
 Mark Dickinson added the comment:
 
 Well we will just have to agree to disagree on this :-)
 
 Sure.  In the mean time, would you be interested in writing a patch targeting 
 Python 3.5?  (Irrespective of the arguments about the definition, I don't 
 think this is a change that could be applied in a 3.4 bugfix release.)

Yes, I am very willing to contribute. But I have never contributed to
Python before and I almost certainly have a lot to learn in any attempt
to do this.

In particular, I need advice on where any gcd should go (fractions or
math or ...).  And if it goes in math and/or we want to speed it up, I
would have to learn how to integrate Python and C code (I have done
almost none of this before).

So I would much appreciate further discusssion of this possible change
and how best to implement it (if there is a consensus to do so).

Of course, there is the very simple change of adding abs(x) to the
return value for the current gcd and adjusting its single use in
fractions accordingly.  But since there is already concern about the
impact of the gcd on the performance of fractions, it deserves more
careful consideration than this approach would involve.

--

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



[issue22477] GCD in Fractions

2014-09-24 Thread Stefan Behnel

Stefan Behnel added the comment:

I suggest adding a new implementation instead of replacing the current function 
in the fractions module. As Mark noted, the current gcd() is more of a 
sideeffect of the fractions module, but there's no real need to change that. It 
works perfectly ok for a) the Fraction type and b) positive input values.

Even if there's no other module namespace for this functionality that is more 
suitable than fractions, it could still be added under a different name, say, 
absgcd() or whatever. Something that makes it clear(er) how negative input is 
handled. The mere name gcd isn't very telling on that front.

--
nosy: +scoder

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



[issue22477] GCD in Fractions

2014-09-24 Thread Akira Li

Akira Li added the comment:

Whether or not gcd(a, b) == gcd(|a|, |b|) depends on the definition if
we believe to Stepanov of C++ STL fame who mentions in his lecture [1]

[1] http://www.stepanovpapers.com/gcd.pdf

that the current implementation that uses two operation __bool__ and 
__mod__:

  def gcd(a, b):
  while b:
  a, b = b, a%b
  return a

can be applied to Euclidean ring elements (not just positive or
negative integers). Despite Knuth’s objection to gcd(1, -1) = -1, 
adding `if a  0: a = -a` at the end changes the requirements for the
type. Here's the definition from the lecture [1]:

  Greatest common divisor is a common divisor that is divisible by any 
  other common divisor.

I have no opinion on whether or not fractions.gcd() should be changed. 
I thought that I should mention that different definitions exist.

--
nosy: +akira

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



[issue22466] problem with installing python 2.7.8

2014-09-24 Thread Khalid

Khalid added the comment:

I tried but I got this error this installation package could not be
opened. verify that the package exists  that you can access it, or contact
the application vendor to verify that this is a valid windows installer
package (screen shot in the attachment)

by the way I'm admin!

On Tue, Sep 23, 2014 at 9:26 PM, Steve Dower rep...@bugs.python.org wrote:


 Steve Dower added the comment:

 Can you try running this command and then post the log file after
 installation fails:

  msiexec /l*vx log.txt /i path to .MSI

 --

 ___
 Python tracker rep...@bugs.python.org
 http://bugs.python.org/issue22466
 ___


--
Added file: http://bugs.python.org/file36703/Capture2.JPG

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22466
__
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16056] shadowed test names in std lib regression tests

2014-09-24 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 6d44906344f4 by Berker Peksag in branch '3.4':
Issue #16056: Rename test method in test_statistics to avoid conflict.
https://hg.python.org/cpython/rev/6d44906344f4

New changeset c49d7f4d1c04 by Berker Peksag in branch 'default':
Issue #16056: Rename test method in test_statistics to avoid conflict.
https://hg.python.org/cpython/rev/c49d7f4d1c04

--

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



[issue22477] GCD in Fractions

2014-09-24 Thread Steven D'Aprano

Steven D'Aprano added the comment:

I would be a lot more cautious about changing the gcd function. As Mark says, 
there is *not* a single well-defined meaning of the gcd for negative arguments. 
Even Wolfram can't decide which to use: Mathworld gives one interpretation, 
Mathematica the opposite. See my comments here:

https://mail.python.org/pipermail/python-list/2014-September/678681.html
 
Given that there is no one definitive definition of gcd, this is not a bug fix, 
it is a backward-incompatible functional change. That means it ought to go 
through a deprecation period before changing it:

- deprecate negative arguments in 3.5;
- raise a warning in 3.6;
- change the behaviour in 3.7.

*Maybe* we could skip the silent deprecation period and jump straight to the 
warning. But I don't see any justification for fast-tracking this, and 
certainly not for jumping straight to the change of behaviour. Somebody is 
using this function and expects it to do what it currently does, and changing 
it will break their code for precious little benefit.

Another objection: this suggested change will add yet another backwards 
incompatibility between Python 2.7 and 3.x. There ought to be a good reason for 
that, not just to save a single call to abs() after gcd.

I am -1 on making this change.

--
nosy: +steven.daprano

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



[issue22477] GCD in Fractions

2014-09-24 Thread Steven D'Aprano

Steven D'Aprano added the comment:

If we are considering adding a new gcd elsewhere (say, in the math module), 
then it should accept any arbitrary number of arguments, not just two. (At 
least one argument though.)

Also, Mathematica supports the GCD of rational numbers, not just integers. 
Should we do the same?

Would it be too confusing to have fractions.gcd and fractions.Fraction.gcd both 
exist but behave differently? I fear so.

I wish we had a mathlib.py standard module for pure Python implementations...

--

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



[issue16056] shadowed test names in std lib regression tests

2014-09-24 Thread Berker Peksag

Berker Peksag added the comment:

- issue 16079 opened for make patchcheck integration
- issue 19119 opened for test_heapq
- issue 19113 opened for test_functions

And here's a patch for 2.7.

--
nosy: +berker.peksag
stage: needs patch - patch review
versions: +Python 3.4, Python 3.5 -Python 3.2, Python 3.3
Added file: http://bugs.python.org/file36710/issue16056_27.diff

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



[issue22479] strange behavior of importing random module

2014-09-24 Thread Steven D'Aprano

Steven D'Aprano added the comment:

For future reference, we *strongly* recommend that instead of taking a screen 
shot and posting it as an attachment, you copy and paste the text directly. 
Don't retype it, any decent terminal application will allow you to select and 
copy the text, then paste it elsewhere.

--
nosy: +steven.daprano

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



[issue1602] windows console doesn't print or input Unicode

2014-09-24 Thread Nick Coghlan

Nick Coghlan added the comment:

Aye, IPython has the advantage of running in a fully initialised browser, with 
the backend in a fully initialised Python environment.

CPython's setting up the standard streams for the default REPL at a much lower 
level, and there are quite a few problems with the way we're currently doing it.

I think Drekin's pointed the way towards substantially improving the situation 
for 3.5, though.

--

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



[issue22481] Lists within tuples mutability issue

2014-09-24 Thread Владимир Тырин

New submission from Владимир Тырин:

This behavior seems to be very strange. 

 l = [1, 2, 3]
 t = ('a', l)
 t
('a', [1, 2, 3])
 t[1] += [4]
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: 'tuple' object does not support item assignment
 t
('a', [1, 2, 3, 4])

--
messages: 227451
nosy: Владимир.Тырин
priority: normal
severity: normal
status: open
title: Lists within tuples mutability issue
type: behavior
versions: Python 2.7

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



[issue22481] Lists within tuples mutability issue

2014-09-24 Thread Ezio Melotti

Ezio Melotti added the comment:

See 
https://docs.python.org/3/faq/programming.html#why-does-a-tuple-i-item-raise-an-exception-when-the-addition-works

--
nosy: +ezio.melotti
resolution:  - not a bug
stage:  - resolved
status: open - closed

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



[issue22476] asyncio task chapter confusion about 'task', 'future', and 'schedule'

2014-09-24 Thread STINNER Victor

STINNER Victor added the comment:

I know that the 18.5.3. Tasks and coroutines section of the documentation is 
probably the worst section :-( Feel free to suggest changes with a patch!

I started to enhance the documentation of the Task class, but there is still a 
lot of work to enhance the whole section.


 We then see an example that appears to include scheduling a future via 
 asyncio.async, because there is a specific mention of how we can attach a 
 callback after it is scheduled but before the event loop is started.

I guess that you are talking about this example?
https://docs.python.org/dev/library/asyncio-task.html#example-future-with-run-until-complete

You cannot schedule a Future object. A Future object doesn't contain code. It 
only schedules callbacks when set_result() or set_exception() is called.

In this example, a call to the slow_operation coroutine function is scheduled: 
slow_operation(future) creates a coroutine object which is wrapped into a 
Task object. A coroutine is disconnected from the event loop. The role of the 
task is to schedule the execution of a coroutine object.

It becomes more complex when you know that the Task class inherits from the 
Future class :-/


 I see that a Future is scheduled by its creation

Again, this is wrong. You cannot schedule a future. You can schedule a 
coroutine object by creating a task wrapping it.


 As a followon point, the gloss on example of parallel execution of tasks says 
 A task is automatically scheduled for execution when it is created.  The 
 event loop stops when all tasks are done.  This reads very strangely to me.  
 The first sentence seems to be pointing out the difference between this 
 example and the previous one with Future where we had to explicitly schedule 
 it (by calling async which creates a task...).  But it seems that that isn't 
 true...so why is that sentence there? The second sentence presumably refers 
 to the fact that run_until_complete runs the event loop until all scheduled 
 tasks are complete..because they are wrapped in 'wait'.  But wait is not 
 cross referenced or mentioned in the gloss, so I had to think about it 
 carefully and look up wait to conclude that that was what it meant.

Hum, I summarized too many information in The event loop stops when all tasks 
are done. In fact, the example stops when run_until_complete() finished its 
job.

--

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



[issue22474] No explanation of how a task gets destroyed in asyncio 'task' documentation

2014-09-24 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@gmail.com:


--
components: +asyncio

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



[issue22475] asyncio task get_stack documentation seems to contradict itself

2014-09-24 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@gmail.com:


--
components: +asyncio

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



[issue22474] No explanation of how a task gets destroyed in asyncio 'task' documentation

2014-09-24 Thread STINNER Victor

STINNER Victor added the comment:

destroyed means collected by the garbage collector, when the last reference 
the task objected was cleared. To be honest, I have no idea who keeps a 
reference to tasks nor how the pending task destroyed bug occurs.

pending means that the execution of the coroutine object didn't finish. In 
fact, it's related to Task.done(): a task is pending is task.done() is False.

There is a corner case: if task.cancel() was called but the coroutine object 
was not executed yet to handle the CancelledError, the task is still pending.

Maybe pending is not the best word, and not done is better.

--

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



[issue22472] OSErrors should use str and not repr on paths

2014-09-24 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
nosy: +ezio.melotti
type:  - behavior

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



[issue22473] The gloss on asyncio future with run_forever example is confusing

2014-09-24 Thread STINNER Victor

STINNER Victor added the comment:

But that isn't quite true.  It is the callback associated with the future that 
is displaying the result and stopping the loop.

I wrote this example to show that setting the result of a future can schedule a 
callback. I mean something like:

In this example, the future is used to link slow_operation() to got_result(): 
when slow_operation() is done, got_result() is called with the result.

The main idea behind Future is to chain callbacks and the link is done 
externally. It's different from this design:

def slow_operation(done_callback):
...
done_callback()

--

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



[issue22473] The gloss on asyncio future with run_forever example is confusing

2014-09-24 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@gmail.com:


--
components: +asyncio

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



[issue22427] TemporaryDirectory attempts to clean up twice

2014-09-24 Thread STINNER Victor

STINNER Victor added the comment:

Cool, the final code is simpler than before!

--

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



[issue22428] asyncio: KeyboardInterrupt inside a coroutine causes AttributeError

2014-09-24 Thread STINNER Victor

STINNER Victor added the comment:

The issue #22480 has been marked as a duplicate of this issue.

--

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



[issue22480] SystemExit out of run_until_complete causes AttributeError when using python3 -m

2014-09-24 Thread STINNER Victor

STINNER Victor added the comment:

Running python test.py and python -m test changes how the code is loaded. 
With python test.py, test.py becomes the __main__ module, whereas python 
-m test uses the test module.

At Python exit, the __main__ module and other modules are destroyed differently.

Anyway, this issue is another example of the issue #22428 and so I close it as 
duplicate.

--
resolution:  - duplicate
superseder:  - asyncio: KeyboardInterrupt inside a coroutine causes 
AttributeError
versions: +Python 3.5

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



[issue22476] asyncio task chapter confusion about 'task', 'future', and 'schedule'

2014-09-24 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@gmail.com:


--
components: +asyncio

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



[issue21052] Consider dropping ImportWarning for empty sys.path_hooks and sys.meta_path

2014-09-24 Thread Brett Cannon

Changes by Brett Cannon br...@python.org:


--
assignee:  - brett.cannon

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



[issue22466] problem with installing python 2.7.8

2014-09-24 Thread Steve Dower

Steve Dower added the comment:

Ah, okay, so this is due to the embedded DLL in the installer that we extract 
and use to validate the install path (if you select a path that already exists, 
you get a prompt warning you).

I don't know why your %TEMP% directory was not read/write/execute, but since it 
works fine for most people I suspect a configuration issue on your machine. I 
have seen in the past some security policies that will break installers, 
though typically launching the installer from an elevated command prompt (one 
that says Administrator: Command Prompt in the title) typically avoids these 
issues.

Glad you found a workaround at least.

--

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



[issue22482] logging: fileConfig doesn't support formatter styles

2014-09-24 Thread Dom Zippilli

New submission from Dom Zippilli:

In the logging module's config.py, see the _create_formatters(cp) method used 
by the fileConfig() method. Note that it pulls format and datefmt and 
submits these in the formatter constructor:

f = c(fs, dfs)

However, the Formatter constructor has a third argument for formatting style:

def __init__(self, fmt=None, datefmt=None, style='%')

Since the argument is not passed, ConfigParser-format logging configs must use 
%-style logging format masks. We'd prefer to use curlies.

Note that the code for the dictionary configurator does this correctly:

fmt = config.get('format', None)
dfmt = config.get('datefmt', None)
style = config.get('style', '%')
result = logging.Formatter(fmt, dfmt, style)

--
messages: 227460
nosy: domzippilli
priority: normal
severity: normal
status: open
title: logging: fileConfig doesn't support formatter styles
type: enhancement
versions: Python 3.4

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



[issue22483] Copyright infringement on PyPI

2014-09-24 Thread Stefan Krah

New submission from Stefan Krah:

The following URL contains copyrighted verbatim text from bytereef.org:

  https://pypi.python.org/pypi/m3-cdecimal


I'm not surprised, since the ongoing Walmartization of Open Source
has little regard for authors.

--
messages: 227461
nosy: skrah
priority: normal
severity: normal
status: open
title: Copyright infringement on PyPI

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



[issue22483] Copyright infringement on PyPI

2014-09-24 Thread Alex Gaynor

Alex Gaynor added the comment:

This bug tracker isn't really the right place to track this -- that said I 
don't know where is, so I've added Donald Stufft to the nosy list, hopefully he 
can help direct this appropriately.

What license is the bytereef text available under? The cdecimal source is BSD 
licensed, so it's perfectly legal to re-upload the package itself.

--
nosy: +alex, dstufft

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



[issue22482] logging: fileConfig doesn't support formatter styles

2014-09-24 Thread Berker Peksag

Changes by Berker Peksag berker.pek...@gmail.com:


--
nosy: +vinay.sajip

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



[issue22483] Copyright infringement on PyPI

2014-09-24 Thread Donald Stufft

Donald Stufft added the comment:

There's a support link on the left hand side of the PyPI page, that'll take you 
to the support forum where you can issue a support request and it'll get dealt 
with. Alternatively you can email distutils-...@python.org, or Richard and 
Myself (first names @python.org).

--
resolution:  - third party
status: open - closed

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



[issue22483] Copyright infringement on PyPI

2014-09-24 Thread STINNER Victor

STINNER Victor added the comment:

I don't understand the issue.

I see two projects:
https://pypi.python.org/pypi/cdecimal
https://pypi.python.org/pypi/m3-cdecimal

The two projects have the same metadata except owner: cdecimal is owned by 
skrah, m3-cdecimal is owned by prefer.

The license and author (Stefan Krah) are not changed in m3-cdecimal. Where is 
the copyright infringement? Is it the description of the package? The 
description contains a few lines of text (Overview, Testing, Short benchmarks, 
Documentation and Linux Notes sections).

I'm unable to reach http://www.bytereef.org/. It looks like the domain is owned 
by Stefan Krah.

Is it illegal to clone a project on PyPI if the author and license is not 
changed?

--
nosy: +haypo

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



[issue22483] Copyright infringement on PyPI

2014-09-24 Thread STINNER Victor

STINNER Victor added the comment:

Oh, the issue was closed while I was writing my message.

I agree with Alex and Donald, it's not the right place to report such issue.

--

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



[issue22477] GCD in Fractions

2014-09-24 Thread Wolfgang Maier

Wolfgang Maier added the comment:

Wouldn't it make more sense to change gcd() in the fractions module to return 
only positive integers?

The current gcd could become _gcd for private use by fractions, and the new 
wrapper gcd could just be implemented as:

def gcd(a,b):
return abs(_gcd(a, b))


An aspect that hasn't really been discussed so far on the mailing list is that 
this is *not* only about whether the gcd of negative integers should be 
negative or positive, but also about the fact that in the current 
implementation the result of gcd is dependent on the order of the arguments:

 gcd(-3,6) == gcd(6,-3)
False

which I think is clearly unexpected.


@Steven:
I share your fear of generating backwards incompatibility only partially. Of 
course, there may be code out there that is relying on the current documented 
behavior for negative integer input, but probably not in too many places since 
after all it's a pretty special need and it's easy enough to implement that 
most people will not even come across the stdlib function before writing their 
own. Even if your code's affected it is really easily fixed.

I do admit though that the proposed change of behavior *could* cause 
hard-to-track bugs in pieces of code that *do* use fractions.gcd right now. So 
I do favor your scheme of raising a warning with negative numbers in Python 
3.5, then changing the behavior in 3.6.

@Steven again:
I was playing around with the idea of having a gcd that accepts more than two 
arguments (and the same for a potential lcm function), then realized that its 
easily written right now as:

reduce(gcd, (3,6,9))
3

Ironically, though, the proposed new gcd would make this slower than it has to 
be since it would do the abs() repeatedly, when

abs(reduce(_gcd, (3,6,9))) would suffice.

So, I guess that's the tradeoff coming with the proposed change:

- a more concise implementation of gcd

against

- broken backwards compatibility and
- reduced flexibility by calling abs implicitly instead of just when the user 
needs it

I guess with that I am 
+0.5 for the change though maybe an extra sentence in the docs about the 
consequences of the already documented behavior of gcd and that you really 
*should* call abs() on the result in most situations may be enough.

--
nosy: +wolma

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



[issue22483] Copyright infringement on PyPI

2014-09-24 Thread Stefan Krah

Stefan Krah added the comment:

I don't see a license on PKG-INFO itself.  Furthermore, even if
it is legal, it (again) shows an utter disregard for authors and
their stated preferences.

I'm not surprised though, given that even existing names are
reassigned in an autocratic fashion.

--
status: closed - open

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



[issue22483] Copyright infringement on PyPI

2014-09-24 Thread Alex Gaynor

Alex Gaynor added the comment:

Stefan, this is not the right forum for this issue, please do not reopen it.

--
status: open - closed

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



[issue22483] Copyright infringement on PyPI

2014-09-24 Thread Stefan Krah

Stefan Krah added the comment:

Sorry, Donald, the actions on PyPI deserve wider exposure.

--
status: closed - open

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



[issue22483] Copyright infringement on PyPI

2014-09-24 Thread Donald Stufft

Donald Stufft added the comment:

Sorry, Richard or myself (...) will take a look and fix it.

--

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



[issue22483] Copyright infringement on PyPI

2014-09-24 Thread Donald Stufft

Donald Stufft added the comment:

This will be my last post on this issue.

I've given you the mechanisms for reporting problems with PyPI. PyPI is not run 
by python-dev nor is the python-dev bug tracker a mouth piece for your 
frustration with some part of the ecosystem around Python.

If you actually care about fixing the issue report it through one of the venues 
that I've mentioned and Richard or myself (most likely Richard, I rarely deal 
with the actual administration of things and typically involve mostly with the 
technology side of things).

I'm going to close this, please leave it closed as it has nothing do with 
CPython. If you want to speak out against something get a blog but a bugtracker 
is not that.

--
status: open - closed

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



[issue22483] Copyright infringement on PyPI

2014-09-24 Thread Donald Stufft

Donald Stufft added the comment:

Since I've been asked, just to clarify, my last post was a continuation of a 
sentence I mistakenly forgot to write out the whole thing.

It should read:

If you actually care about fixing the issue report it through one of the 
venues that I've mentioned and Richard or myself (most likely Richard, I rarely 
deal with the actual administration of things and typically involve mostly with 
the technology side of things) will take a look and fix it.

And now I really am done :)

--

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



[issue22483] Copyright infringement on PyPI

2014-09-24 Thread Stefan Krah

Stefan Krah added the comment:

Yeah right, obviously I don't *really* care about the issue (ethics
in open source software, in case you did not understand).

--

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



[issue22477] GCD in Fractions

2014-09-24 Thread Terry J. Reedy

Terry J. Reedy added the comment:

If nothing else, the doc for fractions.gcd Return the greatest common divisor 
is wrong and should be changed. The negative of the greatest common divisor is 
the least common divisor in an integer range. The doc should say Return the 
greatest common divisor or its negative.  Ditto for the docstring.

--
nosy: +terry.reedy

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



[issue22477] GCD in Fractions

2014-09-24 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Or Return a greatest magniture common divisor ..., there being two gmcds to 
choose from.

--

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



[issue17835] test_io broken on PPC64 Linux

2014-09-24 Thread Charles-François Natali

Charles-François Natali added the comment:

 In this case, the issues are being caused by the following kernel parameters 
 that we have for our default build -

 #
 ## TIBCO network tuning #
 #
 net.core.rmem_default = 33554432
 net.core.wmem_default = 33554432
 net.core.rmem_max = 33554432
 net.core.wmem_max = 33554432

 Toggling the support.PIPE_MAX_SIZE to +32MB or temporarily removing these 
 parameters mitigates the issue.  Is there a better way of calculating 
 support.PIPE_MAX_SIZE so it is reflective of the actual OS value?

What does:

 import fcntl, os
 r, w = os.pipe()
 fcntl.fcntl(w, 1032)

return?

Note that the kernel buffer sizes above are, well, *really huge*.

--

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



[issue22482] logging: fileConfig doesn't support formatter styles

2014-09-24 Thread Vinay Sajip

Vinay Sajip added the comment:

While fileConfig() is not deprecated, I'm not planning to enhance it, as the 
newer dictConfig() API offers better functionality overall. With dictConfig(), 
you do have support for alternative formatting styles.

--

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



[issue22477] GCD in Fractions

2014-09-24 Thread Mark Dickinson

Mark Dickinson added the comment:

 The negative of the greatest common divisor is the least common divisor in an 
 integer range.

That depends on your choice of definitions: it's perfectly reasonable to see it 
as another greatest common divisor, if you interpret greatest as being with 
respect to the divisibility lattice, not the total ordering of Z.  That's in 
some sense the correct interpretation, because it's the one that generalises to 
other interesting rings: for example, the Gaussian integers have a well-defined 
and useful notion of greatest common divisor, but aren't ordered, and the ring 
Z[sqrt 3] similarly has well-defined greatest common divisors (defined up to 
multiplication by a unit, as usual) *and* a total ordering, but greatest 
*can't* be interpreted in the ordering sense in that case (because there are 
infinitely many units).

Many textbooks will talk about a greatest common divisor rather than the 
greatest common divisor.  In that sense, -3 *is* a greatest common divisor of 
6 and -15.

--

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



[issue22484] Build doc archives for RC versions

2014-09-24 Thread Berker Peksag

New submission from Berker Peksag:

The attached patch partly reverts 
https://hg.python.org/cpython/rev/48033d90c61d#l2.126 since it breaks building 
doc archives for RC versions:

- https://mail.python.org/pipermail/docs/2014-September/020211.html
- https://mail.python.org/pipermail/docs/2014-September/020214.html
- https://mail.python.org/pipermail/docs/2014-September/020215.html

See https://hg.python.org/cpython/rev/ecfb6f8a7bcf for the original changeset.

--
assignee: docs@python
components: Documentation
files: autobuild.diff
keywords: patch
messages: 227479
nosy: benjamin.peterson, berker.peksag, docs@python
priority: high
severity: normal
stage: patch review
status: open
title: Build doc archives for RC versions
type: behavior
versions: Python 2.7
Added file: http://bugs.python.org/file36711/autobuild.diff

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



[issue22485] Documentation download links (3.4.2

2014-09-24 Thread Carol Willing

New submission from Carol Willing:

As reported by a couple of users on the python-docs mailing list:

Python 3.4.2rc1 docs are giving a 404 Not Found when clicking on the links to 
download (https://docs.python.org/3.4/download.html).

Python 3.5.0a0 links download docs correctly 
(https://docs.python.org/3.5/download.html).

If I option-click on a Mac, I can download Python 3.4.2rc1 docs; however, the 
direct links 404.

--
assignee: docs@python
components: Documentation
messages: 227480
nosy: docs@python, willingc
priority: normal
severity: normal
status: open
title: Documentation download links (3.4.2
type: behavior
versions: Python 3.4

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



[issue22485] Documentation download links (3.4.2

2014-09-24 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
nosy: +larry, terry.reedy

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



[issue22477] GCD in Fractions

2014-09-24 Thread gladman

gladman added the comment:

On 24/09/2014 19:01, Mark Dickinson wrote:
 
 Mark Dickinson added the comment:
 
 The negative of the greatest common divisor is the least common divisor in 
 an integer range.
 
 That depends on your choice of definitions: it's perfectly reasonable to see 
 it as another greatest common divisor, if you interpret greatest as being 
 with respect to the divisibility lattice, not the total ordering of Z.  
 That's in some sense the correct interpretation, because it's the one that 
 generalises to other interesting rings: for example, the Gaussian integers 
 have a well-defined and useful notion of greatest common divisor, but aren't 
 ordered, and the ring Z[sqrt 3] similarly has well-defined greatest common 
 divisors (defined up to multiplication by a unit, as usual) *and* a total 
 ordering, but greatest *can't* be interpreted in the ordering sense in that 
 case (because there are infinitely many units).
 
 Many textbooks will talk about a greatest common divisor rather than the 
 greatest common divisor.  In that sense, -3 *is* a greatest common divisor 
 of 6 and -15.

Then the Python documentation should say 'a greatest ...', not 'the
greatest ...' since those who deny that the integer gcd is non-negative
can hardly deny that a positive alternative value exists :-)

--

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



[issue22485] Documentation download links (3.4.2

2014-09-24 Thread Berker Peksag

Berker Peksag added the comment:

Thanks for the report. This is a duplicate of issue 22484.

--
nosy: +berker.peksag
resolution:  - duplicate
stage:  - resolved
status: open - closed
superseder:  - Build doc archives for RC versions

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



[issue22485] Documentation download links (3.4.2

2014-09-24 Thread Carol Willing

Carol Willing added the comment:

Thanks Berker. I'm glad it's being addressed and you have submitted a patch.

--

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



[issue22484] Build doc archives for RC versions

2014-09-24 Thread R. David Murray

R. David Murray added the comment:

Why would this not also be an issue for alpha/beta?

--
nosy: +r.david.murray

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



[issue17381] IGNORECASE breaks unicode literal range matching

2014-09-24 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Here is other patch for 3.4. It is more than 10 times faster than initial patch 
in worst case.

--
Added file: http://bugs.python.org/file36712/re_ignore_case_range-3.4_2.patch

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



[issue22477] GCD in Fractions

2014-09-24 Thread gladman

gladman added the comment:

On 24/09/2014 17:24, Wolfgang Maier wrote:
 
 Wolfgang Maier added the comment:
[snip]

 An aspect that hasn't really been discussed so far on the mailing list is 
 that this is *not* only about whether the gcd of negative integers should be 
 negative or positive, but also about the fact that in the current 
 implementation the result of gcd is dependent on the order of the arguments:
 
 gcd(-3,6) == gcd(6,-3)
 False
 
 which I think is clearly unexpected.

Yes, that's another interesting surprise.

 Ironically, though, the proposed new gcd would make this slower than it has 
 to be since it would do the abs() repeatedly, when
 
 abs(reduce(_gcd, (3,6,9))) would suffice.
 
 So, I guess that's the tradeoff coming with the proposed change:

I must admit to being more than a little hazy about what is fast and
what isn't in the Python interpreter but wouldn't the use of reduce to
repeatedly call _gcd be slower than an alternative that avoids this?

Taking on board one of Steven D'Aprano's thoughts about multiple inputs,
I had envisaged something like this:

def mgcd(a, *r):  # multiple gcd
  for b in r:
while b:
  a, b = b, a % b
  return abs(a)

which gives:

 mgcd(0)
0
 mgcd(7, 0)
7
 mgcd(0, 7)
7
 mgcd(-3, -7)
1
 mgcd(-3, 7)
1
 mgcd(7, -3)
1
mgcd(-21, -91, 707)
7

So it has the properties that I believe it should have (yes, I know we
don't agree on this). I am not sure I would extend it to rationals,
although I don't feel strongly about this.

This could be introduced elsewhere without changing what is done in
fractions.  Having two 'gcd's that return different results in some
circumstances might be a source of confusion for some - but not more
than already exists about what values the gcd should return :-)

PS I just know that I am going to regret posting code 'on the hoof' -
it's almost certain to be wrong :-)

--

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



[issue22486] Speed up fractions.gcd()

2014-09-24 Thread Stefan Behnel

New submission from Stefan Behnel:

fractions.gcd() is required for normalising numerator and denominator of the 
Fraction data type. Some speed improvements were applied to Fraction in issue 
22464, now the gcd() function takes up about half of the instantiation time in 
the benchmark in issue 22458, which makes it quite a heavy part of the overall 
Fraction computation time.

The current implementation is

def gcd(a, b):
while b:
a, b = b, a%b
return a

Reimplementing it in C would provide for much faster calculations. Here is a 
Cython version that simply drops the calculation loop into C as soon as the 
numbers are small enough to fit into a C long long int:

def _gcd(a, b):
# Try doing all computation in C space.  If the numbers are too large
# at the beginning, retry until they are small enough.
cdef long long ai, bi
while b:
try:
ai, bi = a, b
except OverflowError:
pass
else:
# switch to C loop
while bi:
ai, bi = bi, ai%bi
return ai
a, b = b, a%b
return a

It's substantially faster already because the values will either be small 
enough right from the start or quickly become so after a few iterations with 
Python objects.

Further improvements should be possible with a dedicated PyLong implementation 
based on Lehmer's GCD algorithm:

https://en.wikipedia.org/wiki/Lehmer_GCD_algorithm

--
components: Library (Lib)
messages: 227487
nosy: scoder
priority: normal
severity: normal
status: open
title: Speed up fractions.gcd()
type: performance
versions: Python 3.5

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



[issue22464] Speed up fractions implementation

2014-09-24 Thread Stefan Behnel

Stefan Behnel added the comment:

I created issue 22486 about the gcd() performance. I think we can close this 
ticket - I don't see any more obvious low hanging fruit and future findings can 
have their own ticket.

Out of interest, I modified the fractions module to compile Fraction into an 
extension type with Cython. For the benchmark, it currently gives me a 10x 
speedup over the original fractions module in Py3.4. I uploaded my initial 
attempt to PyPI and it's on github:

https://pypi.python.org/pypi/quicktions

https://github.com/scoder/quicktions

That makes a C implementation of Fraction generally worth considering for 
CPython.

--
resolution:  - fixed
status: open - closed

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



[issue22487] ABC register doesn't check abstract methods

2014-09-24 Thread Ryan McCampbell

New submission from Ryan McCampbell:

Is there a reason register() doesn't check for abstract methods, like 
subclassing does? Would it fail for some builtin classes? It seems that this 
would be a better guarantee that, say, something really is iterable when you 
check isinstance(Collections.Iterable, o), since someone could have called 
Collections.Iterable.register(o.__class__) without adding an __iter__ method to 
their class.

--
messages: 227489
nosy: rmccampbell7
priority: normal
severity: normal
status: open
title: ABC register doesn't check abstract methods
type: enhancement

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



  1   2   >