[issue9607] Test file 'test_keyword.py' submission for use with keyword.py

2010-08-14 Thread Greg Malcolm

New submission from Greg Malcolm :

'keyword.py' didn't have any tests, so I wrote some.

Most of the tests are are for the main() method, which self-populates the 
keywords section of keyword.py with keywords taken from a grammar file, 
'Python/graminit.c'. The main() method allows you to choose the grammar file 
and the target file, so I've written the tests such that the actual keyword.py 
does not have to modify itself.

Most of the tests generate dummy keyword.py and graminit.c files for parsing. 
They are all deleted in the tearUp() stages of each test.

I've timed the tests. In total they take approximately 3 seconds so you may 
want to tag some of them as "slow". Also I've only tested on the mac, so 
someone may want to check it runs ok on Windows.

Most of the patch was written at the PyOhio 2010 Sprints. Thanks go to David 
Murray for advice given while working on it.

--
components: Tests
files: test_keyword.patch
keywords: patch
messages: 113942
nosy: gregmalcolm, r.david.murray
priority: normal
severity: normal
status: open
title: Test file 'test_keyword.py' submission for use with keyword.py
type: behavior
versions: Python 3.2
Added file: http://bugs.python.org/file18537/test_keyword.patch

___
Python tracker 

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



[issue8844] Condition.wait() doesn't raise KeyboardInterrupt

2010-08-14 Thread Reid Kleckner

Reid Kleckner  added the comment:

Added a patch that adds support for recomputing the timeout, plus a test for it.

Can this still make it into 3.2, or is it too disruptive at this point in the 
release process?

--
Added file: http://bugs.python.org/file18536/lock-interrupt-v4.diff

___
Python tracker 

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



[issue9168] setuid in smtp.py sheds privileges before binding port

2010-08-14 Thread Alberto Trevino

Alberto Trevino  added the comment:

I haven't heard anything on this problem or my patch.  What's the status?

--

___
Python tracker 

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



[issue8739] Update to smtpd.py to RFC 5321

2010-08-14 Thread Alberto Trevino

Alberto Trevino  added the comment:

Any more work I need to do on this patch?

--

___
Python tracker 

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



[issue9545] Adding _collections to static build

2010-08-14 Thread Senthil Kumaran

Senthil Kumaran  added the comment:

The reverted patch was reapplied in r83980 by Antoine.
The issue9546 resolves the part of always running the cleanup code on compile 
error.

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

___
Python tracker 

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



[issue9520] Add Patricia Trie high performance container

2010-08-14 Thread Dmitry Chichkov

Dmitry Chichkov  added the comment:

Yes, it looks like you are right. And while there is some slight performance 
degradation, at least nothing drastic is happening up to 30M keys. Using your 
modified test:

1000 words ( 961 keys), 3609555 words/s, 19239926 lookups/s, 51 
bytes/key (0.0MB)
   1 words (9042 keys), 3390980 words/s, 18180771 lookups/s, 87 
bytes/key (0.0MB)
  10 words (   83168 keys), 3298809 words/s, 12509481 lookups/s, 37 
bytes/key (3.0MB)
 100 words (  755372 keys), 2477793 words/s, 7537963 lookups/s, 66 
bytes/key (48.0MB)
 500 words ( 3501140 keys), 2291004 words/s, 6487727 lookups/s, 57 
bytes/key (192.0MB)
1000 words ( 6764089 keys), 2238081 words/s, 6216454 lookups/s, 59 
bytes/key (384.0MB)
2000 words (13061821 keys), 2175688 words/s, 5817085 lookups/s, 61 
bytes/key (768.0MB)
5000 words (31188460 keys), 2117751 words/s, 5137209 lookups/s, 51 
bytes/key (1536.0MB)

It looks like internal memory estimates (sys.getsizeof()) are also pretty good:

Before: ['VmPeak:\t10199764 kB', 'VmSize:\t 5552416 kB']
5000 words (31188460 keys), 2117751 words/s, 5137209 lookups/s, 51 
bytes/key (1536.0MB)
After: ['VmPeak:\t10199764 kB', 'VmSize:\t 7125284 kB']
 
7 125 284 kB - 5 552 416 kB = 1 536.00391 MB

--

___
Python tracker 

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



[issue9548] locale can be imported at startup but relies on too many library modules

2010-08-14 Thread Éric Araujo

Changes by Éric Araujo :


--
nosy: +eric.araujo

___
Python tracker 

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



[issue9548] locale can be imported at startup but relies on too many library modules

2010-08-14 Thread Marc-Andre Lemburg

Marc-Andre Lemburg  added the comment:

Nick Coghlan wrote:
> 
> Nick Coghlan  added the comment:
> 
> As we move more and more infrastructure into Python code, we're going to see 
> this pattern (i.e. a bootstrap module underlying the real module) more and 
> more often (e.g. I seem to recall Brett has to do something similar when 
> playing with the pure Python __import__ implementation).
> 
> I don't have an issue with it - it's a solid, standard solution to a 
> recurring problem with otherwise circular dependencies.
> 
> The only changes I would suggest to Antoine's patch are to explicitly scope 
> "interpreter startup" in the _bootlocale docstring (to make it clear that 
> sitecustomize.py should use the ordinary locale module) and to mention the 
> nature of _bootlocale in a comment just before the "from _bootlocale import 
> *" line in locale.py.

I don't object to such strategies in general, but in this case,
a change of this size is neither required nor helpful, so remain
a firm -1 on the patch.

The locale module already uses a C helper module. By now adding
another indirection via a boot-time only Python extract, you complicate
the setup - and what's worse: it doesn't solve the problem, since some
other module you import at boot time may still import locale directly
and for the same reason the collection module got used in locale:
programmers being unaware of the implications this has.

--

___
Python tracker 

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



[issue9145] test_coercion fails in refleak runs

2010-08-14 Thread Florent Xicluna

Florent Xicluna  added the comment:

This one is a (small) regression from 2.6.5.

Patch attached

--
keywords: +patch
nosy: +barry
priority: normal -> release blocker
status: closed -> open
versions: +Python 2.6 -Python 2.7
Added file: http://bugs.python.org/file18535/issue9145_for_2.6.diff

___
Python tracker 

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



[issue1710703] zipfile.ZipFile behavior inconsistent.

2010-08-14 Thread Alan McIntyre

Alan McIntyre  added the comment:

Apparenty _EndRecData64 needed the same kind of check that _EndRecData has when 
trying to seek to the end-of-archive record.  So I added that, and everything 
seems to work correctly now.  All tests pass on my 64-bit Linux box (including 
test_zipfile64).

The updated patch against py3k/trunk is attached as zipfile_empty2.diff.

--
Added file: http://bugs.python.org/file18534/zipfile_empty2.diff

___
Python tracker 

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



[issue5996] abstract class instantiable when subclassing dict

2010-08-14 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy: +benjamin.peterson

___
Python tracker 

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



[issue8866] socket.getaddrinfo() should support keyword arguments

2010-08-14 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

-.. function:: getaddrinfo(host, port, family=0, socktype=0, proto=0, flags=0)
+.. function:: getaddrinfo(host, port[, family[, type[, proto[, flags)

You should keep using the new documentation convention, that is:

.. function:: getaddrinfo(host, port, family=0, type=0, proto=0, flags=0)

--

___
Python tracker 

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



[issue9603] os.ttyname() and os.ctermid() don't decode result according to PEP 383

2010-08-14 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy: +haypo

___
Python tracker 

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



[issue9604] os.initgroups() doesn't accept PEP 383 usernames returned by pwd module

2010-08-14 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy: +haypo

___
Python tracker 

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



[issue9605] os.getlogin() should use PEP 383 decoding to match the pwd module

2010-08-14 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy: +haypo

___
Python tracker 

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



[issue1739648] zipfile.testzip() using progressive file reads

2010-08-14 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy: +pitrou

___
Python tracker 

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



[issue9606] logging filter is not applied to messages from descendant loggers

2010-08-14 Thread Nikolaus Rath

Changes by Nikolaus Rath :


--
title: logging filter is ignored when added to root handler -> logging filter 
is not applied to messages from descendant loggers

___
Python tracker 

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



[issue9606] logging filter is ignored when added to root handler

2010-08-14 Thread Nikolaus Rath

New submission from Nikolaus Rath :

I believe the following should print only one log message, not two:

import logging
class Filter(object):
def filter(self, record):
return record.name == 'foo'  
logger = logging.getLogger()
formatter = logging.Formatter('%(message)s') 
handler = logging.StreamHandler()
handler.setFormatter(formatter)
logger.addFilter(Filter())
logger.addHandler(handler)
logging.getLogger('foo').warn('foo!')
logging.getLogger('bar').warn('bar!')

If the filter is added to the handler instead of the logger, everything works 
as expected.

If this is desired behaviour, please consider this a bug against the 
documentation. In that case I propose to extend the documentation of 
Logger.addFilter() as follows: "Note that the filter will act only on log 
messages that are generated by this logger, and not on messages that have been 
generated by descendant loggers."

--
components: Library (Lib)
messages: 113932
nosy: Nikratio
priority: normal
severity: normal
status: open
title: logging filter is ignored when added to root handler
type: behavior
versions: Python 2.6

___
Python tracker 

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



[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2010-08-14 Thread Alex Willmer

Alex Willmer  added the comment:

On 14 August 2010 21:24, Matthew Barnett  wrote:
> Over to you, Alex. :-)

Et voilà, an exciting Saturday evening
http://pypi.python.org/pypi/regex/0.1.20100814

Matthew, I'm currently keeping regex in a private bzr repository. Do
you have yours in source control? If so/not could we make yours/mine
public, and keep everything in one repository?
-- 
Alex Willmer 

--

___
Python tracker 

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



[issue1739648] zipfile.testzip() using progressive file reads

2010-08-14 Thread Alan McIntyre

Alan McIntyre  added the comment:

Here's an updated patch against the py3k trunk (testzip-patch3.diff) that 
passes all tests (including test_zipfile64) on Linux on a 64-bit machine.

I can backport this to 2.x, but I'll wait until somebody indicates a need for 
it before I spend any time on it.

--
Added file: http://bugs.python.org/file18533/testzip-patch3.diff

___
Python tracker 

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



[issue588756] Put *.py{,c} in /usr/share for FHS compliance

2010-08-14 Thread Éric Araujo

Éric Araujo  added the comment:

doko has closed the downstream bug on Thu, 19 Nov 2009, with the reason that 
.py{,c} are not data files in the FHS sense. (Note that even Lisp where code is 
data (and the reverse) is installed both under /usr/lib and /usr/share on 
Debian, so I don’t really know what to think.)

About the more general FHS problem, Tarek (the distutils and distutils2 
maintainer) has a draft PEP about fine-grained control over every installation 
directory, so FHS layout for Python projects will be easily possible in the 
future. See http://bitbucket.org/tarek/distutils2/src/tip/docs/design/wiki.rst 
(product of Pycon 2010, done with OS packaging experts, doko and other people). 
As for Python itself, we’ll see if there are other bugs about FHS compliance, 
but it seems good right now.

--
resolution:  -> invalid
stage:  -> committed/rejected
title: python should obey the FHS -> Put *.py{,c} in /usr/share for FHS 
compliance

___
Python tracker 

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



[issue7255] "Default" word boundaries for Unicode data?

2010-08-14 Thread Matthew Barnett

Matthew Barnett  added the comment:

These have been added to the new 'regex' module. See issue #2636 or PyPI at:

http://pypi.python.org/pypi/regex

--
nosy: +mrabarnett

___
Python tracker 

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



[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2010-08-14 Thread Matthew Barnett

Matthew Barnett  added the comment:

issue2636-20100814.zip is a new version of the regex module.

I've added default Unicode word boundaries and renamed the Pattern and Match 
classes.

Over to you, Alex. :-)

--
Added file: http://bugs.python.org/file18532/issue2636-20100814.zip

___
Python tracker 
<http://bugs.python.org/issue2636>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3132] implement PEP 3118 struct changes

2010-08-14 Thread Meador Inge

Changes by Meador Inge :


--
assignee: teoliphant -> meador.inge
priority: critical -> high
stage: unit test needed -> needs patch

___
Python tracker 

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



[issue7902] relative import broken

2010-08-14 Thread Martin v . Löwis

Changes by Martin v. Löwis :


--
priority: normal -> release blocker
status: closed -> open

___
Python tracker 

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



[issue7902] relative import broken

2010-08-14 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

Backporting this change to 2.6 has created an incompatibility in that branch, 
see for example issue9600. Apparently, it will only break code that is 
"conceptually wrong", but still "worked" on 2.6.

I'll suggest that this is a release-critical issue for 2.6.6. It should be 
considered whether the incompatibility is accepted, or fixed, or reverted.

--
nosy: +loewis

___
Python tracker 

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



[issue9600] multiprocessing Pool instantiation crashes on 64 bit 2.6.6rc1 under Windows 7

2010-08-14 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

Notice that this is also a duplicate of #9144, which was fixed for 2.7, but 
nobody bothered to move the fix to the other branches. This goes all back to 
#7902, which has now introduced an incompatible change into 2.6 (otherwise, 
changing multiprocessing shouldn't have been necessary, despite that having 
been wrong all the time). I'll reopen that as release-critical for review.

--
nosy: +loewis

___
Python tracker 

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



[issue9579] In 3.x, os.confstr() returns garbage if value is longer than 255 bytes

2010-08-14 Thread David Watson

David Watson  added the comment:

> I just fear that the loop is "endless". Imagine the worst case: confstr() 
> returns a counter (n, n+1, n+2, ...). In 64 bits, it can be long.

The returned length is supposed to be determined by the length of
the variable, not the length of the buffer passed by the caller,
so I don't see why the OS would have a bug like that, and it
would probably be exposed by the test suite anyway (there's
currently a simple test using CS_PATH).

> I would prefer to see a condition to stop after 2 steps. It should maybe stop 
> when an error at the 3rd step.

That is, raise an exception?  Yeah, possibly, but I think it's
better to just believe what the OS tells you rather than have an
exception that's only raised once in a blue moon for something
that may just be a low-probability event, and not an error.

--

___
Python tracker 

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



[issue9580] os.confstr() doesn't decode result according to PEP 383

2010-08-14 Thread David Watson

David Watson  added the comment:

> CS_PATH is hardcoded to "/bin:/usr/bin" in the GNU libc for UNIX. Do you know 
> another key for which the value can be controled by the user (or the system 
> administrator)?

No, not a specific example, but CS_PATH could conceivably refer
to some POSIX compatibility suite that's been installed in a
non-ASCII location, and implementations can add their own
variables for whatever they want.

> CS_PATH is just an example, there are other keys. I'm not sure that all 
> values 
> are encoded to the filesystem encodings, it might be another encoding?
> 
> Well, if we really doesn't know the encoding, a solution is to use a bytes 
> API 
> (which may avoid the question of the usage of the PEP 383).

The other variables defined by POSIX refer to environment
variables and command-line options for the C compiler and the
getconf utility, all of which would use the FS encoding in
Python, but I agree there's no way to know the appropriate
encoding in general, or even whether anything cares about
encodings.

Personally, I have no objections to making it return bytes.

--

___
Python tracker 

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



[issue9605] os.getlogin() should use PEP 383 decoding to match the pwd module

2010-08-14 Thread David Watson

New submission from David Watson :

The pwd module decodes usernames with PyUnicode_DecodeFSDefault(), and the 
LOGNAME environment variable (suggested as an alternative to getlogin()) is 
decoded the same way.  Attaching a patch to use PyUnicode_DecodeFSDefault() in 
getlogin().

--
components: Extension Modules
files: getlogin-pep383.diff
keywords: patch
messages: 113922
nosy: baikie
priority: normal
severity: normal
status: open
title: os.getlogin() should use PEP 383 decoding to match the pwd module
type: behavior
versions: Python 3.1, Python 3.2
Added file: http://bugs.python.org/file18531/getlogin-pep383.diff

___
Python tracker 

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



[issue9604] os.initgroups() doesn't accept PEP 383 usernames returned by pwd module

2010-08-14 Thread David Watson

New submission from David Watson :

The pwd module decodes usernames using PyUnicode_DecodeFSDefault(), so 
initgroups() should use PyUnicode_FSConverter() for the username.  Patch 
attached.

--
components: Extension Modules
files: initgroups-pep383.diff
keywords: patch
messages: 113921
nosy: baikie
priority: normal
severity: normal
status: open
title: os.initgroups() doesn't accept PEP 383 usernames returned by pwd module
type: behavior
versions: Python 3.2
Added file: http://bugs.python.org/file18530/initgroups-pep383.diff

___
Python tracker 

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



[issue9603] os.ttyname() and os.ctermid() don't decode result according to PEP 383

2010-08-14 Thread David Watson

New submission from David Watson :

These functions each return the path to a terminal, so they should use 
PyUnicode_DecodeFSDefault().  Patch attached.

--
components: Extension Modules
files: ttyname-ctermid-pep383.diff
keywords: patch
messages: 113920
nosy: baikie
priority: normal
severity: normal
status: open
title: os.ttyname() and os.ctermid() don't decode result according to PEP 383
type: behavior
versions: Python 3.1, Python 3.2
Added file: http://bugs.python.org/file18529/ttyname-ctermid-pep383.diff

___
Python tracker 

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



[issue8866] socket.getaddrinfo() should support keyword arguments

2010-08-14 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


Removed file: http://bugs.python.org/file17524/kwargs.patch

___
Python tracker 

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



[issue8866] socket.getaddrinfo() should support keyword arguments

2010-08-14 Thread Giampaolo Rodola'

Giampaolo Rodola'  added the comment:

Updated patch in attachment includes tests and doc update.

I decided to rename "socktype" argument in "type", since that's the name 
adopted all across the socket module API:

socket.socket([family[, type[, proto]]])
socket.socket.type
socket.socketpair([family[, type[, proto]]])
socket.fromfd(fd, family, type[, proto])

This is safe and doesn't introduce any incompatibility.

--
Added file: http://bugs.python.org/file18528/getaddrinfo.patch

___
Python tracker 

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



[issue757815] Infinite floats don't work in compiled modules on windows

2010-08-14 Thread Mark Dickinson

Mark Dickinson  added the comment:

Reclassifying as out of date.  Infinity and NaN handling in Python 2.7 and 
later is consistent across platforms;  those versions of Python contain their 
own code for reading and writing floats, instead of depending on the system 
libraries.

--
resolution: postponed -> out of date

___
Python tracker 

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



[issue737648] Error on handling nan

2010-08-14 Thread Mark Dickinson

Mark Dickinson  added the comment:

(and math.isnan is the recommended way to test for a nan).

--

___
Python tracker 

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



[issue737648] Error on handling nan

2010-08-14 Thread Mark Dickinson

Mark Dickinson  added the comment:

Reclassifying as out of date.  NaN handling in Python 2.6 and later is 
non-accidental.

--
resolution: later -> out of date

___
Python tracker 

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



[issue9425] Rewrite import machinery to work with unicode paths

2010-08-14 Thread STINNER Victor

STINNER Victor  added the comment:

zipimport_read_directory.patch: patch for read_directory() function of the 
zipimport module to support unencodable filenames. This patch requires #9599 
(PySys_FormatStderr). The patch changes the encoding of the name: decode name 
byte string using the file system encoding (and the PEP 383 on POSIX) instead 
of the utf-8 in strict mode.

--
Added file: http://bugs.python.org/file18527/zipimport_read_directory.patch

___
Python tracker 

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



[issue9600] multiprocessing Pool instantiation crashes on 64 bit 2.6.6rc1 under Windows 7

2010-08-14 Thread Brian Curtin

Brian Curtin  added the comment:

Committed in r84031.

Thanks for reporting this, cipater.

--
assignee:  -> brian.curtin
resolution: accepted -> fixed
stage: needs patch -> committed/rejected
status: open -> closed

___
Python tracker 

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



[issue9425] Rewrite import machinery to work with unicode paths

2010-08-14 Thread STINNER Victor

STINNER Victor  added the comment:

r84030 creates _Py_fopen() for PyUnicodeObject path.

--

___
Python tracker 

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



[issue9548] locale can be imported at startup but relies on too many library modules

2010-08-14 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> Can we close this issue, or do you consider that it is still very
> important to not load too much modules at startup?

The patch eases the bootstrap constraints by creating a
bootstrap-friendly subset of locale.py. It is indeed much less pressing
now that the initial bug has been fixed.

It also depends whether it is important to have a lightweight
executable. If it isn't, I guess we could compile all extension modules
statically.

--

___
Python tracker 

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



[issue8857] socket.getaddrinfo needs tests

2010-08-14 Thread Giampaolo Rodola'

Giampaolo Rodola'  added the comment:

Committed in r84024.

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

___
Python tracker 

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



[issue588756] python should obey the FHS

2010-08-14 Thread Ezio Melotti

Changes by Ezio Melotti :


--
nosy: +eric.araujo

___
Python tracker 

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



[issue737648] Error on handling nan

2010-08-14 Thread Ezio Melotti

Changes by Ezio Melotti :


--
nosy: +mark.dickinson

___
Python tracker 

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



[issue757815] Infinite floats don't work in compiled modules on windows

2010-08-14 Thread Ezio Melotti

Changes by Ezio Melotti :


--
nosy: +mark.dickinson

___
Python tracker 

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



[issue9600] multiprocessing Pool instantiation crashes on 64 bit 2.6.6rc1 under Windows 7

2010-08-14 Thread Barry A. Warsaw

Barry A. Warsaw  added the comment:

Looks okay to me on *nix.  You can check this in as long as test -u all passes 
on Windows.  Please include a NEWS file entry and close this issue when it's 
committed.  Thanks!

--
resolution:  -> accepted

___
Python tracker 

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



[issue9600] multiprocessing Pool instantiation crashes on 64 bit 2.6.6rc1 under Windows 7

2010-08-14 Thread Brian Curtin

Brian Curtin  added the comment:

Here's the patch. All four changes are one char each and live within 
win32-specific blocks.

--
keywords: +patch
Added file: http://bugs.python.org/file18526/issue9600.diff

___
Python tracker 

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



[issue5930] Transient error in multiprocessing (test_number_of_objects)

2010-08-14 Thread Florent Xicluna

Changes by Florent Xicluna :


--
versions: +Python 3.2

___
Python tracker 

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



[issue9600] multiprocessing Pool instantiation crashes on 64 bit 2.6.6rc1 under Windows 7

2010-08-14 Thread Barry A. Warsaw

Barry A. Warsaw  added the comment:

Please upload a patch specifically for 2.6.6 finally so that I can review it 
(and test it locally).  It *seems* safe enough so if you and I both have a high 
confidence it won't regress anything, and it can go in before Monday, then I 
might approve it.

I still can't build on Windows 7 w/VS2010 though unfortunately, but I will 
locally test Ubuntu (Lucid, Maverick), Debian, and OS X 10.6.

--

___
Python tracker 

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



[issue1282647] socket.getaddrinfo() bug for IPv6 enabled platforms

2010-08-14 Thread Giampaolo Rodola'

Giampaolo Rodola'  added the comment:

I agree with Bert that this is not a Python issue hence I'm closing this out as 
invalid.
Btw, the libc version in which this has been fixed should be 2.1.2:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=52195

--
nosy: +giampaolo.rodola
resolution:  -> invalid
status: open -> closed

___
Python tracker 

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



[issue8857] socket.getaddrinfo needs tests

2010-08-14 Thread Giampaolo Rodola'

Giampaolo Rodola'  added the comment:

This seems to be related with issue 1282647.
Modified patch which skips the test in case of buggy libc version is in 
attachment.

--
Added file: http://bugs.python.org/file18525/getaddrinfo3.patch

___
Python tracker 

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



[issue5930] Transient error in multiprocessing (test_number_of_objects)

2010-08-14 Thread Florent Xicluna

Florent Xicluna  added the comment:

It happens on some 3.1 buildbots:
 - x86 FreeBSD 7.2 3.1 r83984, r83968, ...
   
http://www.python.org/dev/buildbot/all/builders/x86%20FreeBSD%207.2%203.1/builds/595
 - ARMv4 Debian 3.1 r83831, r83805, r83772, ...
   
http://www.python.org/dev/buildbot/all/builders/ARMv4%20Debian%203.1/builds/257


(...)
test_number_of_objects 
(test.test_multiprocessing.WithManagerTestZZZNumberOfObjects) ...
  2c44bbe0:   refcount=1
<_thread.lock object at 0x2c44bbe0>
  2c56030c:   refcount=2

  2cf51a0c:   refcount=1
<_RLock owner=None count=0>
  2e3b81b4:   refcount=1
 at 0x2e3b81b4>
  2e466e34:   refcount=1

  2e5a506c:   refcount=1

  2c44bbe0:   refcount=1
<_thread.lock object at 0x2c44bbe0>
  2c56030c:   refcount=2

  2cf51a0c:   refcount=1
<_RLock owner=None count=0>
  2e3b81b4:   refcount=1
 at 0x2e3b81b4>
  2e466e34:   refcount=1

  2e5a506c:   refcount=1

FAIL

(...)
==
FAIL: test_number_of_objects 
(test.test_multiprocessing.WithManagerTestZZZNumberOfObjects)
--
Traceback (most recent call last):
  File 
"/usr/home/db3l/buildarea/3.1.bolen-freebsd7/build/Lib/test/test_multiprocessing.py",
 line 1085, in test_number_of_objects
self.assertEqual(refs, EXPECTED_NUMBER)
AssertionError: 6 != 1

--
versions:  -Python 3.2

___
Python tracker 

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



[issue9425] Rewrite import machinery to work with unicode paths

2010-08-14 Thread STINNER Victor

STINNER Victor  added the comment:

r84012 patchs zipimporter_init() to use the new PyUnicode_FSDecoder() and use 
Py_UNICODE* (unicode) strings instead of char* (byte) strings.

--

___
Python tracker 

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



[issue9425] Rewrite import machinery to work with unicode paths

2010-08-14 Thread STINNER Victor

Changes by STINNER Victor :


Removed file: http://bugs.python.org/file18448/_Py_stat.patch

___
Python tracker 

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



[issue9425] Rewrite import machinery to work with unicode paths

2010-08-14 Thread STINNER Victor

STINNER Victor  added the comment:

r84012 creates _Py_stat(). It is a little bit different than the attached patch 
(_Py_stat.patch): it doesn't clear Python exception on unicode conversion error.

--

___
Python tracker 

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



[issue9600] multiprocessing Pool instantiation crashes on 64 bit 2.6.6rc1 under Windows 7

2010-08-14 Thread Brian Curtin

Brian Curtin  added the comment:

Ok, it turns out this is in fact a regression from 2.6.5. My prior 
investigation for that 3.x issue must not have been on the 2.6 version I 
thought it was.

Barry: the fix from #9513 (e.g., r83722) will correct this.

--
priority: normal -> release blocker

___
Python tracker 

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



[issue4947] sys.stdout fails to use default encoding as advertised

2010-08-14 Thread STINNER Victor

Changes by STINNER Victor :


Removed file: http://bugs.python.org/file18522/file_write-2.7-v2.patch

___
Python tracker 

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



[issue4947] sys.stdout fails to use default encoding as advertised

2010-08-14 Thread STINNER Victor

STINNER Victor  added the comment:

3rd version of the patch: accept character buffer objects without reencoding 
them. Add also tests on character buffer objects.

--
Added file: http://bugs.python.org/file18524/file_write-2.7-v3.patch

___
Python tracker 

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



[issue4947] sys.stdout fails to use default encoding as advertised

2010-08-14 Thread STINNER Victor

STINNER Victor  added the comment:

> Your patch threatens to break compatibility

Yes it does. But I think that nobody relies on this bug. If your terminal uses 
something that utf-8, you will see strange characters if you write something 
else than ascii characters. I supopse that anybody facing this problem uses a 
workaround like replacing sys.stdout object, encode manually each string with 
the right encoding or something else.

--

___
Python tracker 

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



[issue8428] buildbot: test_multiprocessing timeout (test_notify_all? test_pool_worker_lifetime?)

2010-08-14 Thread Florent Xicluna

Florent Xicluna  added the comment:

Still failing on 3.2 and 2.7

 - x86 FreeBSD 7.2 3.x r83981, r83971 ...
 
http://www.python.org/dev/buildbot/all/builders/x86%20FreeBSD%207.2%203.x/builds/823
 - x86 FreeBSD 7.2 2.7 r83985, r83806 ...
 
http://www.python.org/dev/buildbot/all/builders/x86%20FreeBSD%207.2%202.7/builds/67
 - x86 XP-4 2.7 r83985
 http://www.python.org/dev/buildbot/all/builders/x86%20XP-4%202.7/builds/146
 - sparc Ubuntu 2.7 r82939
 
http://www.python.org/dev/buildbot/all/builders/sparc%20Ubuntu%202.7/builds/11


Traceback on "x86 XP-4 2.7":
test test_multiprocessing failed -- Traceback (most recent call last):
  File 
"D:\cygwin\home\db3l\buildarea\2.7.bolen-windows\build\lib\test\test_multiprocessing.py",
 line 746, in test_notify_all
self.assertReturnsIfImplemented(6, get_value, woken)
  File 
"D:\cygwin\home\db3l\buildarea\2.7.bolen-windows\build\lib\test\test_multiprocessing.py",
 line 120, in assertReturnsIfImplemented
return self.assertEqual(value, res)
AssertionError: 6 != 5


Traceback on "x86 FreeBSD 7.2 3.x":
==
FAIL: test_notify_all (test.test_multiprocessing.WithProcessesTestCondition)
--
Traceback (most recent call last):
  File 
"/usr/home/db3l/buildarea/3.x.bolen-freebsd7/build/Lib/test/test_multiprocessing.py",
 line 740, in test_notify_all
self.assertReturnsIfImplemented(6, get_value, woken)
  File 
"/usr/home/db3l/buildarea/3.x.bolen-freebsd7/build/Lib/test/test_multiprocessing.py",
 line 114, in assertReturnsIfImplemented
return self.assertEqual(value, res)
AssertionError: 6 != 3


Additionally, these 2.7 buildbots hang on test_multiprocessing:
 - PPC Leopard 2.7 r83996, r83961 ...
   http://www.python.org/dev/buildbot/all/builders/PPC%20Leopard%202.7/builds/84
 - PPC Tiger 2.7 r83961, r83879 ...
 
http://www.python.org/dev/buildbot/all/builders/PPC%20Tiger%202.7/builds/100
 - x86 FreeBSD 7.2 2.7 r83765
 
http://www.python.org/dev/buildbot/all/builders/x86%20FreeBSD%207.2%202.7/builds/54

--
components: +Tests
nosy: +flox
type:  -> behavior
versions: +Python 2.7

___
Python tracker 

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



[issue9602] PyObject_AsCharBuffer() should only accept read-only objects

2010-08-14 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

I don't think we should change anything in 2.7 at this point. It risks breaking 
compatibility while we are at the end of the 2.x line, for little added benefit 
(the old buffer API has always been insecure with mutable buffers).

As for 3.2, PyObject_AsCharBuffer() should IMO be deprecated, as well as any 
other functions meant to query the old buffer API.

--
nosy: +loewis

___
Python tracker 

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



[issue9584] Allow curly braces in fnmatch

2010-08-14 Thread Éric Araujo

Éric Araujo  added the comment:

python-idea is read by more people.

--

___
Python tracker 

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



[issue8857] socket.getaddrinfo needs tests

2010-08-14 Thread Giampaolo Rodola'

Giampaolo Rodola'  added the comment:

Also with python 2.5 which is the system default.

--

___
Python tracker 

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



[issue9602] PyObject_AsCharBuffer() should only accept read-only objects

2010-08-14 Thread STINNER Victor

New submission from STINNER Victor :

mmap, buffer, bytearray, string and unicode objects set the char buffer 
callback (bf_getcharbuffer). The bytearray object sets also the release buffer 
callback (bf_releasebuffer).

In Python 2.7, PyObject_AsCharBuffer() accepts bytearray objects, whereas the 
"t#" format of PyArg_Parse functions rejects byte bytearray objects (expect an 
"pinned buffer object").

In Python 3.2, PyObject_AsCharBuffer() releases the buffer.

PyObject_AsCharBuffer() documentation (in 2.7 and 3.2) says that the function 
only accepts read-only objects.

Something is wrong here. If the caller doesn't hold a kind of lock, the object 
cannot be protected against futher modifications. The caller has to ensure that 
the object is not modifiable until it finishs to use the char* pointer.

I think that it would be safer to respect the documentation: 
PyObject_AsCharBuffer() should only accept read-only objects. The most 
important change is that functions using PyObject_AsCharBuffer() will not 
accept bytearray objects anymore.

Attached patch (for Python 2.7) changes PyObject_AsCharBuffer() to reject 
modifiable objects. It removes also the character buffer callback from the 
bytearray type. To avoid breaking compatibility too much, I patched int(), 
long() and float() to still support bytearray objects.

Examples of functions rejecting bytearray with the patch:
 - int(), long(), float(), complex()
 - many str methods: split, partition, rpartition, rsplit, index, find, count, 
translate, replace, startswith, endswith
 - writelines() of file objects (eg. sys.stdout.writelines)
 - writelines() method of a bz2 file

--

My patch breaks backward compatibility, and I don't know that it is acceptable 
in Python 2.7.

I will write a similar patch for Python 3.2.

--
components: Interpreter Core
files: PyObject_AsCharBuffer-2.7.patch
keywords: patch
messages: 113895
nosy: haypo, pitrou
priority: normal
severity: normal
status: open
title: PyObject_AsCharBuffer() should only accept read-only objects
versions: Python 2.7, Python 3.2
Added file: http://bugs.python.org/file18523/PyObject_AsCharBuffer-2.7.patch

___
Python tracker 

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



[issue8857] socket.getaddrinfo needs tests

2010-08-14 Thread Giampaolo Rodola'

Giampaolo Rodola'  added the comment:

I'm not sure whether it's a problem with my python installation but this is 
what I get on FreeBSD 7.0 with both python 2.7 and 3.2:


>>> import socket
>>> socket.getaddrinfo('localhost', 80)
Traceback (most recent call last):
  File "", line 1, in 
socket.gaierror: [Errno 9] servname not supported for ai_socktype
>>>

--

___
Python tracker 

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



[issue9601] ftplib should accept 250 on MKD

2010-08-14 Thread Giampaolo Rodola'

Giampaolo Rodola'  added the comment:

> The server responses 250 instead of 257 (which would be correct according to 
> RFC959, ftp)

In response to what command? MKD?
And what do you mean by "tolerate"?

--

___
Python tracker 

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



[issue4947] sys.stdout fails to use default encoding as advertised

2010-08-14 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Your patch threatens to break compatibility. I think it would be better to 
simply change the "encoding" and "errors" attributes of standard streams.

--

___
Python tracker 

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



[issue4947] sys.stdout fails to use default encoding as advertised

2010-08-14 Thread STINNER Victor

Changes by STINNER Victor :


Removed file: http://bugs.python.org/file18521/file_write-2.7.patch

___
Python tracker 

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



[issue4947] sys.stdout fails to use default encoding as advertised

2010-08-14 Thread STINNER Victor

STINNER Victor  added the comment:

Oh, I forgot to write that my patch uses also the errors attribute. Update the 
patch to add tests on errors: file_write-2.7-v2.patch.

--
Added file: http://bugs.python.org/file18522/file_write-2.7-v2.patch

___
Python tracker 

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



[issue4947] sys.stdout fails to use default encoding as advertised

2010-08-14 Thread STINNER Victor

STINNER Victor  added the comment:

Attached patch fixes this old and annoying issue. The issue only concerns 
sys.std* files, because Python only set the encoding and errors attributes for 
these files.

--
keywords: +patch
versions: +Python 2.7
Added file: http://bugs.python.org/file18521/file_write-2.7.patch

___
Python tracker 

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



[issue7219] Unhelpful error message when a distutils package install fails due to a permissions error

2010-08-14 Thread Michael Foord

Michael Foord  added the comment:

The "None" error message *looks* to me like the result of a failed assertion. 
That may not be correct of course...

--

___
Python tracker 

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



[issue9584] Allow curly braces in fnmatch

2010-08-14 Thread Mathieu Bridon

Mathieu Bridon  added the comment:

Wow, I certainly didn't expect to generate so much controversy. :-/

First of all, thanks for the comments on the patch Antoine and David.

> I don't get what the purpose of these two lines is. Forbid empty patterns?

I copy-pasted the handling of the '[' character in the same file, and adapted 
it. This test was to properly handle sequences like '[]]', and you are right, 
it has nothing to do in this patch, I just forgot to remove it.

> You probably mean "while j < n" instead of "while i < n".

Yes, that's a typo. :-/

> Regardless, it's simpler to use "j = pat.find('}', j)".

I know, I just thought I would try to remain consistent with the way the '[' 
char was handled.

> You should also add a test for unmatched braces. Currently:

I realised that after submitting the patch, yes. Actually, there are several 
other cases that I didn't properly handle, like a closing brace without a 
matching opening brace, or even nested braces (which are perfectly acceptable 
in the context of a shell like Bash).

I'm working on an improved patch that would correctly handle those cases (with 
much more unit tests!), I guess I just hit the submit button too quickly. :)

---

Now, about whether or not this is appropriate in fnmatch, I agree with David 
that if we want to remain really consistent with shell implementations, then 
fnmatch probably isn't the appropriate place to do so.

In this case, I guess the correct way to implement it would be to expand the 
braces and generate several patterns that would all be fed to different fnmatch 
calls?

Implementing it in fnmatch just seemed so convenient, replacing the braces with 
'(...|...)' constructs in a regex.

People seem to agree that a thread on python-ideas would be good to discuss 
this change, but this ticket already generated some discussion. Should I start 
the thread on the mailing-list anyway or is this ticket an appropriate forum 
for further discussion?

--

___
Python tracker 

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



[issue9520] Add Patricia Trie high performance container

2010-08-14 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

So, here is the modified benchmark. It first creates a cache of the random 
wordlist, because it is quite long to compute (for N up to 1000). The cache 
is reused in subsequent runs. This takes some memory though (probably won't run 
it if you have less than 2GB). The cache itself is quite small on-disk (around 
80 MB).

I'm outputting the total dict size and the space occupied per individual key, 
and I've also timed lookups separately. Here are results on my machine:

1000 words ( 961 keys), 3269137 words/s, 16980987 lookups/s, 51 
bytes/key (0.0MB)
   1 words (9042 keys), 2697648 words/s, 13680052 lookups/s, 87 
bytes/key (0.8MB)
  10 words (   83168 keys), 2462269 words/s, 6956074 lookups/s, 37 
bytes/key (3.0MB)
  50 words (  389442 keys), 1802431 words/s, 4733774 lookups/s, 64 
bytes/key (24.0MB)
 100 words (  755372 keys), 1702130 words/s, 4485229 lookups/s, 66 
bytes/key (48.0MB)
 200 words ( 1463359 keys), 1616658 words/s, 4251021 lookups/s, 68 
bytes/key (96.0MB)
 500 words ( 3501140 keys), 1608889 words/s, 3909212 lookups/s, 57 
bytes/key (192.0MB)
1000 words ( 6764089 keys), 1531136 words/s, 3600395 lookups/s, 59 
bytes/key (384.0MB)

As you can see, the O(1) behaviour seems almost observed up to the 1000 
words limit (given the way the data is computed, I'm afraid I can't go further 
than that). Of course, very small dicts are faster because everything fits in 
the CPU caches.

--
Added file: http://bugs.python.org/file18520/dcbench-py3k.py

___
Python tracker 

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



[issue9520] Add Patricia Trie high performance container

2010-08-14 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> For example, on the x64 machine the following dict() mapping 
> 10,000,000 very short unicode keys (~7 chars) to integers eats 149
> bytes per entry. 

This is counting the keys too. Under 3.x:

>>> d = {}
>>> for i in range(0, 1000): d[str(i)] = i
... 
>>> sys.getsizeof(d)
402653464
>>> sys.getsizeof(d) / len(d)
40.2653464

So, the dict itself uses ~40 bytes/entry. Since this is a 64-bit Python build, 
each entry uses three words of 8 bytes each, that is 24 bytes per entry (one 
word for the key, one word for the associated value, one word for the cached 
hash value). So, you see the ratio of allocated entries in the hash table over 
used entries is only a bit above 2, which is reasonable.

Do note that unicode objects themselves are not that compact:

>>> sys.getsizeof("100")
72

If you have many of them, you might use bytestrings instead:

>>> sys.getsizeof(b"100")
40

I've modified your benchmark to run under 3.x and will post it in a later 
message (I don't know whether bio.trie exists for 3.x, though).

--

___
Python tracker 

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



[issue9596] PC/getpathp.c unused?

2010-08-14 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

No, the guards are probably redundant.

--

___
Python tracker 

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



[issue9601] ftplib should accept 250 on MKD

2010-08-14 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy: +giampaolo.rodola

___
Python tracker 

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



[issue9596] PC/getpathp.c unused?

2010-08-14 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Oh, my bad. Is there any reason for the MS_WINDOWS guards in Modules/getpath.c, 
then?

--
resolution:  -> invalid
status: open -> closed

___
Python tracker 

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



[issue586680] -S hides standard dynamic modules

2010-08-14 Thread STINNER Victor

STINNER Victor  added the comment:

Ooops, I didn't notice that Antoine did already updated this issue. Restore the 
resolution as duplicate since the superseder field is set.

--
resolution: fixed -> duplicate

___
Python tracker 

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



[issue9589] test_heapq: AttributeError: 'int' object has no attribute 'pop'

2010-08-14 Thread STINNER Victor

STINNER Victor  added the comment:

r83988 is also the correct fix for #586680: I updated this issue.

--

___
Python tracker 

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



[issue586680] -S hides standard dynamic modules

2010-08-14 Thread STINNER Victor

STINNER Victor  added the comment:

r83988 does really fix this issue in python 3.2, 8 years later, yeah!

--
nosy: +haypo, pitrou
resolution: duplicate -> fixed

___
Python tracker 

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



[issue9548] locale can be imported at startup but relies on too many library modules

2010-08-14 Thread STINNER Victor

STINNER Victor  added the comment:

Antoine fixed #9589 by rewriting site.py code in C and calling it more much 
earlier: r83988.

This commit fixes the initial problem of this issue:

$ ./python -c 'import heapq; print(heapq.heapify)'

$ cat | ./python -c 'import heapq; print(heapq.heapify)'


Can we close this issue, or do you consider that it is still very important to 
not load too much modules at startup?

--

___
Python tracker 

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



[issue9601] ftplib should accept 250 on MKD

2010-08-14 Thread Eric Smith

Eric Smith  added the comment:

Since this is a feature request, it could only be added to 3.2, not the other 
versions.

--
nosy: +eric.smith
type: behavior -> feature request
versions:  -Python 2.5, Python 2.6, Python 2.7, Python 3.1, Python 3.3

___
Python tracker 

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



[issue9548] locale can be imported at startup but relies on too many library modules

2010-08-14 Thread Nick Coghlan

Nick Coghlan  added the comment:

As we move more and more infrastructure into Python code, we're going to see 
this pattern (i.e. a bootstrap module underlying the real module) more and more 
often (e.g. I seem to recall Brett has to do something similar when playing 
with the pure Python __import__ implementation).

I don't have an issue with it - it's a solid, standard solution to a recurring 
problem with otherwise circular dependencies.

The only changes I would suggest to Antoine's patch are to explicitly scope 
"interpreter startup" in the _bootlocale docstring (to make it clear that 
sitecustomize.py should use the ordinary locale module) and to mention the 
nature of _bootlocale in a comment just before the "from _bootlocale import *" 
line in locale.py.

--

___
Python tracker 

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



[issue5867] No way to create an abstract classmethod

2010-08-14 Thread Daniel Urban

Daniel Urban  added the comment:

I'm attaching a new patch adding the abc.abstractclassmethod and 
abc.abstractstaticmethod decorators.

--
Added file: http://bugs.python.org/file18519/abstractclassstaticmethod.diff

___
Python tracker 

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