[issue23132] Faster total_ordering

2014-12-30 Thread Nick Coghlan

Nick Coghlan added the comment:

I tweaked Serhiy's benchmark script to also include the timing relative to 
spelling out all four ordered comparison methods.

For an unpatched debug build of trunk, I get the following:

$ ../py3k/python total_ordering_relative_bench.py 
a < b   1.643 1.605 x0.98
b < a   1.611 1.611 x1.00
a >= b  1.599 3.539 x2.21
b >= a  1.607 3.579 x2.23
a <= b  1.600 3.677 x2.30
b <= a  1.601 5.599 x3.50
a > b   1.600 3.624 x2.26
b > a   1.612 6.465 x4.01

With Serhiy's change applied I get:

$ ../py3k/python total_ordering_relative_bench.py 
a < b   1.599 1.602 x1.00
b < a   1.607 1.609 x1.00
a >= b  1.602 2.802 x1.75
b >= a  1.605 2.804 x1.75
a <= b  1.737 2.842 x1.64
b <= a  1.607 4.835 x3.01
a > b   1.667 2.821 x1.69
b > a   1.597 5.557 x3.48

--
Added file: http://bugs.python.org/file37569/total_ordering_relative_bench.py

___
Python tracker 

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



[issue23132] Faster total_ordering

2014-12-30 Thread Nick Coghlan

Nick Coghlan added the comment:

This looks like a nice, relatively simple improvement in both speed and 
introspection support, so +1 from me.

Something I've wondered since we changed total_ordering to handle 
NotImplemented correctly is whether it would be worth exposing more of the 
*components* of rich boolean comparison operations through the operator module. 
Currently it isn't possible to access the individual steps, which is why 
handling NotImplemented incurred such a large performance hit relative to the 
previous implementation that didn't worry about it (but also potentially hit 
RecursionError if the underlying comparison operation returned NotImplemented).

--

___
Python tracker 

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



[issue23138] cookiejar parses cookie value as int with empty name-value pair and Expires

2014-12-30 Thread Christopher Foo

New submission from Christopher Foo:

Something like "Set-Cookie: ; Expires=Thu, 01 Jan 1970 00:00:10 GMT" causes the 
resulting cookie.value to be parsed as an int.

I expected either str or None as described in the documentation.

Example evil server:

try:
import http.server as http_server
except ImportError:
import BaseHTTPServer as http_server


class MyHandler(http_server.BaseHTTPRequestHandler):
def do_GET(self):
self.send_response(200)
self.send_header('Set-Cookie', '; Expires=Thu, 01 Jan 1970 00:00:10 
GMT')
self.send_header('Set-Cookie', 'good=123.45600')
self.end_headers()


def main():
server = http_server.HTTPServer(('127.0.0.1', 8000), MyHandler)
server.serve_forever()


if __name__ == '__main__':
main()


Example innocent client:

try:
import http.cookiejar as http_cookiejar
except ImportError:
import cookielib as http_cookiejar

try:
import urllib.request as urllib_request
except ImportError:
import urllib2 as urllib_request


def main():
cj = http_cookiejar.CookieJar()
opener = 
urllib_request.build_opener(urllib_request.HTTPCookieProcessor(cj))
r = opener.open("http://127.0.0.1:8000/";)

print(cj._cookies)

if __name__ == '__main__':
main()


The resulting output is:

{'127.0.0.1': {'/': {'expires': Cookie(version=0, name='expires', value=10.0, 
port=None, port_specified=False, domain='127.0.0.1', domain_specified=False, 
domain_initial_dot=False, path='/', path_specified=False, secure=False, 
expires=None, discard=True, comment=None, comment_url=None, rest={}, 
rfc2109=False), 'good': Cookie(version=0, name='good', value='123.45600', 
port=None, port_specified=False, domain='127.0.0.1', domain_specified=False, 
domain_initial_dot=False, path='/', path_specified=False, secure=False, 
expires=None, discard=True, comment=None, comment_url=None, rest={}, 
rfc2109=False)}}}

It gives two cookies where the first one contains name='expires', value=10.0 
which is unexpected. I expected that either the bad cookie is discarded or it 
is accepted but the value is always a str (even if it is garbage) or None.

This bug was found in my custom cookie policy where I do len(cookie.value or 
''). There is also a reference on StackOverflow but I believe no Python library 
bug report was filed: http://stackoverflow.com/q/20325571/1524507 . 

This was tested on Python 2.7.8, 3.2.6, 3.3.6, and 3.4.2.

--
components: Library (Lib)
messages: 233227
nosy: chfoo
priority: normal
severity: normal
status: open
title: cookiejar parses cookie value as int with empty name-value pair and 
Expires
type: behavior
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5

___
Python tracker 

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



[issue23077] PEP 1: Allow Provisional status for PEPs

2014-12-30 Thread Nick Coghlan

Nick Coghlan added the comment:

As we've started working through the post-release PEP 440 changes, I think this 
is definitely worthy of a separate PEP. I'll take the opportunity to pitch some 
other changes as well, like separating out the interoperability standards from 
the informational PEPs like the CPython release process guide, and add new 
metadata headers to indicate when the reference implementation of a standard is 
provided by a project other than CPython.

We may decide the extra complexity isn't worth it, but after wrangling PEP 440 
through to completion under the delegation of authority to distutils-sig, I'd 
at least like to have the discussion about what we think represents a 
"necessary, but sufficient" level of process change.

--

___
Python tracker 

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



[issue23127] socket.setsockopt() is still broken for multicast TTL and Loop options

2014-12-30 Thread Benjamin Peterson

Benjamin Peterson added the comment:

We don't really have a precedent for adjusting the size automatically when 
integers are passed to setsockopt. Anyway, your patch will be wrong for 
big-endian systems.

--

___
Python tracker 

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



[issue23127] socket.setsockopt() is still broken for multicast TTL and Loop options

2014-12-30 Thread Bertrand Janin

Bertrand Janin added the comment:

I don't really need it in my own software, I was trying to use 
https://github.com/SoCo/SoCo/ and couldn't get it working on OpenBSD.  I'm sure 
this is a portability problem on a number of library using Multicast.  Do you 
see something wrong with the patch?

--

___
Python tracker 

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



[issue23111] ftplib.FTP_TLS's default constructor does not work with TLSv1.1 or TLSv1.2

2014-12-30 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 29689050ec78 by Benjamin Peterson in branch '3.4':
update docs for #23111
https://hg.python.org/cpython/rev/29689050ec78

--

___
Python tracker 

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



[issue23111] ftplib.FTP_TLS's default constructor does not work with TLSv1.1 or TLSv1.2

2014-12-30 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 414c450e8406 by Benjamin Peterson in branch '3.4':
make PROTOCOL_SSLv23 the default protocol version for ftplib (closes #23111)
https://hg.python.org/cpython/rev/414c450e8406

New changeset 33603f7949c5 by Benjamin Peterson in branch 'default':
merge 3.4 (#23111)
https://hg.python.org/cpython/rev/33603f7949c5

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

___
Python tracker 

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



[issue19776] Provide expanduser() on Path objects

2014-12-30 Thread Antoine Pitrou

Changes by Antoine Pitrou :


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

___
Python tracker 

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



[issue19776] Provide expanduser() on Path objects

2014-12-30 Thread Roundup Robot

Roundup Robot added the comment:

New changeset bee697b0fd18 by Antoine Pitrou in branch 'default':
Issue #19776: Add a expanduser() method on Path objects.
https://hg.python.org/cpython/rev/bee697b0fd18

--
nosy: +python-dev

___
Python tracker 

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



[issue23136] BUG in how _strptime() handles week 0

2014-12-30 Thread Jim Carroll

New submission from Jim Carroll:

The following bit of code demonstrates a bug in how _strptime handles week 0. 
The bug is an edge condition that specifically affects how it handles two days 
before the first day of the new year

>>> for i in range(7):
... datetime.strptime('%s %s %s' % (0, 2015, i), '%W %Y %w').date()
... 
datetime.date(2015, 1, 4)
datetime.date(2014, 12, 29)
datetime.date(2015, 1, 1)   # <-- ERROR: should be '2014, 12, 30'
datetime.date(2014, 12, 31)
datetime.date(2015, 1, 1)
datetime.date(2015, 1, 2)
datetime.date(2015, 1, 3)

The issue stems from the fact that calls to _calc_julian_from_U_or_W() can 
return a -1, which under normal circumstances is invalid. The strptime() 
function tests and corrects when julian values are -1...but it should not do 
this when the week_of_year is zero.

The fact that it tests for ONLY -1 is why we see the problem in 2015. The error 
condition only exists when the first day of the year is exactly two days ahead 
of the date being tested for.

Patch is attached

--
components: Library (Lib)
files: patch.txt
messages: 233219
nosy: jamercee
priority: normal
severity: normal
status: open
title: BUG in how _strptime() handles week 0
versions: Python 2.7
Added file: http://bugs.python.org/file37568/patch.txt

___
Python tracker 

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



[issue23135] import searchpaths as arguments

2014-12-30 Thread R. David Murray

R. David Murray added the comment:

Thank you for the suggestion and patch, but we have a general policy of not 
adding unnecessary command line options, so I don't know that it will be 
accepted.

--
nosy: +r.david.murray

___
Python tracker 

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



[issue23111] ftplib.FTP_TLS's default constructor does not work with TLSv1.1 or TLSv1.2

2014-12-30 Thread varde

varde added the comment:

I know that, but it seems pretty unusual. And I would never had guessed from 
the documentation, I had to read the source.
My point is that it should be easier to just connect to a TLSv1.2 server: the 
documentation should mention the fact that ssl_version is a class attribute or 
it should be set to something more compatible like ssl.PROTOCOL_SSLv23.
I'm not sure about the implications of the latter.
I'm not saying that this is a serious bug, but I'm used to Python providing us 
with something that works (more or less) out of the box.

--

___
Python tracker 

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



[issue23135] import searchpaths as arguments

2014-12-30 Thread c2621566

New submission from c2621566:

This patch allows specifying import searchpaths as `-p path` arguments to the 
interpreter, without touching environment variables.

Avoiding environment variables simplifies a script of mine and is a portable 
way of swapping module implementation without touching the importing script.

e.g.
# python -p ~/.bin/customlib -p ~/.bin/other script.py
is equivalent to
# PYTHONPATH=~/.bin/customlib:~/.bin/other:$PYTHONPATH python script.py
similarly to
# ghci -i.bin/customlib:.bin/other foo.hs

It is implemented by prepending the arguments to sys.path in Py_Main just after 
Py_Initialize is called.

--
components: Interpreter Core
files: main.c.searchpatharg1.diff
keywords: patch
messages: 233216
nosy: c2621566
priority: normal
severity: normal
status: open
title: import searchpaths as arguments
type: enhancement
versions: Python 3.5
Added file: http://bugs.python.org/file37567/main.c.searchpatharg1.diff

___
Python tracker 

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



[issue23134] datetime.strptime at the turn of the year

2014-12-30 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

In C the strptime function doesn't return valid data if an input is invalid.

$ ./strptimetest "0 2015 1" "%W %Y %w"
2015-00--2 00:00:00
$ ./strptimetest "0 2015 2" "%W %Y %w"
2015-00--1 00:00:00
$ ./strptimetest "0 2015 3" "%W %Y %w"
2015-00-00 00:00:00
$ ./strptimetest "0 2015 4" "%W %Y %w"
2015-01-01 00:00:00
$ ./strptimetest "0 2015 5" "%W %Y %w"
2015-01-02 00:00:00
$ ./strptimetest "0 2015 6" "%W %Y %w"
2015-01-03 00:00:00
$ ./strptimetest "0 2015 7" "%W %Y %w"
2015-01-00 00:00:00

So this behavior likely is not a bug and doesn't need to be fixed in maintained 
releases. But it would be good to make strptime() more consistant and either 
extend it to support week and weekday numbers out of current valid range, or 
raise an exception.

--
nosy: +belopolsky, serhiy.storchaka
versions: +Python 3.5
Added file: http://bugs.python.org/file37566/strptimetest.c

___
Python tracker 

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



[issue23111] ftplib.FTP_TLS's default constructor does not work with TLSv1.1 or TLSv1.2

2014-12-30 Thread Giampaolo Rodola'

Giampaolo Rodola' added the comment:

ssl_version is a class attribute so you can simply set that before 
instantiating FTP_TLS class:

>>> import ftplib
>>> ftplib.FTP_TLS.ssl_version = ...
>>> client = ftplib.FTP_TLS(...)
>>> ...

--

___
Python tracker 

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



[issue23134] datetime.strptime at the turn of the year

2014-12-30 Thread Tomasz Ryczkowski

New submission from Tomasz Ryczkowski:

I've found wrong behaviour datetime.strptim function at the turn of the year.

I've created datetime object base on the week number (%W), year (%Y) and day of 
week (%w). The date for Tuesday in the first week in 2015 is wrong:

>>> from datetime import datetime
>>> datetime.strptime('%s %s %s' % (0, 2015, 1), '%W %Y %w').date()
datetime.date(2014, 12, 29) # OK

>>> datetime.strptime('%s %s %s' % (0, 2015, 2), '%W %Y %w').date()
datetime.date(2015, 1, 1) # WRONG !!!

>>> datetime.strptime('%s %s %s' % (0, 2015, 3), '%W %Y %w').date()
datetime.date(2014, 12, 31) # OK

>>> datetime.strptime('%s %s %s' % (0, 2015, 4), '%W %Y %w').date()
datetime.date(2015, 1, 1) # OK

>>> datetime.strptime('%s %s %s' % (0, 2015, 5), '%W %Y %w').date()
datetime.date(2015, 1, 2) # OK

>>> datetime.strptime('%s %s %s' % (0, 2015, 6), '%W %Y %w').date()
datetime.date(2015, 1, 3) # OK

>>> datetime.strptime('%s %s %s' % (0, 2015, 0), '%W %Y %w').date()
datetime.date(2015, 1, 4) # OK

The same error exists in another years.

Link to my post about this on stackoverflow:
http://stackoverflow.com/questions/27708833/why-does-datetime-strptime-get-an-incorrect-date-for-tuesday-in-the-week-0-of

--
messages: 233213
nosy: torm
priority: normal
severity: normal
status: open
title: datetime.strptime at the turn of the year
type: behavior

___
Python tracker 

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



[issue23130] Tools/scripts/ftpmirror.py allows overwriting arbitrary files on filesystem

2014-12-30 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 8f92ab37dd3a by Benjamin Peterson in branch '2.7':
delete old ftpmirror script, which now has security bugs (closes #23130)
https://hg.python.org/cpython/rev/8f92ab37dd3a

New changeset 223d0927e27d by Benjamin Peterson in branch '3.2':
delete old ftpmirror script, which now has security bugs (closes #23130)
https://hg.python.org/cpython/rev/223d0927e27d

New changeset e15d93926e47 by Benjamin Peterson in branch '3.3':
merge 3.2 (#23130)
https://hg.python.org/cpython/rev/e15d93926e47

New changeset 483746c32296 by Benjamin Peterson in branch '3.4':
merge 3.3 (#23130)
https://hg.python.org/cpython/rev/483746c32296

New changeset 4b64d300a67a by Benjamin Peterson in branch 'default':
merge 3.4 (#23130)
https://hg.python.org/cpython/rev/4b64d300a67a

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

___
Python tracker 

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



[issue23129] sqlite3 COMMIT nested in SELECT returns unexpected results

2014-12-30 Thread R. David Murray

R. David Murray added the comment:

Ah, then I suspect you are getting hit by the 'automatic transaction' feature 
of the DB2 API.  So it is probably not the commit, but the subsequent implicit 
'begin transaction' that is causing the problem.  The trick then is to figure 
out why that affects the existing select cursor.

--

___
Python tracker 

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



[issue23129] sqlite3 COMMIT nested in SELECT returns unexpected results

2014-12-30 Thread Jim Carroll

Jim Carroll added the comment:

Completely understood.

I recently found a workaround. Setting isolation_level to None seems to 
mitigate the issue, ie:

db = sq.connect(':memory:', isolation_level=None)

I'm hoping to put some time in scrutinizing the c-api code later this week (as 
SQLite bugs directly affect projects we work on) to see if we can get to the 
bottom of the issue.

--
title: sqlite3 COMMIT nested in SELECT returns unexpected   results -> 
sqlite3 COMMIT nested in SELECT returns unexpected results

___
Python tracker 

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



[issue23130] Tools/scripts/ftpmirror.py allows overwriting arbitrary files on filesystem

2014-12-30 Thread R. David Murray

R. David Murray added the comment:

I would guess that the most future-proof response to this would be to delete 
the script.  If we do keep it, it should definitely be fixed.

--
nosy: +r.david.murray

___
Python tracker 

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



[issue23129] sqlite3 COMMIT nested in SELECT returns unexpected results

2014-12-30 Thread R. David Murray

R. David Murray added the comment:

(Please trim the original message when replying to a tracker issue.)

When I said, "that probably means it's a doc issue", I meant that, even if it 
is a bug, for backward compatibility reasons we'd have to just document the 
behavior.  Fixing the bug would then be a new feature (new keyword to change 
the behavior or some such).  (ie: the fix to a design bug is a feature :)

Now, if it turns out that the bug lies elsewhere, or that changing the current 
statement-reset behavior wouldn't actually change the meaning of anyone's 
program if we changed it, then we could fix it as a bug.  But we'll need to 
understand the bug in detail before we can make that determination.

--

___
Python tracker 

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



[issue23128] Key presses are doubled in Tkinter dialog invoked from window close handler (OS X only)

2014-12-30 Thread Philipp Emanuel Weidmann

Philipp Emanuel Weidmann added the comment:

I upgraded to Python 2.7.9 and ActiveTcl 8.5.17.0 as suggested. I confirmed 
that this is the Tk version actually used by looking at Python's About dialog. 
The problem persists.

--

___
Python tracker 

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



[issue19980] Improve help('non-topic') response

2014-12-30 Thread Mark Lawrence

Mark Lawrence added the comment:

I screwed up, sorry folks.  If the latest patch isn't correct I give up as it's 
three strikes and I'm out :(

--
Added file: http://bugs.python.org/file37565/issue19880v3.diff

___
Python tracker 

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



[issue4431] Distutils MSVC doesn't create manifest file

2014-12-30 Thread Mark Lawrence

Mark Lawrence added the comment:

Should this issue be reopened or not?

--
components: +Windows
nosy: +dstufft, steve.dower, tim.golden, zach.ware
versions: +Python 3.5 -Python 3.2, Python 3.3

___
Python tracker 

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



[issue7833] bdist_wininst installers fail to load extensions built with Issue4120 patch

2014-12-30 Thread Mark Lawrence

Mark Lawrence added the comment:

This is referenced from #4431 which has been closed for over six years but 
keeps getting comments.

--
nosy: +BreamoreBoy, steve.dower, tim.golden, zach.ware

___
Python tracker 

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



[issue11245] Implementation of IMAP IDLE in imaplib?

2014-12-30 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
nosy:  -terry.reedy
versions: +Python 3.4 -Python 3.5

___
Python tracker 

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



[issue22939] integer overflow in iterator object

2014-12-30 Thread Ronald Oussoren

Ronald Oussoren added the comment:

Is it necessary to raise when it_index is PY_SSIZE_T_MAX? 

An alternative is to set it_index to -1 when there would be overflow and raise 
an exception on the next call to next(). That way a virtual sequence with 
PY_SSIZE_T_MAX-1 items would still work (instead of failing unexpectedly).

--
nosy: +ronaldoussoren

___
Python tracker 

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



[issue23103] Reduce memory usage for ipaddress object instances

2014-12-30 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

As far as adding __slots__ breaks pickling with protocols < 2, issue23133 can 
be considered as a dependency.

--
dependencies: +Pickling of ipaddress classes

___
Python tracker 

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



[issue23133] Pickling of ipaddress classes

2014-12-30 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Currently ipaddress classes support pickling, but the pickling is not efficient 
and is implementation depened. Proposed patch makes pickling more compact and 
implementation agnostic.

--
components: Library (Lib)
files: ipaddress_pickle.patch
keywords: patch
messages: 233201
nosy: ncoghlan, pmoody, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Pickling of ipaddress classes
type: enhancement
versions: Python 3.5
Added file: http://bugs.python.org/file37564/ipaddress_pickle.patch

___
Python tracker 

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



[issue23103] Reduce memory usage for ipaddress object instances

2014-12-30 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Updated patch preserves weak references support.

--
Added file: http://bugs.python.org/file37563/ipaddress_lightweight_3.patch

___
Python tracker 

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



[issue18921] In imaplib, cached capabilities may be out of date after login

2014-12-30 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
versions: +Python 3.5 -Python 3.4

___
Python tracker 

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



[issue11245] Implementation of IMAP IDLE in imaplib?

2014-12-30 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
versions: +Python 3.5 -Python 3.4

___
Python tracker 

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



[issue23123] Only READ support for Decimal in json

2014-12-30 Thread Anders Rundgren

Anders Rundgren added the comment:

> Antoine Pitrou added the comment:
> 
> I won't claim to know/understand the specifics, but "message payload in 
> base64" actually sounds reasonable to me, if far from optimal (both from 
> readibility and space overhead POV) :-).

It is indeed a working solution.  I do though think that communities that 
previously used XML would accept base64-encoded messages.  It becomes really 
messy when applied to counter-signed messages like the following:

{
  "@context": "http://xmlns.webpki.org/wcpp-payment-demo";,
  "@qualifier": "AuthData",
  "paymentRequest": 
{
  "commonName": "Demo Merchant",
  "amount": 8600550,
  "currency": "USD",
  "referenceId": "#100",
  "dateTime": "2014-12-18T13:39:35Z",
  "signature": 
{
  "algorithm": "RS256",
  "signerCertificate": 
{
  "issuer": "CN=Merchant Network Sub CA5,C=DE",
  "serialNumber": "1413983542582",
  "subject": "CN=Demo Merchant,2.5.4.5=#1306383936333235,C=DE"
},
  "certificatePath": 
[
  
"MIIDQzCCAiugAwIBAgIGAUk3_J02M...eMGlY734U3NasQfAhTUhxrdDbphEvsWTc",
  
"MIIEPzCCAiegAwIBAgIBBTANBgkqh...gU1IyRGA7IbdHOeDB2RUpsXloU2QKfLrk"
],
  "value": 
"Ny4Qe6FQhd5_qcSc3xiH8Kt7tIZ9Z...9LEjC6_Rulg_G20fGxJ-wzezFpsAGbmuFQg"
}
},
  "domainName": "merchant.com",
  "cardType": "SuperCard",
  "pan": "1618342124919252",
  "dateTime": "2014-12-18T13:40:59Z",
  "signature": 
{
  "algorithm": "RS256",
  "signerCertificate": 
{
  "issuer": "CN=Mybank Client Root CA1,C=US",
  "serialNumber": "1413983550045",
  "subject": "CN=The Cardholder,2.5.4.5=#13083935363733353232"
},
  "certificatePath": 
["MIIENzCCAh-gAwIBAgIGAUk3_LpdM...IGcN1md5feo5DndNnV8D0UM-oBRkUDDFiWlhCU"],
  "value": 
"wyUcFcHmvM5ZozZKOEwOQkYic0D7M...S_HbaPGau5KfZjCaksvb5U1lYZaXxP8kAbuGPQ"
}
}

--

___
Python tracker 

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



[issue23123] Only READ support for Decimal in json

2014-12-30 Thread Antoine Pitrou

Antoine Pitrou added the comment:

I won't claim to know/understand the specifics, but "message payload in base64" 
actually sounds reasonable to me, if far from optimal (both from readibility 
and space overhead POV) :-).

--

___
Python tracker 

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



[issue23103] Reduce memory usage for ipaddress object instances

2014-12-30 Thread Antoine Pitrou

Antoine Pitrou added the comment:

> I don't think that IP addresses need weak references more than base types as 
> integers or strings. 

People may already be taking weak references, so it's a matter of compatibility.
(and weakrefs can actually help implement an interning scheme as proposed here)

--

___
Python tracker 

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



[issue23094] Unpickler failing with PicklingError at frame end on readline due to a broken comparison

2014-12-30 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
keywords: +needs review
stage: needs patch -> patch review

___
Python tracker 

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



[issue23132] Faster total_ordering

2014-12-30 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


Added file: http://bugs.python.org/file37562/total_ordering_bench.py

___
Python tracker 

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



[issue23132] Faster total_ordering

2014-12-30 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Proposed patch makes comparation method generated by the total_ordering 
decorator faster up to 20%.

Benchmark results:

  Unpatched Patched
a < b   2.46  2.45
b < a   2.48  2.49
a >= b  4.86  4.16
b >= a  5.1   4.16
a <= b  4.93  4.15
b <= a  7.31  5.98
a > b   5.25  4.38
b > a   8.11  7.04

It also adds few additional attributes to generated methods.

--
components: Library (Lib)
files: total_ordering_faster.patch
keywords: patch
messages: 233196
nosy: ncoghlan, rhettinger, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Faster total_ordering
type: performance
versions: Python 3.5
Added file: http://bugs.python.org/file37561/total_ordering_faster.patch

___
Python tracker 

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



[issue23123] Only READ support for Decimal in json

2014-12-30 Thread Anders Rundgren

Anders Rundgren added the comment:

> Antoine Pitrou added the comment:
> 
> "To cope with this potential problem, compliant parsers must preserve the 
> original textual representation of properties internally in order to support 
> JCS normalization requirements"
> 
> That sounds ridiculous. Did someone try to reason the "IETF guys"?:)

The alternative is either doing what Bob suggested which is almost the same as 
writing a new parser or take the IETF route and shroud the message payload in 
base64.

So all solutions are "by definition" bd :-)

FWIW my super-bad solution has the following compatibility issues:
- Whitespace: None, all parsers can "stringify", right?
- Escaping: None, all parsers MUST do it to follow the JSON spec.
- Property order: A problem in some parsers.  If you take a look on 
stackoverflow lots of folks request that insertion/reader order should be 
honored since computers <> humans.  Fixed in Python. Works in browsers as well.
- Floating point: an almost useless JSON feature anyway, it doesn't work for 
crypto-numbers or money.  It is "only" a validation problem though.  Now fixed 
in Python.

http://www.ietf.org/mail-archive/web/acme/current/msg00200.html

--

___
Python tracker 

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



[issue23103] Reduce memory usage for ipaddress object instances

2014-12-30 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> I believe you need to add a bunch of __slots__ = () to various base classes 
> in the module, even though they lack member variables.

Done. Here is updated patch.

I don't think that IP addresses need weak references more than base types as 
integers or strings. Caching can be implemented without weak references (some 
caching already is used for networks), and I afraid that supporting weak 
references list will spent more memory than saved with caching.

--
Added file: http://bugs.python.org/file37560/ipaddress_lightweight_2.patch

___
Python tracker 

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



[issue22166] test_codecs leaks references

2014-12-30 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
stage: resolved -> needs patch

___
Python tracker 

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



[issue23123] Only READ support for Decimal in json

2014-12-30 Thread Antoine Pitrou

Antoine Pitrou added the comment:

"""To cope with this potential problem, compliant parsers must preserve the 
original textual representation of properties internally in order to support 
JCS normalization requirements"""

That sounds ridiculous. Did someone try to reason the "IETF guys"? :)

--
nosy: +pitrou

___
Python tracker 

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