[issue16878] argparse: positional args with nargs='*' defaults to []

2013-01-06 Thread Chris Jerdonek

New submission from Chris Jerdonek:

In argparse, positional arguments with nargs='*' default to [] rather None, 
even if default=None is passed explicitly.  The documentation says otherwise:

The default keyword argument of add_argument(), whose value defaults to None, 
specifies what value should be used if the command-line argument is not 
present. ... For positional arguments with nargs equal to ? or *, the default 
value is used when no command-line argument was present:

(from http://docs.python.org/dev/library/argparse.html#default )

import argparse

def parse(args, **kwargs):
parser = argparse.ArgumentParser()
parser.add_argument('foo', **kwargs)
ns = parser.parse_args(args)
print(repr(ns.foo))

parse([], nargs='?')# None
parse([], nargs='*')# []--
parse([], nargs='*', default=None)  # []--
parse([], nargs='*', default=False) # False
parse([], nargs='*', default=0) # 0

Three options include (there may be more):

(1) document the behavior
(2) make a default of None yield None
(3) do (2), but change the default to [] instead of None when nargs='*'

--
components: Library (Lib)
messages: 179174
nosy: bethard, chris.jerdonek
priority: normal
severity: normal
status: open
title: argparse: positional args with nargs='*' defaults to []
type: behavior
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4

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



[issue12641] Remove -mno-cygwin from distutils

2013-01-06 Thread Geert Jansen

Geert Jansen added the comment:

*bump*

I just installed MinGW 2.6.2 32-bit on Windows XP. It doesn't accept -mnocygwin 
and there is no binary i686-pc-mingw32-gcc either.

It would be great if you could agree on an approach and get this fixed. This 
impacts a lot of users that want to build extensions on Windows. In the mean 
time users can find a hack to work around the issue here: 
https://gist.github.com/4466320

--
nosy: +geertj

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



[issue12641] Remove -mno-cygwin from distutils

2013-01-06 Thread Martin v . Löwis

Martin v. Löwis added the comment:

Geert: Someone will have to provide a patch, else the issue will go nowhere. I 
will insist that the patch continues to support older gcc installations (from 
2012), at least if implemented as a bug fix to older Python releases.

--

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



[issue16876] epoll: reuse epoll_event buffer instead of allocating a new one at each poll()

2013-01-06 Thread Charles-François Natali

Changes by Charles-François Natali neolo...@free.fr:


Removed file: http://bugs.python.org/file28586/epoll_realloc.diff

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



[issue16876] epoll: reuse epoll_event buffer instead of allocating a new one at each poll()

2013-01-06 Thread Charles-François Natali

Changes by Charles-François Natali neolo...@free.fr:


Added file: http://bugs.python.org/file28587/epoll_realloc.diff

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



[issue16843] sporadic test_sched failure

2013-01-06 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The previous patch is broken, here is a fixed, more complicated, patch. May be 
this class would be useful in other tests.

--
Added file: 
http://bugs.python.org/file28588/test_sched_deterministic_timer_2.patch

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



[issue16876] epoll: reuse epoll_event buffer instead of allocating a new one at each poll()

2013-01-06 Thread Charles-François Natali

Changes by Charles-François Natali neolo...@free.fr:


Removed file: http://bugs.python.org/file28587/epoll_realloc.diff

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



[issue16876] epoll: reuse epoll_event buffer instead of allocating a new one at each poll()

2013-01-06 Thread Charles-François Natali

Changes by Charles-François Natali neolo...@free.fr:


Added file: http://bugs.python.org/file28589/epoll_realloc.diff

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



[issue16843] sporadic test_sched failure

2013-01-06 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 The previous patch is broken, here is a fixed, more complicated,
 patch. May be this class would be useful in other tests.

I don't understand what you're gaining with this complicated class: your
class guarantees that the sleepers will be woken up, but it doesn't
guarantee that any user code will actually run.

Perhaps the whole thing would be simpler if your tests used a Queue
instead of a list?

--

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



[issue16879] distutils.command.config uses fragile constant temporary file name

2013-01-06 Thread Michał Górny

New submission from Michał Górny:

The distutils.command.config module reads:

def _gen_temp_sourcefile(self, body, headers, lang):
filename = _configtest + LANG_EXT[lang]

which means that every time one of the functions is used, a temporary file with 
the same name will be created. This is really fragile and fails terribly 
whenever more than one process tries to use the relevant functions in the same 
working directory.

I believe this code should use the tempfile module to generate unique temporary 
files names instead.

--
assignee: eric.araujo
components: Distutils
messages: 179179
nosy: eric.araujo, mgorny, tarek
priority: normal
severity: normal
status: open
title: distutils.command.config uses fragile constant temporary file name
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3

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



[issue16873] increase epoll.poll() maxevents default value, and improve documentation

2013-01-06 Thread Richard Oudkerk

Richard Oudkerk added the comment:

Is this actually a problem?

If events are arranged in a queue and epoll_wait() just removes the oldest 
events (up to maxevents) from that queue then there would be no problem with 
using a small value for maxevents.

I don't *know* if that is the case, but I would consider epoll to be broken if 
it does not do something similar.

--
nosy: +sbt

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



[issue12939] Add new io.FileIO using the native Windows API

2013-01-06 Thread Richard Oudkerk

Richard Oudkerk added the comment:

Attached is a patch which adds a winio module which is a replacement for io, 
but uses windows handles instead of fds.

It reimplements FileIO and open(), and provides openhandle() and closehandle() 
as replacements for os.open() and os.close().

test_io has been modified to exercise winio (in addition to _io and _pyio) and 
all the tests pass.

Note that some of the implementation (openhandle(), open(), FileIO.__init__()) 
is still done in Python rather than C.

--
keywords: +patch
Added file: http://bugs.python.org/file28590/winfileio.patch

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



[issue8109] Server-side support for TLS Server Name Indication extension

2013-01-06 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Fixed in 52b4d9bfc9ea (Roundup e-mail gateway seems broken).

--
resolution:  - fixed
stage: needs patch - committed/rejected
status: open - closed

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



[issue16873] increase epoll.poll() maxevents default value, and improve documentation

2013-01-06 Thread Charles-François Natali

Charles-François Natali added the comment:

The implementation can't simply drain a queue, because it can be
level-triggered (which is the case by default), so you want to keep
events around. The kernel actually uses a red-black tree, but I didn't
really check how it's done (there's probably very good reasosns for
that).

Anyway, it can turn out to be a problem, for two reasons:
- performance: by specifying a maxevents value too low, several calls
to epoll_wait() must be made, instead of being able to process all
events at once
- the main problem that came to my mind is really starvation: let's
say you have 2*FD_SETSIZE client sockets registered in your poll
object. The first call to epoll_wait() returns sockets from 0 to
FD_SETSIZE-1: you process them, so they're not ready anymore. The next
call returns the clients from FD_SETSIZE to 2*FD_SETSIZE, same thing.
But by the time you call epoll_wait() for the third time, if the first
FD_SETSIZE clients are ready again, they will be returned, etc. So the
2*FD_SETSIZE th client may very well never be reported ready: that's
starvation.

I actually wrote a script to reproduce this issue:

$ ./python /home/cf/test_epoll.py
Working with 4080 FDs, -1 maxevents
Number of missing FDs:4080
Number of ready FDs: 1023
Number of missing FDs:3057
Number of ready FDs: 0
Number of missing FDs:3057
Number of ready FDs: 1023
Number of missing FDs:2034
Number of ready FDs: 0
Number of missing FDs:2034
Number of ready FDs: 1023
Number of missing FDs:2034
Number of ready FDs: 0
Number of missing FDs:2034
Number of ready FDs: 1023
Number of missing FDs:2034
Number of ready FDs: 0
[...]


If you specify a large enough maxevents:

$ ./python /home/cf/test_epoll.py 64000
Working with 4080 FDs, 64000 maxevents
Number of missing FDs:4080
Number of ready FDs: 4080


Note that it's really a corner issue, but I stumpled upon this problem
while writing a test in issue #16853, and several projects (Tulip,
Tornado, pyftpdlib) fall into this trap.

I see several options:
1) just keep it that way (i.e. with maxevents set to FD_SETSIZE), and
add a note in the documentation. I think it's always better to handle
problems in the library than let the users get bitten.
2) increase `maxevents` default value. The problem is that I don't
like magic values, and a too large value could incur increased memory
consumption (and with the current implementation reduced performance
because the epoll events buffer is allocated at each poll(), see issue
#16876.
3) use a simple heuristic: start with a reasonable value for
`maxevents` (FD_SETSIZE seems like a good candidate), and if
epoll_wait() ever returns `maxevents` events, double the value (that's
what libevent does, with a capping to 32000).

--
Added file: http://bugs.python.org/file28591/test_epoll.py

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



[issue16878] argparse: positional args with nargs='*' defaults to []

2013-01-06 Thread R. David Murray

R. David Murray added the comment:

I'd prefer to fix it, since having the action='append' and nargs='*' behaviors 
be different looks like a bug.  However, fixing it to match 'append' (default 
really is None) would be likely to break working code, so we certainly couldn't 
backport that, and I'd be really reluctant to fix it that way in 3.4, either.  
(3) is thus preferable to (2), even though it leaves us with an inconsistency.  
It would still be a judgment call on whether or not to backport it.  It seems 
like it would be reasonably safe, but such changes always worry me :)

--
nosy: +r.david.murray

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



[issue16873] increase epoll.poll() maxevents default value, and improve documentation

2013-01-06 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 3) use a simple heuristic: start with a reasonable value for
 `maxevents` (FD_SETSIZE seems like a good candidate), and if
 epoll_wait() ever returns `maxevents` events, double the value (that's
 what libevent does, with a capping to 32000).

What if some events are edge-triggered?

--
nosy: +pitrou

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



[issue16880] Importing imp will fail if dynamic loading not supported

2013-01-06 Thread Jeffrey Armstrong

New submission from Jeffrey Armstrong:

On a platform where dynamic loading is unsupported, the function 
imp_load_dynamic is not compiled (Python/import.c:1775), and the Python 
function load_dynamic (Python/import.c:1845) will not be included in the _imp 
module.  However, Lib/imp.py attempts to import load_dynamic from _imp 
(Lib/imp.py:9), causing an ImportError if dynamic loading is unsupported.  

The interpreter is unable to start under these circumstances.  The error was 
encountered on m68k-atari-mint using GCC as the compiler.  This platform is a 
desktop environment, but has no support for true shared objects and libraries.

--
components: Library (Lib)
messages: 179186
nosy: Jeffrey.Armstrong
priority: normal
severity: normal
status: open
title: Importing imp will fail if dynamic loading not supported
type: behavior
versions: Python 3.3

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



[issue16880] Importing imp will fail if dynamic loading not supported

2013-01-06 Thread Antoine Pitrou

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


--
nosy: +brett.cannon, ncoghlan
stage:  - needs patch
versions: +Python 3.4

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



[issue16881] Py_ARRAY_LENGTH macro incorrect with GCC 3.1

2013-01-06 Thread Jeffrey Armstrong

New submission from Jeffrey Armstrong:

The Py_ARRAY_LENGTH macro (Include/pymacro.h:36) checks to see if using GCC by 
simply looking for __GCC__ being defined.  If so, it uses the GCC extension 
function __builtin_types_compatible_p.  However, this function was not 
introduced until GCC 3.1.  This simple check for a GCC compiler causes the 
Python build to fail on GCC  3.1 (2.95 for example).

The check should actually be:

#if (defined(__GNUC__)  !defined(__STRICT_ANSI__)  \
((__GNUC__ == 3)  (__GNU_MINOR__) = 1) || (__GNUC__ = 4)))

Similar checks are made in other locations in the core library, just not here.  

This bug was discovered while attempting a build on m68k-atari-mint, which 
relies on GCC 2.95.3.  Other systems may also be using this compiler still.

--
components: Build
messages: 179187
nosy: Jeffrey.Armstrong
priority: normal
severity: normal
status: open
title: Py_ARRAY_LENGTH macro incorrect with GCC  3.1
type: compile error
versions: Python 3.3

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



[issue16881] Py_ARRAY_LENGTH macro incorrect with GCC 3.1

2013-01-06 Thread Christian Heimes

Christian Heimes added the comment:

Fixed in http://hg.python.org/cpython/rev/13c83199c211

--
assignee:  - christian.heimes
nosy: +christian.heimes
resolution:  - fixed
stage:  - committed/rejected
status: open - closed
versions: +Python 3.4

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



[issue16873] increase epoll.poll() maxevents default value, and improve documentation

2013-01-06 Thread Richard Oudkerk

Richard Oudkerk added the comment:

 I actually wrote a script to reproduce this issue:

The program does *not* demonstrate starvation because you are servicing the 
resource represented by the starved duplicate fds before calling poll() again.

You are creating thousands of duplicate handles for the same resource and then 
complaining that they do not behave independently!

I tried modifing your program by running poll() in a loop, exiting when no more 
unseen fds are reported as ready.  This makes the program exit immediately.

So

ready_writers = set(fd for fd, evt in 
ep.poll(-1, MAXEVENTS) if fd != r)
seen_writers |= ready_writers

becomes

while True:
ready_writers = set(fd for fd, evt in
ep.poll(-1, MAXEVENTS) if fd != r)
if ready_writers.issubset(seen_writers):
break
seen_writers |= ready_writers

I still cannot see a problem with epoll().

--

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



[issue15204] Deprecate the 'U' open mode

2013-01-06 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 Would the deprecation need to be moved up to 3.4 though now?

Yes, I think so.

--
versions:  -Python 3.3

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



[issue16880] Importing imp will fail if dynamic loading not supported

2013-01-06 Thread Christian Heimes

Christian Heimes added the comment:

The attached patch should fix the issue. Can you give it a try, please?

--
assignee:  - christian.heimes
nosy: +christian.heimes

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



[issue16880] Importing imp will fail if dynamic loading not supported

2013-01-06 Thread Christian Heimes

Changes by Christian Heimes li...@cheimes.de:


--
keywords: +patch
Added file: http://bugs.python.org/file28592/imp_dynamic.patch

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



[issue16880] Importing imp will fail if dynamic loading not supported

2013-01-06 Thread Brett Cannon

Brett Cannon added the comment:

LGTM

--
stage: needs patch - commit review

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



[issue16880] Importing imp will fail if dynamic loading not supported

2013-01-06 Thread Brett Cannon

Brett Cannon added the comment:

I should say LGTM in terms of looking at the patch, not actually trying it out. 
=)

--

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



[issue8109] Server-side support for TLS Server Name Indication extension

2013-01-06 Thread Antoine Pitrou

Antoine Pitrou added the comment:

(testing Roundup mail gateway, please ignore)

--

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



[issue16880] Importing imp will fail if dynamic loading not supported

2013-01-06 Thread Brett Cannon

Brett Cannon added the comment:

I did just realize, though, there is no test for temporarily setting 
load_dynamic() to None in imp.py to make sure the expected exception is raised.

--

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



[issue16868] Python Developer Guide: Include a reminder to ping bug report if not reviewed in timely manner

2013-01-06 Thread Brett Cannon

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


--
nosy: +brett.cannon

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



[issue16537] Python’s setup.py raises a ValueError when self.extensions is empty

2013-01-06 Thread Brett Cannon

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


--
nosy: +brett.cannon

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



[issue16880] Importing imp will fail if dynamic loading not supported

2013-01-06 Thread Jeffrey Armstrong

Jeffrey Armstrong added the comment:

The patch works with respect to allowing the interpreter to start, and 
importing modules from the interpreter seems to be working fine.  I can't speak 
to Brett's concerns about possible side effects of setting load_dynamic to None.

--

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



[issue16877] Odd behavior of ~ in os.path.abspath and os.path.realpath

2013-01-06 Thread Ian Shields

Ian Shields added the comment:

Regarding last comment. I had missed the comment in documentation fo 
os.path.join Join one or more path components intelligently. If any component 
is an absolute path, all previous components (on Windows, including the 
previous drive letter, if there was one) are thrown away, and joining 
continues. So the issue is really the behavior of os.path.join where the 
intelligence in the joining does not recognize that ~ is usually expanded to 
an absolute path. Consider the following Bash commands:
[ian@attic4 testpath]$ pwd
/home/ian/testpath
[ian@attic4 testpath]$ echo $(cd ~/testpath/..;pwd)
/home/ian
[ian@attic4 testpath]$ cd /home/ian/~
bash: cd: /home/ian/~: No such file or directory

Now consider some Python
 os.getcwd()
'/home/ian/testpath'
 os.path.join(os.getcwd(), /home/ian)
'/home/ian'
 os.path.expanduser(~)
'/home/ian'
 os.path.join(os.getcwd(), ~)
'/home/ian/testpath/~'
 os.path.expanduser(os.path.abspath(~))
'/home/ian/testpath/~'
 os.path.abspath(os.path.expanduser(~))
'/home/ian'

I find the Python behavior rather odd. I cna live with it now I know about it, 
but if it is really intentional it would help to document this rather odd 
behavior somewhat better.

--
status: pending - open

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



[issue16877] Odd behavior of ~ in os.path.abspath and os.path.realpath

2013-01-06 Thread Georg Brandl

Georg Brandl added the comment:

Can you point exactly where the odd behavior is?  Note that ~ is a normal 
component for UNIX file/path names, and in such it has no special meaning (as 
opposed to /).

This is why it gets no special handling by any Python path functions, except 
for expanduser().  That it is handled specially by the shell is no reason for 
Python to do the same.

--
nosy: +georg.brandl
status: open - closed

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



[issue9685] tuples should remember their hash value

2013-01-06 Thread Georg Brandl

Changes by Georg Brandl ge...@python.org:


--
nosy: +georg.brandl

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



[issue16843] sporadic test_sched failure

2013-01-06 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

 I don't understand what you're gaining with this complicated class: your
 class guarantees that the sleepers will be woken up, but it doesn't
 guarantee that any user code will actually run.

It guarantees that advance() returns only when all sleepers are sleeping or 
died, and all user code before specified time mark have executed. User code 
running does not take time, only sleeps take time. Actually this class is a 
forward-running time-machine with pause. But it looks overkill here.

 Perhaps the whole thing would be simpler if your tests used a Queue
 instead of a list?

Hmm, I had not occurred to this idea. Indeed, the patch is a little 
complicated (honestly speaking, it is a lot complicated). Here is a more 
simplified patch that uses a queue for synchronization in one direction and 
simple custom timer for synchronization in another direction. Thank you for 
suggestion.

--
Added file: http://bugs.python.org/file28593/test_sched_queue.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16843
___diff -r c1fc6b6d1cfc Lib/test/test_sched.py
--- a/Lib/test/test_sched.pySat Jan 05 06:26:39 2013 -0800
+++ b/Lib/test/test_sched.pySun Jan 06 19:48:45 2013 +0200
@@ -1,5 +1,6 @@
 #!/usr/bin/env python
 
+import queue
 import sched
 import time
 import unittest
@@ -9,6 +10,35 @@
 except ImportError:
 threading = None
 
+TIMEOUT = 10
+
+
+class Timer:
+def __init__(self):
+self._cond = threading.Condition()
+self._time = 0
+self._stop = 0
+
+def time(self):
+with self._cond:
+return self._time
+
+def sleep(self, t):
+assert t = 0
+with self._cond:
+t += self._time
+while self._stop  t:
+self._time = self._stop
+self._cond.wait()
+self._time = t
+
+def advance(self, t):
+assert t = 0
+with self._cond:
+self._stop += t
+self._cond.notify_all()
+
+
 class TestCase(unittest.TestCase):
 
 def test_enter(self):
@@ -31,17 +61,33 @@
 
 @unittest.skipUnless(threading, 'Threading required for this test.')
 def test_enter_concurrent(self):
-l = []
-fun = lambda x: l.append(x)
-scheduler = sched.scheduler(time.time, time.sleep)
-scheduler.enter(0.03, 1, fun, (0.03,))
+q = queue.Queue()
+fun = q.put
+timer = Timer()
+scheduler = sched.scheduler(timer.time, timer.sleep)
+scheduler.enter(1, 1, fun, (1,))
+scheduler.enter(3, 1, fun, (3,))
 t = threading.Thread(target=scheduler.run)
 t.start()
-for x in [0.05, 0.04, 0.02, 0.01]:
-z = scheduler.enter(x, 1, fun, (x,))
-scheduler.run()
-t.join()
-self.assertEqual(l, [0.01, 0.02, 0.03, 0.04, 0.05])
+timer.advance(1)
+self.assertEqual(q.get(timeout=TIMEOUT), 1)
+self.assertTrue(q.empty())
+for x in [4, 5, 2]:
+z = scheduler.enter(x - 1, 1, fun, (x,))
+timer.advance(2)
+self.assertEqual(q.get(timeout=TIMEOUT), 2)
+self.assertEqual(q.get(timeout=TIMEOUT), 3)
+self.assertTrue(q.empty())
+timer.advance(1)
+self.assertEqual(q.get(timeout=TIMEOUT), 4)
+self.assertTrue(q.empty())
+timer.advance(1)
+self.assertEqual(q.get(timeout=TIMEOUT), 5)
+self.assertTrue(q.empty())
+timer.advance(1000)
+t.join(timeout=TIMEOUT)
+self.assertFalse(t.is_alive())
+self.assertTrue(q.empty())
 
 def test_priority(self):
 l = []
@@ -69,21 +115,35 @@
 
 @unittest.skipUnless(threading, 'Threading required for this test.')
 def test_cancel_concurrent(self):
-l = []
-fun = lambda x: l.append(x)
-scheduler = sched.scheduler(time.time, time.sleep)
-now = time.time()
-event1 = scheduler.enterabs(now + 0.01, 1, fun, (0.01,))
-event2 = scheduler.enterabs(now + 0.02, 1, fun, (0.02,))
-event3 = scheduler.enterabs(now + 0.03, 1, fun, (0.03,))
-event4 = scheduler.enterabs(now + 0.04, 1, fun, (0.04,))
-event5 = scheduler.enterabs(now + 0.05, 1, fun, (0.05,))
+q = queue.Queue()
+fun = q.put
+timer = Timer()
+scheduler = sched.scheduler(timer.time, timer.sleep)
+now = timer.time()
+event1 = scheduler.enterabs(now + 1, 1, fun, (1,))
+event2 = scheduler.enterabs(now + 2, 1, fun, (2,))
+event4 = scheduler.enterabs(now + 4, 1, fun, (4,))
+event5 = scheduler.enterabs(now + 5, 1, fun, (5,))
+event3 = scheduler.enterabs(now + 3, 1, fun, (3,))
 t = threading.Thread(target=scheduler.run)
 t.start()
-scheduler.cancel(event1)
+timer.advance(1)
+self.assertEqual(q.get(timeout=TIMEOUT), 1)
+  

[issue16843] sporadic test_sched failure

2013-01-06 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 Actually this class is a 
 forward-running time-machine with pause.

Perhaps you should give it to Guido as a present?

--

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



[issue16873] increase epoll.poll() maxevents default value, and improve documentation

2013-01-06 Thread Charles-François Natali

Charles-François Natali added the comment:

 The program does *not* demonstrate starvation because you are servicing the 
 resource represented by the starved duplicate fds before calling poll() 
 again.

No.
What the program does is the following:

while all the write FDs have not been returned by epoll.wait() at least once:
1) make all writer FDs ready by draining the pipe
2) fetch the list of event reported by epoll(), and add them to
the list of seen FDs
3) make all the writers FDs not ready by filling the PIPE
4) fetch the list of event reported by epoll(), and add them to
the list of seen FDs

With the default 'maxevents' parameters, it never completes.

This shows that the FDs returned at step 2 are actually a strict
subset of all the ready FDs, and this forever: some FDs which are
actually ready (they are all ready at step 2) are *never* reported.
This is starvation.

By increasing epoll.wait() maxevents, it completes immediately.

 You are creating thousands of duplicate handles for the same resource and 
 then complaining that they do not behave independently!

The fact that that the FDs are duped shouldn't change anything to the
events reported: it works while the number of FDs is less than
FD_SETSIZE (epoll_wait() maxevents argument).

See also epoll() documentation:


   Q0  What is the key used to distinguish the file descriptors
registered in an
   epoll set?

   A0  The key is the combination of the file descriptor number
and the open file
   description (also known as an open file handle, the
kernel's internal
   representation of an open file).

   Q1  What happens if you register the same file descriptor on an
epoll instance
   twice?

   A1  You will probably get EEXIST.  However, it is possible to
add a duplicate
   (dup(2), dup2(2), fcntl(2) F_DUPFD) descriptor to the same
epoll instance.
   This can be a useful technique for filtering events, if the
duplicate file
   descriptors are registered with different events masks.


I just used dup() to make it easier to test, but you'll probably get
the same thing it your FDs were sockets connected to different
endpoints.

 I tried modifing your program by running poll() in a loop, exiting when no 
 more unseen fds are reported as ready.  This makes the program exit 
 immediately.

 So

 ready_writers = set(fd for fd, evt in
 ep.poll(-1, MAXEVENTS) if fd != r)
 seen_writers |= ready_writers

 becomes

 while True:
 ready_writers = set(fd for fd, evt in
 ep.poll(-1, MAXEVENTS) if fd != r)
 if ready_writers.issubset(seen_writers):
 break
 seen_writers |= ready_writers

Of course it does, since the returned FDs are a subset of all the
ready file descriptors.

The point is precisely that, when there are more FDs ready than
maxevents, some FDs will never be reported.

--

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



[issue9685] tuples should remember their hash value

2013-01-06 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Sorry, Raymond. It was a bad day for Roundup.

--
assignee:  - rhettinger
nosy: +serhiy.storchaka

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



[issue16843] sporadic test_sched failure

2013-01-06 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

 Perhaps you should give it to Guido as a present?

First I have to find some application for it. Wait for me at the 3013 year.

--

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




[issue16840] Tkinter doesn't support large integers

2013-01-06 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I reclassify this as enhancement until the real bug is not found.

--
type: behavior - enhancement
versions:  -Python 2.7, Python 3.2, Python 3.3

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



[issue16877] Odd behavior of ~ in os.path.abspath and os.path.realpath

2013-01-06 Thread R. David Murray

R. David Murray added the comment:

In addition, as far as I know, ba/sh has no equivalent to os.path.join (see, 
eg: http://unix.stackexchange.com/questions/23208/building-paths-robustly).  So 
even if we *did* want to act like the shell there's no analog to point to.  
The shell only expands ~ when it is the first component of a path in a globbing 
context, and Python does not do globbing automatically anywhere.  So calling 
expanduser on a path before doing the join allows you to recognize '~'s if you 
want to support them in your input.  But, as I said, the shell has no real 
analog for join, so talking about the behavior of join in analogy to the 
behavior of the shell is pretty meaningless.

The key thing to realize here is that Python does not do globbing automatically 
(there is a separate glob module for that).  I don't think even a doc update is 
warranted, since it would be a bit weird to document things we *don't* do :)  
However, if you have a specific proposal for what such a note would look like 
and where it would be placed, we would consider it, as we are always looking to 
make the docs better.

--

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



[issue16877] Odd behavior of ~ in os.path.abspath and os.path.realpath

2013-01-06 Thread Ian Shields

Ian Shields added the comment:

Oddity may be in the eye of the beholder. I've been programming and scripting 
for about 40 years, including several *IX shells and many other systems. I'm 
relatively new to Python. Mostly the results of doing things in Python are what 
I expect. Not doing expansion of a leading tilde when I ask for an absolute 
path is not what I expect. So to me it's odd. Or different. Or just not what I 
expect. Substitute unexpected for odd if you like. Sure, tilde expansion 
wasn't part of the Bourne shell, but it's been in POSIX shells for about the 
same amount of time that Python has been around, so it's odd to me that Python 
differs in this way. It's not hard to work around now that I know about it.

--

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



[issue16873] increase epoll.poll() maxevents default value, and improve documentation

2013-01-06 Thread Richard Oudkerk

Richard Oudkerk added the comment:

 The fact that that the FDs are duped shouldn't change anything to the
 events reported: it works while the number of FDs is less than
 FD_SETSIZE (epoll_wait() maxevents argument).

That assumes that epoll_wait() is supposed to return *all* ready fds.  But that 
is not possible because maxevents is finite.  If you want all events then 
obviously you may need to call epoll_wait() multiple times.

 I just used dup() to make it easier to test, but you'll probably get
 the same thing it your FDs were sockets connected to different
 endpoints.

This is the part I disagree with -- I think it makes all the difference.  
Please try making such a modification.

 while True:
 ready_writers = set(fd for fd, evt in
 ep.poll(-1, MAXEVENTS) if fd != r)
 if ready_writers.issubset(seen_writers):
 break
 seen_writers |= ready_writers

Of course it does, since the returned FDs are a subset of all the
ready file descriptors.

The point is precisely that, when there are more FDs ready than
maxevents, some FDs will never be reported.

The program can only terminate when the outer

while all_writers - seen_writers:
...

loop terminates.  So seen_writers == all_writers, and every fd has been 
reported.

--

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



[issue16320] Establish order in bytes/string dependencies

2013-01-06 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 8a6068ec220e by Serhiy Storchaka in branch 'default':
Issue #16320: Remove redundant Makefile dependencies for strings and bytes.
http://hg.python.org/cpython/rev/8a6068ec220e

--
nosy: +python-dev

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



[issue16320] Establish order in bytes/string dependencies

2013-01-06 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Fixed. Thank you for review, Meador.

--
resolution:  - fixed
stage: patch review - committed/rejected
status: open - closed

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



[issue16873] increase epoll.poll() maxevents default value, and improve documentation

2013-01-06 Thread Charles-François Natali

Charles-François Natali added the comment:

 That assumes that epoll_wait() is supposed to return *all* ready fds.  But 
 that is not possible because maxevents is finite.  If you want all events 
 then obviously you may need to call epoll_wait() multiple times.

Yes, but the problem is that between two epoll_wait() calls, the
readiness of the FDs can have changed: and if that happens, you'll get
the same list over and over.

 The program can only terminate when the outer

 while all_writers - seen_writers:
 ...

 loop terminates.  So seen_writers == all_writers, and every fd has been 
 reported.

Yes, but there are no event generated between calls to epoll_wait() in
your inner loop.
In a typical usage of select()/poll() epoll() will look like:

while True:
evts = poll()
for evt in evts:
do_something(fd)

and between two calls to poll(), you can get new events (new
connections, space in the socket buffer, etc). The pipe
filling/draining is used to generate new events. Your modification
doesn't take that into account.

 This is the part I disagree with -- I think it makes all the difference.  
 Please try making such a modification.

Will do.

--

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



[issue16499] CLI option for isolated mode

2013-01-06 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
nosy:  -serhiy.storchaka

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



[issue16873] increase epoll.poll() maxevents default value, and improve documentation

2013-01-06 Thread Richard Oudkerk

Richard Oudkerk added the comment:

Here is a version which uses epoll to service a number of pipes which is larger 
than maxevents.  (If NUM_WRITERS is too large then I get OSError: [Errno 24] 
Too many open files.)

All pipes get serviced and the output is:

Working with 20 FDs, 5 maxevents
[5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43]
[15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43]
[25, 27, 29, 31, 33, 35, 37, 39, 41, 43]
[35, 37, 39, 41, 43]

The lists show the (sorted) unseen writers at each loop.

--
Added file: http://bugs.python.org/file28594/test_epoll_2.py

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



[issue16873] increase epoll.poll() maxevents default value, and improve documentation

2013-01-06 Thread Richard Oudkerk

Richard Oudkerk added the comment:

 Yes, but the problem is that between two epoll_wait() calls, the
 readiness of the FDs can have changed: and if that happens, you'll get
 the same list over and over.

If an fd *was* ready but isn't anymore then why would you want to know about 
it?  Trying to use the fd will fail with EAGAIN.

--

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



[issue16873] increase epoll.poll() maxevents default value, and improve documentation

2013-01-06 Thread Charles-François Natali

Charles-François Natali added the comment:

Of course it does, the write ends all get filled, so the number of ready 
writers drops to zero... That's not all at the problem I'm talking about (I may 
not be clear though, a script will make it more clear).

--

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



[issue16877] Odd behavior of ~ in os.path.abspath and os.path.realpath

2013-01-06 Thread Ian Shields

Ian Shields added the comment:

David, Tilde expansion is different to globbing. Globbing in Python doesn't 
automatically do tilde expansion either.
 glob.glob(~)
[]

Looking at the documentation, I don't think it would be practical to add 
documentation to each affected function - there are too many. Apart from 
abspath and realpath (which started this conversation), there are join, isdir, 
isfile, isabs, and many others in os.path. posixpath and the other path 
handling modules.

Maybe a note at the top of the module documentation (e.g. 
http://docs.python.org/3/library/os.path.html) which has two notes already. 
Something along the line of:

Unlike many shells, Python does not automatically do tilde expansion or 
variable substitution in paths. Use expanduser for tilde expansion or 
expandvars for variable substitution.

Or just simply
Use expanduser for tilde expansion or expandvars for variable substitution in 
paths as the other path functions do not do this automatically.

--

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



[issue16799] start using argparse.Namespace in regrtest

2013-01-06 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

May be it would be better to split the patch to two parts -- the fix of usage() 
bug and the enhancement.

--
nosy: +serhiy.storchaka

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




[issue16877] Odd behavior of ~ in os.path.abspath and os.path.realpath

2013-01-06 Thread Georg Brandl

Georg Brandl added the comment:

Both are a kind of command-line expansion, see for example bash(1).

Listed there are brace expansion, tilde expansion, parameter and variable 
expansion, command substitution, arithmetic expansion, word splitting, and 
pathname expansion.  Python does none of them.

--

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



[issue14965] super() and property inheritance behavior

2013-01-06 Thread David Beazley

David Beazley added the comment:

Just as a note, there is a distinct possibility that a property in a 
superclass could be some other kind of descriptor object that's not a property. 
 To handle that case, the solution of

super(self.__class__, self.__class__).x.fset(self, value)

would actually have to be rewritten as

super(self.__class__, self.__class__).x.__set__(self, value)

That said, I agree it would be nice to have a simplified means of accomplishing 
this.

--
nosy: +dabeaz

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



[issue16799] start using argparse.Namespace in regrtest

2013-01-06 Thread Chris Jerdonek

Chris Jerdonek added the comment:

Sure, I'd be happy to do that.  I'll prepare the patch for the other issue.

--

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



[issue9242] unicodeobject.c: use of uninitialized values

2013-01-06 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

3.2 is affected too. The PEP-393 changes fixes this bug in 3.3+.

Here is a simple patch.

--
assignee:  - serhiy.storchaka
keywords: +patch
nosy: +serhiy.storchaka
stage:  - patch review
versions: +Python 3.2
Added file: http://bugs.python.org/file28595/issue9242.patch

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



[issue16795] Patch: some changes to AST to make it more useful for static language analysis

2013-01-06 Thread Sven Brauch

Sven Brauch added the comment:

Here's a new proposal, I adjusted the AST tests and fixed some small problems I 
encountered during that. It contains all the diffs for generated files, should 
I remove those for easier review?
A remaining problem is that AST_Tests::_assertTrueorder now fails, I think 
because the condition it checks simply is not met any more (by design of the 
change). What's the correct way to deal with that?

--
Added file: http://bugs.python.org/file28596/python2.diff

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



[issue10156] Initialization of globals in unicodeobject.c

2013-01-06 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Daniel's patch looks good for me. 2.7 looks affected too.

--
nosy: +serhiy.storchaka
stage: patch review - commit review
versions: +Python 2.7 -Python 3.3, Python 3.4

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



[issue16873] increase epoll.poll() maxevents default value, and improve documentation

2013-01-06 Thread Charles-François Natali

Charles-François Natali added the comment:

You're right, I just saw my mistake.
Sorry for the noise (the extra performance arguement is not a good enough 
motivation to tune this dynaically).

Closing.

--
resolution:  - invalid
stage: needs patch - committed/rejected
status: open - closed

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



[issue10156] Initialization of globals in unicodeobject.c

2013-01-06 Thread Stefan Krah

Stefan Krah added the comment:

unicode-leak.patch doesn't fix #16143 though. unicode_empty and
unicode_latin1 need to be initialized, too.

Actually we could close this in favor of #16143.

--

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



[issue16877] Odd behavior of ~ in os.path.abspath and os.path.realpath

2013-01-06 Thread R. David Murray

R. David Murray added the comment:

Here is a proposed doc patch.  While not a necessary doc addition, I do think 
it provides some useful guidance, and is short enough that it doesn't weigh 
down the docs.

--
keywords: +patch
Added file: http://bugs.python.org/file28597/doc_no_default_expand.patch

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



[issue16854] usage() is not defined in Lib/test/regrtest.py

2013-01-06 Thread Chris Jerdonek

Chris Jerdonek added the comment:

I'm submitting a patch for this independent of issue 16799 on Serhiy's request.

--
dependencies:  -start using argparse.Namespace in regrtest
keywords: +patch
Added file: http://bugs.python.org/file28598/issue-16854-1.diff

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



[issue16876] epoll: reuse epoll_event buffer instead of allocating a new one at each poll()

2013-01-06 Thread Charles-François Natali

Changes by Charles-François Natali neolo...@free.fr:


--
nosy: +sbt

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



[issue8745] zipimport is a bit slow

2013-01-06 Thread Catalin Iacob

Catalin Iacob added the comment:

Attached v4 of patch with error checking for getc and some more comments.

A real world example of the speedup is Calibre (http://calibre-ebook.com/) 
which on Windows comes with its own code, its dependecies and Python's stdlib 
all bundled in a 40MB zip. With the patch the time to create a zipimporter 
instance from that zip drops from around 60ms to around 15ms.

--
Added file: http://bugs.python.org/file28599/zipimport-speedup-v4.patch

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



[issue16876] epoll: reuse epoll_event buffer instead of allocating a new one at each poll()

2013-01-06 Thread Charles-François Natali

Changes by Charles-François Natali neolo...@free.fr:


Added file: http://bugs.python.org/file28600/epoll_realloc.diff

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



[issue16876] epoll: reuse epoll_event buffer instead of allocating a new one at each poll()

2013-01-06 Thread Charles-François Natali

Changes by Charles-François Natali neolo...@free.fr:


Removed file: http://bugs.python.org/file28589/epoll_realloc.diff

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



[issue16877] Odd behavior of ~ in os.path.abspath and os.path.realpath

2013-01-06 Thread Georg Brandl

Georg Brandl added the comment:

LGTM.

--

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



[issue16877] Odd behavior of ~ in os.path.abspath and os.path.realpath

2013-01-06 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 02e2fa22f8b7 by R David Murray in branch '3.2':
#16877: Add mention that shell-style path expansions are not automatic.
http://hg.python.org/cpython/rev/02e2fa22f8b7

New changeset 2ff547c165fd by R David Murray in branch '3.3':
merge #16877: Add mention that shell-style path expansions are not automatic.
http://hg.python.org/cpython/rev/2ff547c165fd

New changeset b6284d2aaada by R David Murray in branch 'default':
merge #16877: Add mention that shell-style path expansions are not automatic.
http://hg.python.org/cpython/rev/b6284d2aaada

New changeset 58ac62bc3cd5 by R David Murray in branch '2.7':
#16877: Add mention that shell-style path expansions are not automatic.
http://hg.python.org/cpython/rev/58ac62bc3cd5

--
nosy: +python-dev

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



[issue9685] tuples should remember their hash value

2013-01-06 Thread Raymond Hettinger

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


--
assignee: rhettinger - 

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



[issue16876] epoll: reuse epoll_event buffer instead of allocating a new one at each poll()

2013-01-06 Thread Charles-François Natali

Changes by Charles-François Natali neolo...@free.fr:


Removed file: http://bugs.python.org/file28600/epoll_realloc.diff

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



[issue16876] epoll: reuse epoll_event buffer instead of allocating a new one at each poll()

2013-01-06 Thread Charles-François Natali

Charles-François Natali added the comment:

Updated to reflect Richard's comment.

--
Added file: http://bugs.python.org/file28601/epoll_realloc.diff

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



[issue12939] Add new io.FileIO using the native Windows API

2013-01-06 Thread STINNER Victor

STINNER Victor added the comment:

I don't like the idea of a specific I/O module for an OS. Is the public API
different? Can't you reuse the io module?
Le 6 janv. 2013 14:59, Richard Oudkerk rep...@bugs.python.org a écrit :


 Richard Oudkerk added the comment:

 Attached is a patch which adds a winio module which is a replacement for
 io, but uses windows handles instead of fds.

 It reimplements FileIO and open(), and provides openhandle() and
 closehandle() as replacements for os.open() and os.close().

 test_io has been modified to exercise winio (in addition to _io and _pyio)
 and all the tests pass.

 Note that some of the implementation (openhandle(), open(),
 FileIO.__init__()) is still done in Python rather than C.

 --
 keywords: +patch
 Added file: http://bugs.python.org/file28590/winfileio.patch

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


--

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



[issue16853] add a Selector to the select module

2013-01-06 Thread Charles-François Natali

Charles-François Natali added the comment:

 If you don't want to change the API back to separate register_*() methods for 
 readers and writers, perhaps you can add a method that tells me, for a given 
 fileobj, whether it is registered, and with which poll flags 
 (SELECT_IN/OUT/both) and the user data.

 Also, I need a method that gives me the number of registered FDs.

Does that look OK?

def get_info(self, fileobj):
Return information about a registered file object.

Returns:
(events, data) associated to this file object

Raises KeyError if the file object is not registered.


def registered_count(self):
Return the number of registered file objects.

Returns:
number of currently registered file objects


--
Added file: http://bugs.python.org/file28602/selector-6.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16853
___diff --git a/Lib/select.py b/Lib/select.py
new file mode 100644
--- /dev/null
+++ b/Lib/select.py
@@ -0,0 +1,309 @@
+Select module.
+
+This module supports asynchronous I/O on multiple file descriptors.
+
+
+
+from _select import *
+
+
+# generic events, that must be mapped to implementation-specific ones
+# read event
+SELECT_IN  = (1  0)
+# write event
+SELECT_OUT = (1  1)
+
+
+def _fileobj_to_fd(fileobj):
+Return a file descriptor from a file object.
+
+Parameters:
+fileobj -- file descriptor, or any object with a `fileno()` method
+
+Returns:
+corresponding file descriptor
+
+if isinstance(fileobj, int):
+fd = fileobj
+else:
+try:
+fd = int(fileobj.fileno())
+except (ValueError, TypeError):
+raise ValueError(Invalid file object: {!r}.format(fileobj))
+return fd
+
+
+class _Key:
+Object used internally to associate a file object to its backing file
+descriptor, selected event mask and attached data.
+
+def __init__(self, fileobj, events, data=None):
+self.fileobj = fileobj
+self.fd = _fileobj_to_fd(fileobj)
+self.events = events
+self.data = data
+
+
+class _BaseSelector:
+Base selector class.
+
+A selector supports registering file objects to be monitored for specific
+I/O events.
+
+A file object is a file descriptor or any object with a `fileno()` method.
+An arbitrary object can be attached to the file object, which can be used
+for example to store context information, a callback, etc.
+
+A selector can use various implementations (select(), poll(), epoll()...)
+depending on the platform. The default `Selector` class uses the most
+performant implementation on the current platform.
+
+
+def __init__(self):
+# this maps file descriptors to keys
+self._fd_to_key = {}
+# this maps file objects to keys - for fast (un)registering
+self._fileobj_to_key = {}
+
+def register(self, fileobj, events, data=None):
+Register a file object.
+
+Parameters:
+fileobj -- file object
+events  -- events to monitor (bitwise mask of SELECT_IN|SELECT_OUT)
+data-- attached data
+
+if (not events) or (events  ~(SELECT_IN|SELECT_OUT)):
+raise ValueError(Invalid events: {}.format(events))
+
+if fileobj in self._fileobj_to_key:
+raise ValueError({!r} is already registered.format(fileobj))
+
+key = _Key(fileobj, events, data)
+self._fd_to_key[key.fd] = key
+self._fileobj_to_key[fileobj] = key
+return key
+
+def unregister(self, fileobj):
+Unregister a file object.
+
+Parameters:
+fileobj -- file object
+
+try:
+key = self._fileobj_to_key[fileobj]
+del self._fd_to_key[key.fd]
+del self._fileobj_to_key[fileobj]
+except KeyError:
+raise ValueError({!r} is not registered.format(fileobj))
+return key
+
+def modify(self, fileobj, events, data=None):
+Change a registered file object monitored events or attached data.
+
+Parameters:
+fileobj -- file object
+events  -- events to monitor (bitwise mask of SELECT_IN|SELECT_OUT)
+data-- attached data
+
+self.unregister(fileobj)
+self.register(fileobj, events, data)
+
+def select(self, timeout=None):
+Perform the actual selection, until some monitored file objects are
+ready or a timeout expires.
+
+Parameters:
+timeout -- if timeout  0, this specifies the maximum wait time, in
+   seconds
+   if timeout == 0, the select() call won't block, and will
+   report the currently ready file objects
+   if timeout is None, select() will block until a monitored
+   file 

[issue12939] Add new io.FileIO using the native Windows API

2013-01-06 Thread Richard Oudkerk

Richard Oudkerk added the comment:

 I don't like the idea of a specific I/O module for an OS. Is the public API
 different?

It was partly to make integration with the existing tests easier: _io, _pyio 
and winio are tested in parallel.

 Can't you reuse the io module?

In what sense?

I don't really know how the API should be exposed.

--

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



[issue16868] Python Developer Guide: Include a reminder to ping bug report if not reviewed in timely manner

2013-01-06 Thread Todd Rovito

Todd Rovito added the comment:

I agree with Meador it should be a specific amount of time.  As a beginner at 
contributing to Python I thought substantial amount of time meant one month 
but it depends on interpretation.  I think making it very specific makes the 
documentation more clear.  Included in the new patch are the other suggestions 
made by Mr. Jerdonek.  Thanks for the feedback!

--
Added file: 
http://bugs.python.org/file28603/16868PythonDeveloperGuidePingIssueBeforeEmailingPython-devV2.patch

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



[issue10156] Initialization of globals in unicodeobject.c

2013-01-06 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

 unicode-leak.patch doesn't fix #16143 though. unicode_empty and
 unicode_latin1 need to be initialized, too.

Indeed. I'll upload patches tomorrow.

--

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



[issue9685] tuples should remember their hash value

2013-01-06 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

My apologies once again, Raymond. I mistakenly thought that I unassigned the 
issue from you (it was a Roundup bug at this day).

As for the issue, I totally agree with Tim.

--

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



[issue16854] usage() is not defined in Lib/test/regrtest.py

2013-01-06 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
stage: needs patch - patch review

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



[issue16878] argparse: positional args with nargs='*' defaults to []

2013-01-06 Thread Chris Jerdonek

Chris Jerdonek added the comment:

I agree it would be very likely to break working code.  Can you elaborate on 
your point about 'append' though?  I'm not sure I see it.

Aside from consistency, I'm wondering if there is ever a case where it would 
help to return None for positional arguments.  For example, unlike with 
optional arguments, it doesn't seem like it would ever make sense to 
distinguish between the option being present and the option being present with 
no values (which is why const is needed in the optional case).  In other words, 
there is no loss of information by returning [].

--

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



[issue16878] argparse: positional args with nargs='*' defaults to []

2013-01-06 Thread R. David Murray

R. David Murray added the comment:

 p.add_argument('-a', action=append, default=None)
 p.parse_args([])
Namespace(a=None)
 p.parse_args(['-a', '1', '-a', '2'])
Namespace(a=['1', '2'])

So there's a logical correspondence there (repeated option vs multiple values, 
each producing a list).

I'm not sure what you mean by the difference between options and positionals.  
I note that you can use nargs with an optional, and in that case the default 
works, which is even more unfortunate than the difference with 'append'.  But 
if you can articulate a logical difference between optionals and positional 
here, maybe we can make it look reasonable :)

--

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



[issue16877] Odd behavior of ~ in os.path.abspath and os.path.realpath

2013-01-06 Thread Ian Shields

Ian Shields added the comment:

I think that's an excellent resolution to the problem. Thank you.

--

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



[issue16878] argparse: positional args with nargs='*' defaults to []

2013-01-06 Thread Chris Jerdonek

Chris Jerdonek added the comment:

I was referring to the fact that optionals have an additional case that 
positionals don't have: Note that for optional arguments, there is an 
additional case -- the option string is present but not followed by a 
command-line argument.

(from http://docs.python.org/dev/library/argparse.html#nargs )

 p.add_argument('--foo', nargs='*', default=None)
 p.parse_args([])
Namespace(foo=None)
 p.parse_args(['--foo'])
Namespace(foo=[])

So it could be argued that positionals (at least by default) are behaving like 
the second case.  But that's as far as the parallel goes apparently.  *default* 
affects the first case and not the second case for optional arguments:

 p.add_argument('--foo', nargs='*', default=False)
 p.parse_args([])
Namespace(foo=False)
 p.parse_args(['--foo'])
Namespace(foo=[])

--

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



[issue16853] add a Selector to the select module

2013-01-06 Thread Guido van Rossum

Guido van Rossum added the comment:

This seems okay.  I am attaching the changes I had to make to Tulip to support 
this.  However, two Tulip tests are now failing:

- tulip.events_test.PollEventLoopTests.testCreateSslTransport fails with 
spurious file descriptors returned by poll() that aren't in the _fd_to_key dict 
(but the corresponding test with Select passes)

- test_sock_client_fail() hangs completely.

Can you see why?

The first failure has this traceback:

Traceback (most recent call last):
  File /Users/guido/tulip/tulip/selectors.py, line 178, in _key_from_fd
return self._fd_to_key[fd]
KeyError: 0

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File /Users/guido/tulip/tulip/events_test.py, line 216, in testCreateSslTra\
nsport
el.run()
  File /Users/guido/tulip/tulip/unix_events.py, line 120, in run
self._run_once()
  File /Users/guido/tulip/tulip/unix_events.py, line 592, in _run_once
event_list = self._selector.select(timeout)
  File /Users/guido/tulip/tulip/selectors.py, line 255, in select
key = self._key_from_fd(fd)
  File /Users/guido/tulip/tulip/selectors.py, line 180, in _key_from_fd
raise RuntimeError(No key found for fd {}.format(fd))
RuntimeError: No key found for fd 0

(But the fd value varies -- sometimes it is -2, sometimes a large number.)

The other test busy-loops (keeps polling) and I have no useful traceback.

Also notice the need for a third constant, SELECT_CONNECT.  For details see the 
class WindowsPollPollster in the Tulip code.

--
hgrepos: +167
Added file: http://bugs.python.org/file28604/tulip-selectors-1.diff

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



[issue16853] add a Selector to the select module

2013-01-06 Thread Guido van Rossum

Guido van Rossum added the comment:

Maybe I should explain the need for SELECT_CONNECT more.  This is necessary so 
that on Windows the PollSelector can use WSAPoll().  The reason is that for 
async connect() calls, WSAPoll() doesn't return the FD as writable, just as 
having an exception.  I didn't write the code (Richard Oudkerk did), and I've 
never run it (no access to Windows), but the workaround for the problem with 
WSAPoll() is apparently quite complex:
http://code.google.com/p/tulip/source/browse/tulip/unix_events.py#236

The long and short of it is that portable code must use add_connector() and 
remove_connector() instead of add_writer() and remove_writer() for async 
connect() calls.  So these need to be mapped to something different in the 
selector world.  The right thing would seem to add a separate flag, 
SELECT_CONNECT, with a value distinct from SELECT_IN and SELECT_OUT.  But I 
didn't write the code for that -- I made a hackish change so that the selector 
code exports SELECT_CONNECT as an alias for SELECT_OUT.  I did write code for 
add_connector() and remove_connector() but these may have to be modified 
slightly again later once the selector code has SELECT_OUT != SELECT_CONNECT.

Please do try to understand this -- it would not be possible to support 
WSAPoll() at all without distinguishing between write and connect readyness.

Feel free to ping Richard Oudkerk (shibturn at gmail.com) for more information.

I don't *think* the problems are in my code, since both tests pass when the 
SelectSelector is used.

I can currently only test on OSX 10.7 (Mountain Lion); hopefully I have more 
platforms after tomorrow (my first day at the new job).

--

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



[issue16853] add a Selector to the select module

2013-01-06 Thread Guido van Rossum

Guido van Rossum added the comment:

(Adding Richard Oudkerk to the nosy list as I am pleading here for support of 
WSAPoll(), see last few messages.)

--
nosy: +sbt

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



[issue16076] xml.etree.ElementTree.Element and xml.etree.ElementTree.TreeBuilder are no longer pickleable

2013-01-06 Thread Daniel Shahaf

Daniel Shahaf added the comment:

Eli Bendersky wrote on Thu, Jan 03, 2013 at 14:44:02 +:
 If this change is required (even if we choose to name it
 xml.etree.ElementTree.Element for Py compatibility to fix the pickling
 regression, we may find ourselves in a need to change it between 3.3 and
 3.3.1 and I'm not sure if that's valid. I hope my question on pydev will be
 resolved conclusively.
 
 Danial, could you investigate if such a change is absolutely required to
 make pickling/unickling of Element work?

There are a few options:

- Change c-Element's tp_name to xml.etree.ElementTree.Element.

- Register a reduce function for c-Element's that serialises them by
  constructing an equivalent py-Element and returning the latter's
  .__dict__ via the third return value:
  http://docs.python.org/3/library/copyreg#copyreg.pickle

- Add an entry mapping builtins.Element to
  xml.etree.ElementTree.Element to _compat_pickle.IMPORT_MAPPING
  (which is used by Lib/pickle.py:_Pickler.find_class()).

I haven't tried to implement either of these approaches.

--

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



[issue16076] xml.etree.ElementTree.Element and xml.etree.ElementTree.TreeBuilder are no longer pickleable

2013-01-06 Thread Eli Bendersky

Eli Bendersky added the comment:

I think that changing the _elementtree's Element's name to match the Python 
version, and then making sure the same serialized object is returned - is a 
worthy option to try.

Then it will hopefully just work. When pickle deserializes a user-defined 
object that says it's a xml.etree.ElementTree.Element, it will try to import 
Element from xml.etree.ElementTree and should get the accelerated class. On 
machines without acceleration it will get the Python class.

--

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



[issue16868] Python Developer Guide: Include a reminder to ping bug report if not reviewed in timely manner

2013-01-06 Thread Ezio Melotti

Ezio Melotti added the comment:

A month sounds good to me.

--

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



[issue13899] re pattern r[\A] should work like A but matches nothing. Ditto B and Z.

2013-01-06 Thread Ezio Melotti

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


--
stage:  - needs patch
versions: +Python 3.3, Python 3.4

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



[issue16154] Some minor doc fixes in Doc/library

2013-01-06 Thread Ezio Melotti

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


--
nosy: +ezio.melotti
stage:  - patch review

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



[issue16882] Python 2.7 has 73 files with hard references to /usr/local when building on *NIX

2013-01-06 Thread Isaac (.ike) Levy

New submission from Isaac (.ike) Levy:

There are currently 73 files with hard-coded references to /usr/local,

To see what I'm talking about, unpack a source Python tarball, and check it out 
like so:

# cd Python-2.7.3
# grep -Rl '\/usr\/local' ./* | wc -l
73

To read more detail,
# grep -R '\/usr\/local' ./*


Some of these hardcoded /usr/local lines are innocuous or merely misleading,

./README:1) CONFIG_SHELL=/usr/local/bin/bash CC=cc RANLIB=: \
- or -
./Demo/tkinter/guido/ManPage.py:MANDIR = '/usr/local/man/mann'

Yet, some of these create unexpected installation behavior when configuring 
using the --prefix flag to specify an alternative install location, 

./setup.py:# Ensure that /usr/local is always used
- or-
./setup.py:db_inc_paths.append('/usr/local/BerkeleyDB.4.%d/include' 
% x)

(Are items installed outside of your --prefix?  Which ones?  What about 
dependencies compiled outside of /usr/local?)


###
A terrible solution

It seems most UNIX package managers elect some form of finding and replace all 
occurances,  for example,

# dirty deeds, done dirt cheap
for i in `grep -Rl '\/usr\/local' ./*` ; do
   safe sed -i 's#\/usr\/local#\/usr\/mypath#g' $i
done

./configure --prefix=/usr/mypath
...continue the make dance...


#
A better solution

Prioritize some re-factoring work Python 2.7.3 installation, just enough to get 
sysadmins like myself by until Python3000 is commonplace...

I'd be happy to help, but as a community outsider, I'm not sure how to make the 
cleanup work stick.

--
components: Installation
messages: 179246
nosy: ikeaxial
priority: normal
severity: normal
status: open
title: Python 2.7 has 73 files with hard references to /usr/local when building 
on *NIX
type: compile error
versions: Python 2.7

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



[issue16883] --enable-shared during configure forces 2.7.3 to build as 2.7.2+ on Ubuntu 11.10

2013-01-06 Thread Isaac (.ike) Levy

New submission from Isaac (.ike) Levy:

Host OS: Ubuntu 11.10 (oneiric)
--enable-shared flag during configure forces 2.7.3 to build as 2.7.2+

TO REPLICATE:

unpack Python tarball,

# cd Python-2.7.3/
# ./configure --enable-shared
# make
# ./python -V
2.7.2+

# make clean ; ./configure --enable-shared ; make ; ./python -V
2.7.3


--
Additionally, 2.7.2+ build seems to carry over a resolved urandom issue,

# (post-install on Ubuntu 11.10)
# /usr/local/bin/python
Python 2.7.2+ (default, Oct  4 2011, 20:41:12)
[GCC 4.6.1] on linux2
Type help, copyright, credits or license for more information.
 from os import urandom
Traceback (most recent call last):
  File stdin, line 1, in module
ImportError: cannot import name urandom


--
components: Installation
messages: 179247
nosy: ikeaxial
priority: normal
severity: normal
status: open
title: --enable-shared during configure forces 2.7.3 to build as 2.7.2+ 
on Ubuntu 11.10
type: compile error
versions: Python 2.7

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