[issue21389] The repr of BoundMethod objects sometimes incorrectly identifies the bound function

2014-08-20 Thread Steven Barker

Steven Barker added the comment:

OK, I've written some tests of the new bound method repr functionality, which 
I'm attaching as a patch against the current tip.

I test the basic repr output, all the cases the old code got wrong (inherited 
methods, overridden methods, methods called via super, and classmethods) and 
the strange corner cases that probably won't come up in ordinary code (such as 
methods manually created from callables that don't have __name__ or 
__qualname__ attributes).

I've also fixed the defaultdict test that was relying upon the old repr output. 
I don't believe there are any other places in the standard library or tests 
where a bound method's repr is examined.

My patch adds the tests in a new file, Lib/test/test_bound_method_repr.py. I 
looked to see if there was an existing file that tested similar behavior, but 
none that I found really seemed appropriate. If I overlooked a better place to 
put the new tests, please let me know and I'll update the test patch.

I'm not very experienced at writing unit tests, so comments and/or criticism is 
welcomed. I copied parts of the file's structure (such as the test_main() 
function and if __name__ == __main__ boilerplate) from other test files, so 
hopefully I've stayed pretty close to the usual Python test style.

--
Added file: http://bugs.python.org/file36420/method_repr_tests.diff

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



[issue22224] docs.python.org is prone to political blocking in Russia

2014-08-20 Thread Alexander Patrakov

Alexander Patrakov added the comment:

The site is now accessible. But this case is going to repeat itself.

--

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



[issue22224] docs.python.org is prone to political blocking in Russia

2014-08-20 Thread Georg Brandl

Georg Brandl added the comment:

We know, but this will happen to any sites that have content hosted by a CDN 
such as Fastly.

In this specific case, you can download the docs or build them yourself for 
offline usage.  Our Mercurial server hg.python.org is (obviously :) not hosted 
on a CDN, so this scenario can't happen there.

--

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



[issue22208] tarfile can't add in memory files (reopened)

2014-08-20 Thread Lars Gustäbel

Lars Gustäbel added the comment:

I don't have an idea how to make it easier and still meet all/most requirements 
and without cluttering up the api. The way it currently works allows the 
programmer to control every tiny aspect of a tar member. Maybe it's best to 
simply add a new entry to the Examples section of the tarfile documentation.


import tarfile, io

with tarfile.open(sample.tar, mode=w) as tar:
t = tarfile.TarInfo(foo)
t.type = tarfile.DIRTYPE
tar.addfile(t)

b = Hello world!.encode(ascii)

t = tarfile.TarInfo(foo/bar)
t.size = len(b)
tar.addfile(t, io.BytesIO(b))

--

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



[issue22224] docs.python.org is prone to political blocking in Russia

2014-08-20 Thread Ezio Melotti

Ezio Melotti added the comment:

See also #21072.

--
nosy: +ezio.melotti

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



[issue22224] docs.python.org is prone to political blocking in Russia

2014-08-20 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

On 20.08.2014 09:28, Georg Brandl wrote:
 
 We know, but this will happen to any sites that have content hosted by a CDN 
 such as Fastly.

I think we should have additional fallback domains setup
that go to frontend.python.org and then also get mapped to
the right backend server in order to be able to easily
work around this.

This would also help with some other issues such as Fastly
cache invalidation not working properly (which most likely is due
to the website not providing the right information for this work
rather than Fastly's fault).

--

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



[issue22232] str.splitlines splitting on none-\r\n characters

2014-08-20 Thread Samuel Charron

New submission from Samuel Charron:

According to the documentation, str.splitlines uses the universal newlines to 
split lines.
The documentation says it's all about \r, \n, and \r\n 
(https://docs.python.org/3.5/glossary.html#term-universal-newlines)

However, it's also splitting on other characters. Reading the code, it seems 
the list of characters is from Objects/unicodeobject.c , in _PyUnicode_Init, 
the linebreak array.
When testing any of these characters, it splits the string.

Other libraries are using str.splitlines assuming it only breaks on these \r 
and \n characters. This is the case of email.feedparser for instance, used by 
http.client to parse headers. These HTTP headers should be separated by CLRF as 
specified by http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4. 

Either the documentation should state that splitlines splits on other 
characters or it should stick to the documentation and split only on \r and \n 
characters.

If it splits on other characters, the list could be improved, as the unicode 
reference lists the mandatory characters for line breaking : 
http://www.unicode.org/reports/tr14/tr14-32.html#BK

--
components: Library (Lib), Unicode
messages: 225561
nosy: ezio.melotti, haypo, scharron
priority: normal
severity: normal
status: open
title: str.splitlines splitting on none-\r\n characters
type: behavior
versions: Python 3.4, Python 3.5

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



[issue22233] http.client splits headers on none-\r\n characters

2014-08-20 Thread Samuel Charron

New submission from Samuel Charron:

In some cases, the headers from http.client (that uses email.feedparser) splits 
headers at wrong separators. The bug is from the use of str.splitlines (in 
email.feedparser) that splits on other characters than \r\n as it should. (See 
bug http://bugs.python.org/issue22232)

To reproduce the bug : 

import http.client
c = http.client.HTTPSConnection(graph.facebook.com)
c.request(GET, /%C4%85, None, {test: \x85})
r = c.getresponse()
print(r.headers)
print(r.headers.keys())
print(r.headers.get(WWW-Authenticate))

As you can see, the WWW-Authenticate is wrongly parsed (it misses its final ), 
and therefore the rest of the headers are ignored.

--
components: Library (Lib)
messages: 225562
nosy: scharron
priority: normal
severity: normal
status: open
title: http.client splits headers on none-\r\n characters
type: behavior
versions: Python 3.4, Python 3.5

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



[issue8797] urllib2 basicauth broken in 2.6.5: RuntimeError: maximum recursion depth exceeded in cmp

2014-08-20 Thread Senthil Kumaran

Senthil Kumaran added the comment:

This is fixed in all active versions (2.7.8+, 3.4.2? and 3.5). Thanks all!

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

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



[issue21549] Add the members parameter for TarFile.list()

2014-08-20 Thread Berker Peksag

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


--
stage: patch review - commit review

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



[issue22232] str.splitlines splitting on none-\r\n characters

2014-08-20 Thread R. David Murray

Changes by R. David Murray rdmur...@bitdance.com:


--
nosy: +r.david.murray

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



[issue22233] http.client splits headers on none-\r\n characters

2014-08-20 Thread R. David Murray

Changes by R. David Murray rdmur...@bitdance.com:


--
nosy: +r.david.murray

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



[issue22232] str.splitlines splitting on none-\r\n characters

2014-08-20 Thread Samuel Charron

Samuel Charron added the comment:

For an example of a serious bug caused by this, see 
http://bugs.python.org/issue22233

--

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



[issue22233] http.client splits headers on none-\r\n characters

2014-08-20 Thread Samuel Charron

Samuel Charron added the comment:

A consequence of this bug is that r.read() blocks until a timeout occurs since 
the content-length header is not interpreted (I think this is related to the 
HTTPResponse.__init__ comment)

--

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



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

2014-08-20 Thread Antti Haapala

New submission from Antti Haapala:

Because of if x else '' in _decode_args 
(http://hg.python.org/cpython/file/3.4/Lib/urllib/parse.py#l96), 
urllib.parse.urlparse accepts any falsy value as an url, returning a 
ParseResultBytes with all members set to empty bytestrings.

Thus you get:

 urllib.parse.urlparse({})
ParseResultBytes(scheme=b'', netloc=b'', path=b'', params=b'', query=b'', 
fragment=b'')

which may result in some very confusing exceptions later on: I had a list of 
URLs that accidentally contained some Nones and got very confusing TypeErrors 
while processing the results expecting them to be strings.

If the `if x else ''` part were removed, such invalid falsy values would fail 
with `AttributeError: 'foo' object has no attribute 'decode'`, as happens with 
any truthy invalid value.

--
components: Library (Lib)
messages: 225566
nosy: Ztane
priority: normal
severity: normal
status: open
title: urllib.parse.urlparse accepts any falsy value as an url
type: behavior
versions: Python 3.4

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



[issue22197] Allow better verbosity / output control in test cases

2014-08-20 Thread Berker Peksag

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


--
nosy: +berker.peksag

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



[issue22229] wsgiref doesn't appear to ever set REMOTE_HOST in the environ

2014-08-20 Thread Berker Peksag

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


--
nosy: +berker.peksag, pje
stage:  - needs patch
type:  - behavior

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



[issue22223] argparse not including '--' arguments in previous optional REMAINDER argument

2014-08-20 Thread Juraj Ivancic

Changes by Juraj Ivancic juraj.ivan...@gmail.com:


--
nosy: +Juraj.Ivancic

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



[issue22235] httplib: TypeError with file() object in ssl.py

2014-08-20 Thread Etienne Robillard

New submission from Etienne Robillard:

Trying to push to a ssl server but python break in httplib. 



erob@nguns:~/django-hotsauce$ hg push 
https://tkad...@bitbucket.org/tkadm30/django-hotsauce
pushing to https://tkad...@bitbucket.org/tkadm30/django-hotsauce
warning: bitbucket.org certificate with fingerprint 
45:ad:ae:1a:cf:0e:73:47:06:07:e0:88:f5:cc:10:e5:fa:1c:f7:99 not verified (check 
hostfingerprints or web.cacerts config setting)
** unknown exception encountered, please report by visiting
** http://mercurial.selenic.com/wiki/BugTracker
** Python 2.7.3 (default, Aug 20 2014, 09:34:08) [GCC 4.7.2]
** Mercurial Distributed SCM (version 3.1)
** Extensions loaded: color, gpg, strip, mq, notify, patchbomb
Traceback (most recent call last):
  File /usr/local/bin/hg, line 43, in module
mercurial.dispatch.run()
  File /usr/local/lib/python2.7/site-packages/mercurial/dispatch.py, line 28, 
in run
sys.exit((dispatch(request(sys.argv[1:])) or 0)  255)
  File /usr/local/lib/python2.7/site-packages/mercurial/dispatch.py, line 69, 
in dispatch
ret = _runcatch(req)
  File /usr/local/lib/python2.7/site-packages/mercurial/dispatch.py, line 
138, in _runcatch
return _dispatch(req)
  File /usr/local/lib/python2.7/site-packages/mercurial/dispatch.py, line 
820, in _dispatch
cmdpats, cmdoptions)
  File /usr/local/lib/python2.7/site-packages/mercurial/dispatch.py, line 
600, in runcommand
ret = _runcommand(ui, options, cmd, d)
  File /usr/local/lib/python2.7/site-packages/mercurial/extensions.py, line 
196, in wrap
return wrapper(origfn, *args, **kwargs)
  File /usr/local/lib/python2.7/site-packages/hgext/color.py, line 433, in 
colorcmd
return orig(ui_, opts, cmd, cmdfunc)
  File /usr/local/lib/python2.7/site-packages/mercurial/dispatch.py, line 
911, in _runcommand
return checkargs()
  File /usr/local/lib/python2.7/site-packages/mercurial/dispatch.py, line 
882, in checkargs
return cmdfunc()
  File /usr/local/lib/python2.7/site-packages/mercurial/dispatch.py, line 
817, in lambda
d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
  File /usr/local/lib/python2.7/site-packages/mercurial/util.py, line 550, in 
check
return func(*args, **kwargs)
  File /usr/local/lib/python2.7/site-packages/mercurial/extensions.py, line 
151, in wrap
util.checksignature(origfn), *args, **kwargs)
  File /usr/local/lib/python2.7/site-packages/mercurial/util.py, line 550, in 
check
return func(*args, **kwargs)
  File /usr/local/lib/python2.7/site-packages/hgext/mq.py, line 3393, in 
mqcommand
return orig(ui, repo, *args, **kwargs)
  File /usr/local/lib/python2.7/site-packages/mercurial/util.py, line 550, in 
check
return func(*args, **kwargs)
  File /usr/local/lib/python2.7/site-packages/mercurial/commands.py, line 
4768, in push
other = hg.peer(repo, opts, dest)
  File /usr/local/lib/python2.7/site-packages/mercurial/hg.py, line 129, in 
peer
return _peerorrepo(rui, path, create).peer()
  File /usr/local/lib/python2.7/site-packages/mercurial/hg.py, line 106, in 
_peerorrepo
obj = _peerlookup(path).instance(ui, path, create)
  File /usr/local/lib/python2.7/site-packages/mercurial/httppeer.py, line 
261, in instance
inst._fetchcaps()
  File /usr/local/lib/python2.7/site-packages/mercurial/httppeer.py, line 58, 
in _fetchcaps
self.caps = set(self._call('capabilities').split())
  File /usr/local/lib/python2.7/site-packages/mercurial/httppeer.py, line 
172, in _call
fp = self._callstream(cmd, **args)
  File /usr/local/lib/python2.7/site-packages/mercurial/httppeer.py, line 
119, in _callstream
resp = self.urlopener.open(req)
  File /usr/local/lib/python2.7/urllib2.py, line 400, in open
response = self._open(req, data)
  File /usr/local/lib/python2.7/urllib2.py, line 418, in _open
'_open', req)
  File /usr/local/lib/python2.7/urllib2.py, line 378, in _call_chain
result = func(*args)
  File /usr/local/lib/python2.7/site-packages/mercurial/url.py, line 371, in 
https_open
return self.do_open(self._makeconnection, req)
  File /usr/local/lib/python2.7/site-packages/mercurial/keepalive.py, line 
255, in do_open
r = h.getresponse()
  File /usr/local/lib/python2.7/site-packages/mercurial/keepalive.py, line 
577, in safegetresponse
return cls.getresponse(self)
  File /usr/local/lib/python2.7/httplib.py, line 1028, in getresponse
response = self.response_class(*args, **kwds)
  File /usr/local/lib/python2.7/site-packages/mercurial/keepalive.py, line 
380, in __init__
httplib.HTTPResponse.__init__(self, sock, debuglevel, method)
  File /usr/local/lib/python2.7/httplib.py, line 346, in __init__
self.fp = sock.makefile('rb', 0)
  File /usr/local/lib/python2.7/ssl.py, line 366, in makefile
return _fileobject(self, mode, bufsize, close=True)
TypeError: file() takes at most 3 arguments (4 given)

--
components: Library (Lib)
messages: 225567
nosy: erob
priority: normal
severity: normal
status: open
title: 

[issue22235] httplib: TypeError with file() object in ssl.py

2014-08-20 Thread Etienne Robillard

Etienne Robillard added the comment:

interpreter is Python 2.7.3. 2.7.8 is buggy!

--

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



[issue22014] Improve display of OS exception - errno mapping

2014-08-20 Thread Brett Cannon

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


--
nosy: +brett.cannon

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



[issue22235] httplib: TypeError with file() object in ssl.py

2014-08-20 Thread R. David Murray

R. David Murray added the comment:

Are you saying that it works with 2.7.2?

If not, you should report this to mercurial first, as recommended by the error 
message you got.  It will be easier for them to figure out where the problem 
originates, since there is not really enough information here for us to 
reproduce the problem.

--
nosy: +r.david.murray

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



[issue22236] Do not use _default_root in Tkinter tests

2014-08-20 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Currently many Tkinter tests depends on tkinter._default_root. I.e. they reuse 
the same Tcl interpreter and main window. This can cause unexpected 
dependencies between tests. Proposed patch creates new root for every test, 
this makes tests mutually independent. It also fixes some bugs in NoDefaultRoot 
mode and get rid of 'can't invoke event command:' messages in tests. This 
patch is needed to run Tkinter tests in different wantobjects modes 
(issue21585).

--
components: Tests, Tkinter
files: tkinter_no_default_root.patch
keywords: patch
messages: 225570
nosy: gpolo, serhiy.storchaka, terry.reedy, zach.ware
priority: normal
severity: normal
stage: patch review
status: open
title: Do not use _default_root in Tkinter tests
type: behavior
versions: Python 2.7, Python 3.4, Python 3.5
Added file: http://bugs.python.org/file36421/tkinter_no_default_root.patch

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



[issue22224] docs.python.org is prone to political blocking in Russia

2014-08-20 Thread Jesús Cea Avión

Changes by Jesús Cea Avión j...@jcea.es:


--
nosy: +jcea

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



[issue22224] docs.python.org is prone to political blocking in Russia

2014-08-20 Thread Donald Stufft

Donald Stufft added the comment:

 I think we should have additional fallback domains setup
 that go to frontend.python.org and then also get mapped to
 the right backend server in order to be able to easily
 work around this.

I'm not sure it's worth it tbh. It's certainly going to be error prone to store
the frontend configuration in two locations (Fastly and front.python.org).
There might be additional things we can do on the Fastly side of things, I know
the have the ability to have dedicated IP addresses in all their DCs (typically
this is in use for providing EV SSL certs and the like). We don't have that
and generally this costs like $1500/month for the SSL cert stuff. I can ping
them about it and see if they have any other ideas.

 This would also help with some other issues such as Fastly
 cache invalidation not working properly (which most likely is due
 to the website not providing the right information for this work
 rather than Fastly's fault).

Right, it's basically that there is no cache invalidation as far as I know.
Actually invalidating the cache pretty much always works in my experience.

--

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



[issue22235] httplib: TypeError with file() object in ssl.py

2014-08-20 Thread Etienne Robillard

Etienne Robillard added the comment:

Thanks. I have forwarded to Mercurial bugtracker the problem.

--

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



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

2014-08-20 Thread Berker Peksag

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


--
nosy: +orsenthil

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



[issue22228] Adapt bash readline operate-and-get-next function

2014-08-20 Thread Chris Angelico

Chris Angelico added the comment:

Patch applies nicely to current default, and works for me on amd64 Linux. I'm 
liking how this is looking.

--

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



[issue22237] sorted() docs should state that the sort is stable

2014-08-20 Thread Wilfred Hughes

New submission from Wilfred Hughes:

According to 
https://wiki.python.org/moin/HowTo/Sorting/#Sort_Stability_and_Complex_Sorts 
and Alex Martelli: http://stackoverflow.com/q/1915376/509706, Python's sorted() 
is stable. It would be great to update the docs for sorted() to state this.

--
assignee: docs@python
components: Documentation
messages: 225574
nosy: Wilfred.Hughes, docs@python
priority: normal
severity: normal
status: open
title: sorted() docs should state that the sort is stable
type: enhancement
versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4, Python 3.5

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



[issue22224] docs.python.org is prone to political blocking in Russia

2014-08-20 Thread Donald Stufft

Donald Stufft added the comment:

I've heard back from Fastly!

Specific to this particular incident, they've identified a few places where 
their own internal procedures fell short and they've rectified them. 
Specifically:

1. Their ticketing software saw the notifications from the Russian 
government/ISP as spam, most likely due to the Cryllic character set. This lead 
them to miss seeing the reports initially until later. They've resolved this by 
whitelisting those domains.
2. They notified the customers and then told the Russian government/ISP that 
the owner of the content as been notified. Instead they are going to ensure 
that the content in the future.

In the long term they are evaluating their own policies for how they host 
customer sites which allow user uploaded content (since those types of sites 
are the most likely to have these kinds of issues) and determining if it makes 
sense for them to require dedicated IP addresses for those customers.

For now I think Fastly has sufficiently handled the issue to not require some 
sort of backup system to need to be put in place. They are going to let me know 
how they are going to handle it long term and what, if any changes, we can make 
in our use of their service to help isolate from those kinds of issues.

--

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



[issue22238] fractions.gcd results in infinite loop when nan or inf given as parameter.

2014-08-20 Thread Robert Snoeberger

New submission from Robert Snoeberger:

 import fractions
 fractions.gcd(16, float('inf'))
Traceback (most recent call last):
  File pyshell#1, line 1, in module
fractions.gcd(16, float('inf'))
  File C:\Python34-32bit\lib\fractions.py, line 24, in gcd
a, b = b, a%b
KeyboardInterrupt
 fractions.gcd(16, float('nan'))
Traceback (most recent call last):
  File pyshell#2, line 1, in module
fractions.gcd(16, float('nan'))
  File C:\Python34-32bit\lib\fractions.py, line 24, in gcd
a, b = b, a%b
KeyboardInterrupt
 

With the iterative algorithm that is used 

a, b = b, a%b

b converges to float('nan'). It will never become 0 to break out of the loop. 
It might be nice to error when the iteration has converged b to a value other 
than 0.

--
components: Library (Lib)
messages: 225576
nosy: snoeberger
priority: normal
severity: normal
status: open
title: fractions.gcd results in infinite loop when nan or inf given as 
parameter.
type: enhancement
versions: Python 3.4

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



[issue22224] docs.python.org is prone to political blocking in Russia

2014-08-20 Thread Georg Brandl

Georg Brandl added the comment:

Very nice, thanks for the update.

--

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



[issue22239] asyncio: nested event loop

2014-08-20 Thread Daniel Arbuckle

New submission from Daniel Arbuckle:

It's occasionally necessary to invoke the asyncio event loop from code that was 
itself invoked within (although usually not directly by) the event loop.

For example, imagine you are writing a class that serves as a local proxy for a 
remote data structure. You can not make the __contains__ method of that class 
into a coroutine, because Python automatically converts the return value into a 
boolean. However, __contains__ must invoke coroutines in order to communicate 
over the network, and it must be invokable from within a coroutine to be at all 
useful.

If the event loop _run_once method were reentrant, addressing this problem 
would be simple. That primitive could be used to create a loop_until_complete 
function, which could be applied to the io tasks that __contains__ needs to 
invoke

So, making _run_once reentrant is one way of addressing this request.

Alternately, I've attached a decorator that sets aside some of the state of 
_run_once, runs a couroutine to completion in a nested event loop, restores the 
saved state, and returns the coroutine's result. This is merely a proof of 
concept, but it does work, at least in my experiments.

--
components: asyncio
files: nested.py
messages: 225578
nosy: djarb, gvanrossum, haypo, yselivanov
priority: normal
severity: normal
status: open
title: asyncio: nested event loop
type: enhancement
Added file: http://bugs.python.org/file36422/nested.py

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



[issue22237] sorted() docs should state that the sort is stable

2014-08-20 Thread Georg Brandl

Georg Brandl added the comment:

I agree: The docs for list.sort() do guarantee the stability, so sorted() 
should have the same indication.

--
nosy: +georg.brandl

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



[issue22224] docs.python.org is prone to political blocking in Russia

2014-08-20 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

On 20.08.2014 19:14, Donald Stufft wrote:
 
 For now I think Fastly has sufficiently handled the issue to not require some 
 sort of backup system to need to be put in place. They are going to let me 
 know how they are going to handle it long term and what, if any changes, we 
 can make in our use of their service to help isolate from those kinds of 
 issues.

Sounds good.

--

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



[issue21308] PEP 466: backport ssl changes

2014-08-20 Thread Alex Gaynor

Alex Gaynor added the comment:

Latest patch fixes both the issues Benjamin noted.

--
Added file: http://bugs.python.org/file36423/ssl-backport.diff

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



[issue22238] fractions.gcd results in infinite loop when nan or inf given as parameter.

2014-08-20 Thread Antoine Pitrou

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


--
nosy: +mark.dickinson, rhettinger

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



[issue21308] PEP 466: backport ssl changes

2014-08-20 Thread Benjamin Peterson

Benjamin Peterson added the comment:

I spent hours looking at this patch, which certainly doesn't constitute a real 
review, but is probably about as good as your going to get on this behemouth. 
Anyway, Alex knows he's on the hook for when things start going sour.

--

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



[issue21308] PEP 466: backport ssl changes

2014-08-20 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 221a1f9155e2 by Benjamin Peterson in branch '2.7':
backport many ssl features from Python 3 (closes #21308)
http://hg.python.org/cpython/rev/221a1f9155e2

--
nosy: +python-dev
resolution:  - fixed
stage: patch review - resolved
status: open - closed

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



[issue22238] fractions.gcd results in infinite loop when nan or inf given as parameter.

2014-08-20 Thread Raymond Hettinger

Raymond Hettinger added the comment:

I don't think this is an actual problem in practice and isn't worth mucking up 
clear and beautiful code.

--
priority: normal - low

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



[issue22237] sorted() docs should state that the sort is stable

2014-08-20 Thread Raymond Hettinger

Changes by Raymond Hettinger raymond.hettin...@gmail.com:


--
assignee: docs@python - rhettinger
nosy: +rhettinger

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



[issue22235] httplib: TypeError with file() object in ssl.py

2014-08-20 Thread Etienne Robillard

Etienne Robillard added the comment:

after reviewing with the Mercurial support it was found the issue may be caused 
by improper python install. However i have been able to reproduce the problem 
with a fresh install of python 2.7.3 only.

--

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



[issue22240] argparse support for python -m module in help

2014-08-20 Thread Miki Tebeka

New submission from Miki Tebeka:

python -m module -h starts with
usage: __main__.py

It should be
usage: python -m module

--
components: Library (Lib)
files: prog.diff
keywords: patch
messages: 225586
nosy: tebeka
priority: normal
severity: normal
status: open
title: argparse support for python -m module in help
type: enhancement
versions: Python 3.5
Added file: http://bugs.python.org/file36424/prog.diff

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



[issue22238] fractions.gcd results in infinite loop when nan or inf given as parameter.

2014-08-20 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Also note that the fractions module is primarily about rational numbers 
(integer ratios).  The int type has no concept of NaNs and Infs, so I don't see 
any reason why the fractions module should cater to them.

--

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



[issue22194] access to cdecimal / libmpdec API

2014-08-20 Thread Antoine Pitrou

Antoine Pitrou added the comment:

  3) It's not clear whether users would not be served better by
 using functions from libmpdec directly (much faster,
 probably less error handling).

That's what I meant. The issue here is that Python's libmpdec is not exposed to 
third-party code at all. Also there should probably be a (thin?) API to get at 
the underlying mpdec object from a cdecimal PyObject (apologies for the poor 
wording, I'm actually not acquainted with the libmpdec APIs).

As for the Capsule method, well, at least it would be better than nothing (or 
than any platform-specific hack).

  2) I would not like to spend time on it if we go ahead and
 make decimal a builtin (double effort).

I haven't heard any consensus on that yet :-)

(for the record, the context is that we would like to support decimal objects 
efficiently in Numba)

--

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



[issue22194] access to cdecimal / libmpdec API

2014-08-20 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Note that you could expose a C API even if decimal didn't become built-in, see 
Include/datetime.h for example.

--

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



[issue22194] access to cdecimal / libmpdec API

2014-08-20 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Relatedly, is the libmpdec ABI stable? That is, if I build a separate libmpdec, 
can I expect it to handle cdecimal's innards fine, or will there be problems?

--

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



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

2014-08-20 Thread Demian Brecht

Changes by Demian Brecht demianbre...@gmail.com:


--
nosy: +demian.brecht

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



[issue22233] http.client splits headers on none-\r\n characters

2014-08-20 Thread Demian Brecht

Changes by Demian Brecht demianbre...@gmail.com:


--
nosy: +demian.brecht

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



[issue22231] httplib: unicode url will cause an ascii codec error when combined with a utf-8 string header

2014-08-20 Thread Demian Brecht

Changes by Demian Brecht demianbre...@gmail.com:


--
nosy: +demian.brecht

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



[issue22208] tarfile can't add in memory files (reopened)

2014-08-20 Thread Mark Grandi

Mark Grandi added the comment:

 I don't have an idea how to make it easier and still meet all/most 
 requirements and without cluttering up the api.

That is what i mentioned in my original post, a lot of the time users just 
_don't care_ about a lot of the stuff that a tar archive can store (permission 
bits, uid/gid, etc).

Say i'm on my mac. I can select a bunch of files and then right click - 
compress. Pretending that it saves the resulting archive as a .tar.gz rather 
then a .zip, that's really it. The user doesn't care about the permission bits, 
uid/gid or any of that, they just want a compressed archive.

While the api does do a good job of exposing the low level parts of the api 
with TarInfo, being able to set all the stuff manually or have it figured out 
through gettarinfo() calling os.stat()

My original reasoning for this bug report is that its way too hard to do it for 
in-memory files, as those don't have file descriptors so os.stat() fails. But 
why can't we just make it so:

gettarinfo() is called
* if it's a regular file, it continues as it does not
* if it is NOT a regular file (no file descriptor), then it returns a 
TarInfo object with the 'name' and 'size' set, and the rest of the fields set 
to default values (the current user's uid and gid, acceptable permission bits 
and the correct type for a regular file (REGFILE?)
* if gettarinfo() is called with a non regular file and it's name has a 
slash, then its assumed to be a folder structure, so then it will add the 
correct TarInfo with type = DIRTYPE and then insert the file underneath that 
folder, sorta how zipfile works. I looked at the tarfile.py code and it seems 
it does this already. 


This just adds the needed easy use case for the tarfile module, as the 
complicated low level api is there, we just need something that users just want 
to create an archive without worrying too much about the low level stuff. So 
then they can just:

import tarfile, io

fileToAdd = io.BytesIO(hello world!.encode(utf-8))
with tarfile.open(sample.tar, mode=w) as tar:

# this TarInfo object has:
#name = 'somefile.txt'
#type = REGTYPE (or whatever is 'just a regular file')
#uid = 501, gid = 20, gname=staff, uname=markgrandi, mode=644
tmpTarInfo = tar.gettarinfo(somefile.txt, fileToAdd)
tar.addfile()



So basically its just having defaults for the TarInfo object when gettarinfo() 
is given a file that doesn't have a file descriptor.

--

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



[issue22236] Do not use _default_root in Tkinter tests

2014-08-20 Thread Terry J. Reedy

Terry J. Reedy added the comment:

For idle tests, I already avoid the default root and (intend to) create all 
widgets as a descendent of an explicit root.  This allows explicit deletion and 
avoidance of error messages and memory leaks. This seems to cover the majority 
of changes.

An explicit root is mostly true of idle code also, but there seem to be a few 
exceptions (as indicated by error messages). I presume that deleting and 
preventing the re-creation of default root, with the code in the patch, would 
cause a traceback revealing the location of such exceptions. That would have to 
be done before the offending code is run.

I do not see any need to try to modify the tkinter module for each test 
function (and slow down tkinter tests). It seems that tkinter.NoDefaultRoot() 
should be moved to destroy_default_root and that function called just once at 
the top of the module.

Creating and destroying root takes over .04 seconds on my machine.
 timeit('root=Tk(); root.destroy()', 'from tkinter import Tk', number=100)
4.222483729329078
Doing it once per test method, with widgets added, will be noticeable.

Unless a test modifies the root widget itself (other than its set of children), 
I would rename the AbstractTkinterTest methods to setUpClass and tearDownClass, 
and leave setUp for regeneration of the specific widget or widgets being 
tested. That is what we do for Idle gui test classes, and only that often 
because setUpModule and tearDownModule do not work on 2.7. 

-
In one module, you have this change:
 # Make sure tkinter._fix runs to set up the environment
-support.import_fresh_module('tkinter')
+tkinter = support.import_fresh_module('tkinter')

In test/test_idle, I test presence of tkinter with 
  tk = import_module('tkinter')  # imports _tkinter
Perhaps this should use import_fresh_module instead.  Tests seems to work, 
though there are occasional obscure interaction problems in test suite.

--

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



[issue19884] Importing readline produces erroneous output

2014-08-20 Thread Benjamin Peterson

Benjamin Peterson added the comment:

It seems this bug was fixed properly by readline in version 6.3; rl_initialize 
won't put meta codes on the screen. Frankly, I'm surprised distros like Fedora 
haven't upgraded or patched readline themselves to fix this. Aren't other 
programs affected?

Turning off enable-meta-key isn't great, since it doesn't work on older 
readline or libedit, and is probably technically a backwards compatibility 
problem.

I think the best solution would be not call rl_initialize during the 
initialization of the readline module, but I'm not sure if that could create 
compatibility problems.

--
nosy: +benjamin.peterson

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



[issue22226] Refactor dict result handling in Tkinter

2014-08-20 Thread Terry J. Reedy

Terry J. Reedy added the comment:

The patch expands and fixes buggy ttk._dict_from_tcltuple, renames and moves it 
to tkinter._splitdict, and replace 4 similar blocks of code in tkinter with 
calls to _splitdict.  Review published. The only substantive comment is about 
keeping the test, in a new location. Aside from the comments, this is a nice 
code improvement.

--

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



[issue21389] The repr of BoundMethod objects sometimes incorrectly identifies the bound function

2014-08-20 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 92dcee426014 by Benjamin Peterson in branch 'default':
use __qualname__ to compute bound method repr (closes #21389)
http://hg.python.org/cpython/rev/92dcee426014

--
nosy: +python-dev
resolution:  - fixed
stage: patch review - resolved
status: open - closed

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



[issue22224] docs.python.org is prone to political blocking in Russia

2014-08-20 Thread Donald Stufft

Donald Stufft added the comment:

I just heard back from Fastly again. They are going to donate a dedicated IP
address setup on top of the rest of the stuff they are already donating to us.
It's not setup yet and the exact details are not sorted out yet. This should
more or less eliminate this problem (unless of course one of our own services
get banned somewhere).

I believe the sticker cost of this is $1500/month (Normally this is used for
custom SSL certificates, not sure if it'd be cheaper w/o that) on top of the
~$12k/month they already donate to the PSF. So that's incredibly awesome IMO
and a big thanks to them!

--

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



[issue22226] Refactor dict result handling in Tkinter

2014-08-20 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The patch expands and fixes buggy ttk._dict_from_tcltuple, renames and moves it 
to tkinter._splitdict

There are differences between these functions. tkinter._splitdict calls 
splitlist on its argument, ttk._dict_from_tcltuple requires argument to be 
tuple/list. ttk._dict_from_tcltuple calls tclobjs_to_py on the result, 
tkinter._splitdict left it to the caller. Instead tkinter._splitdict allows you 
to specify custom function for dict values convertion.

Updated patch addresses Terry's comments.

Function name is matter of bakeshedding.

--
Added file: http://bugs.python.org/file36425/tkinter_splitdict_2.patch

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