[issue1065986] Fix pydoc crashing on unicode strings

2012-11-11 Thread David Barnett

David Barnett added the comment:

I guess it must be more complicated than it looks, because I thought checking 
for unicode strings and doing .encode('utf-8') would help at least some cases 
without making anything worse.

Anyways, if it's too hard or not worth fixing correctly, couldn't we at least 
do something to prevent a crash? Maybe strip out / replace special characters 
and try again?

--

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



[issue16427] Faster hash implementation

2012-11-11 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

 The patch is too optimistic, it gives different results depending on the 
 alignment of the memory buffer:

So this method is not applicable for a byte.  Here is a patch only for strings.

If a fast hash for bytes/memoryview is desirable, I can write a fast robust 
implementation for nonaligned data.  But this will be more cumbersome and a bit 
slower.

--
Added file: http://bugs.python.org/file27950/fast_str_hash.patch

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



[issue16140] subprocess.Popen the os.close calls in _execute_child can raise an EBADF exception

2012-11-11 Thread Gregory P. Smith

Gregory P. Smith added the comment:

To remove the double close fd-reuse-window race condition you describe in 3.2.3 
and later I don't think you even need to add that code snippet.  Just get rid 
of the for loop calling os.close on those three fd's all together.  self.stdin, 
self.stdout and self.stderr are already closed in the error case here:

http://hg.python.org/releasing/3.2.3/file/86d1421a552c/Lib/subprocess.py#l746

--

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



[issue16427] Faster hash implementation

2012-11-11 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

 Here is a test case for the hash/alignment issue.

I think here should be a test for a shifted data.  Something like 
hash(b'abcd...') == hash(memoryview(b'xabcd...')[1:]).

--

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



[issue16427] Faster hash implementation

2012-11-11 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Oh, I see, it's already here.

--

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



[issue15677] Gzip/zlib allows for compression level=0

2012-11-11 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

LGTM.

--
nosy: +nadeem.vawda, serhiy.storchaka
stage: needs patch - commit review
versions: +Python 3.4

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



[issue16140] subprocess.Popen the os.close calls in _execute_child can raise an EBADF exception

2012-11-11 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 6ebfdfe74c04 by Gregory P. Smith in branch '3.2':
Fixes issue #16140: The subprocess module no longer double closes its
http://hg.python.org/cpython/rev/6ebfdfe74c04

New changeset 9f8b0444c8a6 by Gregory P. Smith in branch '3.3':
Fixes issue #16140: The subprocess module no longer double closes its
http://hg.python.org/cpython/rev/9f8b0444c8a6

New changeset d51df72dadb7 by Gregory P. Smith in branch 'default':
Fixes issue #16140: The subprocess module no longer double closes its
http://hg.python.org/cpython/rev/d51df72dadb7

--
nosy: +python-dev

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



[issue16350] zlib.Decompress.decompress() after EOF discards existing value of unused_data

2012-11-11 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I see you much adjusted the patch.  It looks good, thanks you.

--

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



[issue16452] Add support for weak reference to bound methods

2012-11-11 Thread Simon Feltman

New submission from Simon Feltman:

This is a feature request to include a WeakMethod or similar object to the 
weakref module. The object decomposes a bound method and holds a weakref to the 
object and unbound function. This can be a very useful utility in signal and ui 
based programming.

The issue has come up a few times but I was unable to find a bug specifically 
requesting this feature. I think similar code has shown up in enough libraries 
at this point that it makes sense to just include it in pythons weakref module.

See also:
http://bugs.python.org/issue813299
http://bugs.python.org/issue7464

This is the recipes:
http://code.activestate.com/recipes/81253/
http://mindtrove.info/python-weak-references/

--
components: None
messages: 175337
nosy: sfeltman
priority: normal
severity: normal
status: open
title: Add support for weak reference to bound methods
type: enhancement

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



[issue16452] Add support for weak reference to bound methods

2012-11-11 Thread Mark Dickinson

Mark Dickinson added the comment:

Duplicate of http://bugs.python.org/issue14631 ?

--
nosy: +mark.dickinson

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



[issue16452] Add support for weak reference to bound methods

2012-11-11 Thread Mark Dickinson

Changes by Mark Dickinson dicki...@gmail.com:


--
stage:  - needs patch

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



[issue16452] Add support for weak reference to bound methods

2012-11-11 Thread Mark Dickinson

Changes by Mark Dickinson dicki...@gmail.com:


--
components: +Library (Lib) -None
versions: +Python 3.4

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



[issue16327] subprocess.Popen leaks file descriptors on os.fork() failure

2012-11-11 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 2bdd984a55ac by Gregory P. Smith in branch '2.7':
Fix issue #16140 bug that the fix to issue #16327 added - don't double
http://hg.python.org/cpython/rev/2bdd984a55ac

--

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



[issue16140] subprocess.Popen the os.close calls in _execute_child can raise an EBADF exception

2012-11-11 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 2bdd984a55ac by Gregory P. Smith in branch '2.7':
Fix issue #16140 bug that the fix to issue #16327 added - don't double
http://hg.python.org/cpython/rev/2bdd984a55ac

--

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



[issue16140] subprocess.Popen the os.close calls in _execute_child can raise an EBADF exception

2012-11-11 Thread Gregory P. Smith

Changes by Gregory P. Smith g...@krypto.org:


--
resolution:  - fixed
status: open - closed
versions: +Python 2.7

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



[issue16140] subprocess.Popen the os.close calls in _execute_child can raise an EBADF exception

2012-11-11 Thread Gregory P. Smith

Changes by Gregory P. Smith g...@krypto.org:


--
stage: test needed - committed/rejected

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



[issue16452] Add support for weak reference to bound methods

2012-11-11 Thread Simon Feltman

Simon Feltman added the comment:

Indeed a duplicate of: http://bugs.python.org/issue14631

--
resolution:  - duplicate
status: open - closed

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



[issue14621] Hash function is not randomized properly

2012-11-11 Thread STINNER Victor

STINNER Victor added the comment:

Did qomeone start to write a PEP?
Le 11 nov. 2012 05:56, Chris Rebert rep...@bugs.python.org a écrit :


 Chris Rebert added the comment:

 What about CityHash? (http://code.google.com/p/cityhash/ ; unofficial C
 port: http://code.google.com/p/cityhash-c/ )
 It's good enough for Google...

 --
 nosy: +cvrebert

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


--

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



[issue5784] raw deflate format and zlib module

2012-11-11 Thread Serhiy Storchaka

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


--
stage:  - needs patch
versions: +Python 3.4 -Python 3.1

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



[issue14631] Instance methods and WeakRefs don't mix.

2012-11-11 Thread Mark Dickinson

Mark Dickinson added the comment:

Adding some useful links from Simon Feltman in issue 16452.

See also:
http://bugs.python.org/issue813299
http://bugs.python.org/issue7464

This is the recipes:
http://code.activestate.com/recipes/81253/
http://mindtrove.info/python-weak-references/

--
nosy: +sfeltman

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



[issue16452] Add support for weak reference to bound methods

2012-11-11 Thread Mark Dickinson

Changes by Mark Dickinson dicki...@gmail.com:


--
superseder:  - Instance methods and WeakRefs don't mix.

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



[issue14631] Instance methods and WeakRefs don't mix.

2012-11-11 Thread Simon Feltman

Simon Feltman added the comment:

Just a note this is also referred to as a WeakMethod by some folks (so this 
ticket shows up in those searches). See also:
http://bugs.python.org/issue813299
http://bugs.python.org/issue7464
http://bugs.python.org/issue16452

--

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



[issue14631] Instance methods and WeakRefs don't mix.

2012-11-11 Thread Mark Dickinson

Changes by Mark Dickinson dicki...@gmail.com:


--
versions: +Python 3.4 -Python 3.3

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



[issue14621] Hash function is not randomized properly

2012-11-11 Thread Giovanni Bajo

Giovanni Bajo added the comment:

Il giorno 11/nov/2012, alle ore 05:56, Chris Rebert rep...@bugs.python.org ha 
scritto:

 
 Chris Rebert added the comment:
 
 What about CityHash? (http://code.google.com/p/cityhash/ ; unofficial C port: 
 http://code.google.com/p/cityhash-c/ )
 It's good enough for Google...

It's good enough for Google in a context that does not require protection 
against collision attacks. If you have a look at SipHash' page, you will find a 
program to generate collisions to CityHash.
-- 
Giovanni Bajo

My Blog: http://giovanni.bajo.it

--

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



[issue16140] subprocess.Popen the os.close calls in _execute_child can raise an EBADF exception

2012-11-11 Thread Mark Dickinson

Mark Dickinson added the comment:

test_gc and test_csv seem to be failing on some of the buildbots as a result of 
these checkins.  It looks as though the new test_subprocess test creates some 
uncollectable garbage.

--
nosy: +mark.dickinson

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



[issue16140] subprocess.Popen the os.close calls in _execute_child can raise an EBADF exception

2012-11-11 Thread Mark Dickinson

Mark Dickinson added the comment:

Adding 'del p' at the end of the test method fixes this for me.

--

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



[issue16124] fcntl_ioctl still not 100% sane with unsigned longs

2012-11-11 Thread Garrett Cooper

Garrett Cooper added the comment:

Yes. Submitting a patch to fix this based on hg master shortly..

--

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



[issue16427] Faster hash implementation

2012-11-11 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 If a fast hash for bytes/memoryview is desirable, I can write a fast
 robust implementation for nonaligned data.  But this will be more
 cumbersome and a bit slower.

Unaligned accesses are not a problem on x86(-64), but they will segfault
(bus error, IIRC) on other architectures such as SPARC, unfortunately.

(blame RISC for being really too simplified)

--

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



[issue16449] RotatingFileHandler rollover doesn't work on QNX shmem filesystems

2012-11-11 Thread Vinay Sajip

Vinay Sajip added the comment:

Thanks for the patch, but I'm closing this as 'wontfix', as per the points made 
by Antoine and David. If you need logging from an embedded system, please 
consider using one of the socket-based logging handlers, if that's feasible in 
the specific situation.

--
resolution:  - wont fix
status: open - closed

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



[issue16427] Faster hash implementation

2012-11-11 Thread Stefan Krah

Stefan Krah added the comment:

FWIW, on x86/x64 gcc often generates identical code for x = y and
memcpy(x, y, 8). See e.g. the PACK_SINGLE and UNPACK_SINGLE macros in
Objects/memoryobject.c.

I didn't look at the patch yet, just an idea.

--

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



[issue16449] RotatingFileHandler rollover doesn't work on QNX shmem filesystems

2012-11-11 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

What about the rotator attribute.

--
nosy: +serhiy.storchaka

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



[issue16427] Faster hash implementation

2012-11-11 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

 Unaligned accesses are not a problem on x86(-64), but they will segfault
(bus error, IIRC) on other architectures such as SPARC, unfortunately.

On x86(-64) this kills performance and makes the optimization be senseless.

 FWIW, on x86/x64 gcc often generates identical code for x = y and
memcpy(x, y, 8).

The code can be identical, but the time will differ significantly for aligned 
and non-aligned data.

--

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



[issue16124] fcntl_ioctl still not 100% sane with unsigned longs

2012-11-11 Thread Garrett Cooper

Garrett Cooper added the comment:

$ uname -a
FreeBSD bayonetta.local 9.1-PRERELEASE FreeBSD 9.1-PRERELEASE #0 r240836M: Sat 
Sep 22 12:30:11 PDT 2012 
gcooper@bayonetta.local:/usr/obj/store/freebsd/stable/9/sys/BAYONETTA  amd64
$ ./configure --prefix=/scratch/python-bin/3k/
...
$ make all; make install
...
$ /scratch/python-bin/3k/bin/python3 Lib/test/test_ioctl.py
test_ioctl (__main__.IoctlTests) ... ok
test_ioctl_mutate (__main__.IoctlTests) ... ok
test_ioctl_mutate_1024 (__main__.IoctlTests) ... ok
test_ioctl_mutate_2048 (__main__.IoctlTests) ... ok
test_ioctl_signed_unsigned_code_param (__main__.IoctlTests) ... ok

--
Ran 5 tests in 0.003s

OK

--
keywords: +patch
versions: +Python 2.6, Python 3.1, Python 3.2, Python 3.5
Added file: http://bugs.python.org/file27951/python-issue13500-test.patch

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



[issue16124] fcntl_ioctl still not 100% sane with unsigned longs

2012-11-11 Thread Garrett Cooper

Garrett Cooper added the comment:

Sorry; previous patch is not applicable to this issue. This one is.

--
Added file: http://bugs.python.org/file27952/python-issue16124.patch

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



[issue16124] fcntl_ioctl still not 100% sane with unsigned longs

2012-11-11 Thread Garrett Cooper

Changes by Garrett Cooper yaneg...@gmail.com:


Removed file: http://bugs.python.org/file27951/python-issue13500-test.patch

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



[issue16124] fcntl_ioctl still not 100% sane with unsigned longs

2012-11-11 Thread Garrett Cooper

Garrett Cooper added the comment:

And I missed the int - unsigned int part. Resubmitting one last time for 
tonight..

--
Added file: http://bugs.python.org/file27953/python-issue16124.patch

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



[issue16124] fcntl_ioctl still not 100% sane with unsigned longs

2012-11-11 Thread Garrett Cooper

Changes by Garrett Cooper yaneg...@gmail.com:


Removed file: http://bugs.python.org/file27953/python-issue16124.patch

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



[issue16124] fcntl_ioctl still not 100% sane with unsigned longs

2012-11-11 Thread Garrett Cooper

Garrett Cooper added the comment:

Grr... Let's try again.

--
Added file: http://bugs.python.org/file27954/python-issue16124.patch

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



[issue16124] fcntl_ioctl still not 100% sane with unsigned longs

2012-11-11 Thread Garrett Cooper

Garrett Cooper added the comment:

... g'night.

--
Added file: http://bugs.python.org/file27955/python-issue16124.patch

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



[issue16449] RotatingFileHandler rollover doesn't work on QNX shmem filesystems

2012-11-11 Thread Phil Connell

Phil Connell added the comment:

I'm not convinced that it matters whether the rename or move is atomic. Can 
anyone come up with a quick concrete example?


I see two scenarios:

1. The process crashes during a copy in shutils.move(). In this case, some logs 
will be duplicated across the files involved in the copy.

2. Other threads emit logs during the rollover. Given that the IO lock is 
acquired in Handler.handle() before calling emit(), this is fine.


While the first case isn't ideal, I don't think there can be any loss of logs.

--

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



[issue16449] RotatingFileHandler rollover doesn't work on QNX shmem filesystems

2012-11-11 Thread Phil Connell

Phil Connell added the comment:

Serhiy, there are also calls to os.rename in RotatingFileHandler.doRollover

--

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



[issue16427] Faster hash implementation

2012-11-11 Thread Stefan Krah

Stefan Krah added the comment:

 The code can be identical, but the time will differ significantly for
 aligned and non-aligned data.

Of course, but in most cases the data *is* aligned, so only code that does
something quite special pays the performance penalty.

--

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



[issue16449] RotatingFileHandler rollover doesn't work on QNX shmem filesystems

2012-11-11 Thread Vinay Sajip

Vinay Sajip added the comment:

The current implementation was written with an expectation of working rename 
functionality in the stdlib. As such, while this issue might be categorised as 
being of type enhancement, I don't see how you can categorise it as being of 
type behaviour.

What's the problem with subclassing the relevant handlers to implement your own 
doRollover() method? You only need to do that once for all the projects in your 
QNX environment. Given that it's not a mainstream environment, that's not IMO 
an unreasonable suggestion.

If you publish such a handler, I'll mention it on

http://plumberjack.blogspot.co.uk/p/handlers-for-logging.html

which has a whole bunch of handlers written by people for specific requirements 
which don't warrant adding functionality directly in the stdlib.

--

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



[issue15677] Gzip/zlib allows for compression level=0

2012-11-11 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 735ef27fa231 by Nadeem Vawda in branch '2.7':
Issue #15677: Document that zlib and gzip accept a compression level of 0 to 
mean 'no compression'.
http://hg.python.org/cpython/rev/735ef27fa231

New changeset f6c4c178da56 by Nadeem Vawda in branch '2.7':
Issue #15677: Also fix docstrings in zlib module.
http://hg.python.org/cpython/rev/f6c4c178da56

New changeset 9dde30690f44 by Nadeem Vawda in branch '3.2':
Issue #15677: Document that zlib and gzip accept a compression level of 0 to 
mean 'no compression'.
http://hg.python.org/cpython/rev/9dde30690f44

New changeset 0e48bf45313c by Nadeem Vawda in branch '3.3':
Issue #15677: Document that zlib and gzip accept a compression level of 0 to 
mean 'no compression'.
http://hg.python.org/cpython/rev/0e48bf45313c

New changeset 21335c9fcec0 by Nadeem Vawda in branch 'default':
Issue #15677: Document that zlib and gzip accept a compression level of 0 to 
mean 'no compression'.
http://hg.python.org/cpython/rev/21335c9fcec0

--
nosy: +python-dev

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



[issue15677] Gzip/zlib allows for compression level=0

2012-11-11 Thread Nadeem Vawda

Nadeem Vawda added the comment:

Committed. Thanks for the patch!

--
resolution:  - fixed
stage: commit review - committed/rejected
status: open - closed
type:  - enhancement

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



[issue16449] RotatingFileHandler rollover doesn't work on QNX shmem filesystems

2012-11-11 Thread Phil Connell

Phil Connell added the comment:

I've updated the type to enhancement (it seems like a grey area to me - it's a 
behavioural fix for a niche use case).

I suggested a patch rather than simply subclassing RotatingFileHandler since:
  - The subclass would just have a copy of RotatingFileHandler's doRollover 
method with a one-line change.
  - The proposed fix is functionally equivalent to the current code for all 
currently working uses.


Thanks for the offer of having an extension linked from your blog. I don't 
think it's appropriate for this case (since it's just a slightly modified copy 
of the stdlib code - I'll probably just keep the patch along with a few other 
compatibility hacks we have) although I may have something for you in future 
(we do have a subclass that compresses old logs).

--
type: behavior - enhancement

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



[issue16449] RotatingFileHandler rollover doesn't work on QNX shmem filesystems

2012-11-11 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 I've updated the type to enhancement (it seems like a grey area to me
 - it's a behavioural fix for a niche use case).
 
 I suggested a patch rather than simply subclassing RotatingFileHandler
 since:
   - The subclass would just have a copy of RotatingFileHandler's
 doRollover method with a one-line change.
   - The proposed fix is functionally equivalent to the current code
 for all currently working uses.

You may just as well monkeypatch os.rename() to fallback on
shutil.move() if the filenames are on a /dev/shm filesystem (or you
could bug QNX to fix their broken filesystem...).

From a code quality and readability standpoint, os.rename() conveys the
intended semantics clearly, while shutil.move() doesn't, so switching to
shutil.move() in the stdlib would be a regression. Also, doing this in
logging would open the door to doing the same thing in other modules.
Even a critical piece of infrastructure such as importlib relies on
os.rename() working properly.

--

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



[issue16427] Faster hash implementation

2012-11-11 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Stefan, thank you for the suggestion.  The test showed that, in fact, at least 
under some x86 there is no performance decrease when using memcpy on nonaligned 
data.  This is good news.  The code can left simple and even some doubtful 
potential undefined behavior was removed.

Additional microbenchmarks:

$ ./python -m timeit -n 1 -s t = memview(b'a' * 10**8)  hash(t)
$ ./python -m timeit -n 1 -s t = memview(b'a' * 10**8)[1:]  hash(t)
$ ./python -m timeit -n 1 -s t = memview(b'a' * 10**8)[8:]  hash(t)

   original  patchedspeedup

bytes  181 msec  46 msec3.9x
UCS1   429 msec  46.2 msec  9.3x
UCS2   179 msec  91.9 msec  1.9x
UCS4   183 msec  184 msec   1x
memview()  362 msec  91.7 msec  3.9x
memview()[1:]  362 msec  93.2 msec  3.9x
memview()[8:]  362 msec  92.4 msec  3.9x

I don't know how it will be on other platforms.

--
Added file: http://bugs.python.org/file27956/fast_hash_3.patch

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



[issue16449] RotatingFileHandler rollover doesn't work on QNX shmem filesystems

2012-11-11 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Doesn't the rotator attribute break atomicity?  A careful rotator should 
first rename the source to the temporary file, process the data and save it to 
other temporary file, and then rename the result to the destination and remove 
the first temporary file.

--

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



[issue16124] fcntl_ioctl still not 100% sane with unsigned longs

2012-11-11 Thread Antoine Pitrou

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


--
nosy: +skrah, trent

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



[issue14215] http://www.python.org/dev/peps/ title is python.org

2012-11-11 Thread Georg Brandl

Georg Brandl added the comment:

Fixed with commit 11779150cf87 in the peps repo.  May need a PEP addition or 
PEP title change to trigger, but it's too minor to force that right now.

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

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



[issue14215] http://www.python.org/dev/peps/ title is python.org

2012-11-11 Thread Georg Brandl

Georg Brandl added the comment:

@ Nick/Ezio: the catch was that the /dev/peps/ directory is handled in addition 
to /dev/peps/pep-/, which always had a nice title.

For all PEPs, four files are generated (although it seems sufficient to have 
two), while for /dev/peps/, only body.html was copied over to its directory.

--

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



[issue15861] ttk.Treeview unmatched open brace in list

2012-11-11 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/issue15861
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16449] RotatingFileHandler rollover doesn't work on QNX shmem filesystems

2012-11-11 Thread Vinay Sajip

Vinay Sajip added the comment:

 Doesn't the rotator attribute break atomicity?

Which rotator do you mean? The default rotator is None, which leads to 
os.rename being called. If you're referring to the example in the documentation 
(cookbook) - it was intended purely as an example, and the paragraph under the 
snippet does say it's only intended for illustrative purposes.

--

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



[issue8865] select.poll is not thread safe

2012-11-11 Thread Antoine Pitrou

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


--
nosy: +serhiy.storchaka

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



[issue14631] Instance methods and WeakRefs don't mix.

2012-11-11 Thread Antoine Pitrou

Antoine Pitrou added the comment:

WeakMethod sounds like a good name to me. However, instead of acting as a 
proxy, I think it should act as a regular weakref (i.e. you have to call it to 
get the actual method object).

--
nosy: +pitrou

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



[issue16396] Importing ctypes.wintypes on Linux gives a traceback

2012-11-11 Thread Terry J. Reedy

Changes by Terry J. Reedy tjre...@udel.edu:


--
nosy: +amaury.forgeotdarc, belopolsky, meador.inge
versions:  -Python 3.1

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



[issue16397] UserString doesn't combine nicely with strings

2012-11-11 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Jorge, can we close this or do you still have a specific suggestion.
Also, if you reply by mail, please snip previous messages as they are already 
posted.

--
nosy: +terry.reedy
type: behavior - enhancement

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



[issue16405] Explain how to set up the whitespace commit hook locally

2012-11-11 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I would be helped by such an explanation in the devguide.

--
nosy: +terry.reedy

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



[issue16397] UserString doesn't combine nicely with strings

2012-11-11 Thread Jorge Cardona

Jorge Cardona added the comment:

Hi, this can be closed. 

Thanks.

--
status: open - closed

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



[issue16140] subprocess.Popen the os.close calls in _execute_child can raise an EBADF exception

2012-11-11 Thread Gregory P. Smith

Gregory P. Smith added the comment:

That test is gross... it creates a nasty cycle of an instance back to itself 
via a stubbed out nested function's enclosing scope.

I'm sanitizing it now to simplify the code and not have any cycles.

--

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



[issue16418] argparse with many choices can generate absurdly long usage message

2012-11-11 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Juraj: Is the example behavior from Py2 or Py3? The meaning of 'range' changed. 
In Py2, xrange would be the correct choice for 'choice'.

Does argparse actually convert (x)range objects to a list or set (the help 
indicates the latter) for internal use? That would be foolish as 'n in range' 
is an O(1) operation. (I don't remember is that works for xrange.) For 
instance, range(0, 1000, 2) is a nice way to say 'even count less than 1000'.

If it is not so converted, converting for display is also foolish.
'range(0, 1000, 2)' is clearer than an explicit sequence.

--
nosy: +bethard, terry.reedy

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



[issue16453] Inconsistent dead weakref equality

2012-11-11 Thread Antoine Pitrou

New submission from Antoine Pitrou:

Dead weakrefs to a given object happen to be equal if they don't have a 
callback, but unequal if they do. However, they are always equal when alive:

 class O: pass
... 
 o = O()
 def cb(_): pass
... 
 q = weakref.ref(o)
 r = weakref.ref(o)
 s = weakref.ref(o, cb)
 t = weakref.ref(o, cb)
 q == r
True
 s == t
True
 del o
 q() is None
True
 q == r
True
 s == t
False

This may be related to the following optimization (?):

 q is r
True
 s is t
False

--
components: Library (Lib)
messages: 175378
nosy: fdrake, pitrou, tim_one
priority: normal
severity: normal
status: open
title: Inconsistent dead weakref equality
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/issue16453
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16453] Inconsistent dead weakref equality

2012-11-11 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Aha, it is even worse:

 o = O()
 q = weakref.ref(o)
 r = weakref.ref(o)
 del o
 q() is None
True
 q == r
True
 q != r
True

--

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



[issue16397] UserString doesn't combine nicely with strings

2012-11-11 Thread Terry J. Reedy

Changes by Terry J. Reedy tjre...@udel.edu:


--
resolution:  - works for me
stage:  - committed/rejected

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



[issue16453] Inconsistent dead weakref equality

2012-11-11 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 590f1b55abea by Antoine Pitrou in branch '3.2':
Issue #16453: Fix equality testing of dead weakref objects.
http://hg.python.org/cpython/rev/590f1b55abea

New changeset c00e2c1cb3a7 by Antoine Pitrou in branch '3.3':
Issue #16453: Fix equality testing of dead weakref objects.
http://hg.python.org/cpython/rev/c00e2c1cb3a7

New changeset 9e80ea48ff39 by Antoine Pitrou in branch 'default':
Issue #16453: Fix equality testing of dead weakref objects.
http://hg.python.org/cpython/rev/9e80ea48ff39

--
nosy: +python-dev

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



[issue16453] Inconsistent dead weakref equality

2012-11-11 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 13b74c0b040c by Antoine Pitrou in branch '2.7':
Issue #16453: Fix equality testing of dead weakref objects.
http://hg.python.org/cpython/rev/13b74c0b040c

--

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



[issue1160] Medium size regexp crashes python

2012-11-11 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

If we will considered it's important enough to fix, here are patches.

--
keywords: +patch
Added file: http://bugs.python.org/file27957/sre_code_ucs4-2.7.patch

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



[issue1160] Medium size regexp crashes python

2012-11-11 Thread Serhiy Storchaka

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


Added file: http://bugs.python.org/file27958/sre_code_ucs4-3.2.patch

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



[issue16453] Inconsistent dead weakref equality

2012-11-11 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Now fixed.

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

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



[issue1160] Medium size regexp crashes python

2012-11-11 Thread Serhiy Storchaka

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


--
stage: test needed - patch review
Added file: http://bugs.python.org/file27959/sre_code_ucs4_test.patch

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



[issue14631] Instance methods and WeakRefs don't mix.

2012-11-11 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Here is a patch adding a WeakMethod class. It still lacks docs, I'll add some 
if people agree on the principle.

--
keywords: +patch
Added file: http://bugs.python.org/file27960/weakmethod.patch

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



[issue16427] Faster hash implementation

2012-11-11 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 797de1864fd9 by Antoine Pitrou in branch '3.3':
Add a test for hashing of unaligned memory buffers (from issue #16427).
http://hg.python.org/cpython/rev/797de1864fd9

New changeset 9cb1366b251b by Antoine Pitrou in branch 'default':
Add a test for hashing of unaligned memory buffers (from issue #16427).
http://hg.python.org/cpython/rev/9cb1366b251b

--
nosy: +python-dev

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



[issue16418] argparse with many choices can generate absurdly long usage message

2012-11-11 Thread Juraj Variny

Juraj Variny added the comment:

It was Python 2.7 . But if range shouldn't be used for large number of options, 
arguing whether it's O(1) is splitting hairs, no?

I'll remove the choices from my code. Adding new type for port is overkill, 
users should know what legal TCP port numbers are.

--

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



[issue8865] select.poll is not thread safe

2012-11-11 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I was unable to apply the patch automatically, so I had to do it manually.  
Here is an updated patch for review.  I did not consider it in detail yet, but 
it seems to correct these errors.

--
type: behavior - crash
versions: +Python 3.3, Python 3.4 -Python 2.6, Python 3.1
Added file: http://bugs.python.org/file27961/select_concurrent_poll.patch

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



[issue16418] argparse with many choices can generate absurdly long usage message

2012-11-11 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I am arguing that (x)range *should* be usable for large numbers of options 
*because* the containment test is O(1). What happens is you *do* use xrange 
instead of range in 2.7 or 3.x instead of 2.7?

In 2.x, range(n) *is* a list so that is a bad choice for large n, regardless of 
the display issue, which could be fixed separately as is being done on other 
issues.

--

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



[issue8865] select.poll is not thread safe

2012-11-11 Thread Gregory P. Smith

Gregory P. Smith added the comment:

i'm looking at getting this in.

--
assignee:  - gregory.p.smith

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



[issue14631] Instance methods and WeakRefs don't mix.

2012-11-11 Thread Daniel Urban

Changes by Daniel Urban urban.dani...@gmail.com:


--
nosy: +daniel.urban

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



[issue8865] select.poll is not thread safe

2012-11-11 Thread Gregory P. Smith

Gregory P. Smith added the comment:

Christian Schubert (apexo) - Would you please submit a PSF contributor 
agreement form?

http://www.python.org/psf/contrib/
http://www.python.org/psf/contrib/contrib-form-python/

thanks!

--

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



[issue14631] Instance methods and WeakRefs don't mix.

2012-11-11 Thread Simon Feltman

Simon Feltman added the comment:

The WeakCallableRef that was attached seemed to support regular functions (or 
anything callable) which is nice. The naming also leaves room for a 
WeakCallableProxy.

--

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



[issue14631] Instance methods and WeakRefs don't mix.

2012-11-11 Thread Simon Feltman

Simon Feltman added the comment:

Some more complex examples from various libraries:

https://github.com/django/django/blob/master/django/dispatch/saferef.py
https://github.com/11craft/louie/blob/master/louie/saferef.py

I think both of these originated in pydispatcher.

--

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



[issue16454] Mostly for discussion: _winapi as builtin for bootstrapping distutils.

2012-11-11 Thread Ray Donnelly

New submission from Ray Donnelly:

I'm submitting this patch as it was suggested I do so by Antoine Pitrou on 
#python-dev. As such, it's more a point of discussion than a patch I'm trying 
to get merged (for one thing, my build is a MinGW GCC compiled and I've not 
considered the MSVC Windows build).

I ran into a problem with a customisation I made to cygwinccompiler.py where I 
wanted to use Popen to ask gcc where it's ld is:

out = Popen(gcc+' --print-prog-name ld', shell=True, stdout=PIPE).stdout

This has worked fine before on 2.7.3, but with 3.3.0, subprocess can't be 
imported as _winapi isn't builtin, instead, it's built by setup.py as a module.

So is this the right thing to do? Or is distutils not supposed to use 
subprocess during bootstrapping?

--
files: _winapi_as_builtin_for_distutils_bootstrap.patch
keywords: patch
messages: 175393
nosy: Ray.Donnelly, pitrou, sbt
priority: normal
severity: normal
status: open
title: Mostly for discussion: _winapi as builtin for bootstrapping distutils.
type: behavior
versions: Python 3.4
Added file: 
http://bugs.python.org/file27962/_winapi_as_builtin_for_distutils_bootstrap.patch

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



[issue8865] select.poll is not thread safe

2012-11-11 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

In general the patch looks good to me.  I only get rid of non-needed macros.

--
stage:  - test needed
Added file: http://bugs.python.org/file27963/select_concurrent_poll.patch

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



[issue8865] select.poll is not thread safe

2012-11-11 Thread Gregory P. Smith

Gregory P. Smith added the comment:

here's an updated patch.

it strikes me that this should not be a very common problem.  how many 
applications are going to share the same poll object _across_ multiple threads?

if they do and the file descriptor they'll be spending a lot of time mallocing 
and freeing new pollfd ufds arrays in each thread as a result as they all fight 
for ownership of the pollObject's ufds.

--
Added file: 
http://bugs.python.org/file27964/issue8865-poll-multithread-gps01.diff

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



[issue16444] Use support.TESTFN_UNDECODABLE on UNIX

2012-11-11 Thread STINNER Victor

STINNER Victor added the comment:

 TESTFN_UNDECODABLE is not detected for cp1250, cp1251, cp1252, cp1254, cp1257 
 and cp1258.

The Python encoding and the real codec used by Windows are different: Python 
fails to decode bytes 0x80-0x9f, but Windows does decode them. I prefer to 
avoid these bytes to not rely too much on the Python codec.

--

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



[issue8865] select.poll is not thread safe

2012-11-11 Thread Gregory P. Smith

Gregory P. Smith added the comment:

our patches are similar.  i updated it to use long long and Py_ssize_t and 
Py_CLEAR and Py_RETURN_NONE in a few places and added comments.

getting rid of the CLEAR_UFDS macro as you did is a good idea.

--

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



[issue11981] dupe self.fp.tell() in zipfile.ZipFile.writestr

2012-11-11 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

LGTM.

--
stage:  - commit review
versions: +Python 3.4

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



[issue16444] Use support.TESTFN_UNDECODABLE on UNIX

2012-11-11 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

These encodings used not only on Windows.

--

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



[issue8865] select.poll is not thread safe

2012-11-11 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 it strikes me that this should not be a very common problem.  how many 
 applications are going to share the same poll object _across_ multiple 
 threads?

Indeed that doesn't sound very likely. How about raising an error on concurrent 
modification, instead of trying to make it thread-safe?

--

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



[issue16455] sys.getfilesystemencoding() is not the locale encoding on FreeBSD and OpenSolaris when the locale is not set

2012-11-11 Thread STINNER Victor

New submission from STINNER Victor:

On FreeBSD and OpenIndiana, sys.getfilesystemencoding() is 'ascii' when the 
locale is not set, whereas the locale encoding is ISO-8859-1.

This inconsistency causes different issue. For example, 
os.fsencode(sys.argv[1]) fails if the argument is not ASCII because sys.argv 
are decoded from the locale encoding (by _Py_char2wchar()).

sys.getfilesystemencoding() is 'ascii' because nl_langinfo(CODESET) is used to 
to get the locale encoding and nl_langinfo(CODESET) announces ASCII (or an 
alias of this encoding).

Python should detect this case and set sys.getfilesystemencoding() to 
'iso8859-1' if the locale encoding is 'iso8859-1' whereas nl_langinfo(CODESET) 
announces ASCII. We can for example decode b'\xe9' with mbstowcs() and check if 
it fails or if the result is U+00E9.

--
components: Unicode
messages: 175401
nosy: ezio.melotti, haypo
priority: normal
severity: normal
status: open
title: sys.getfilesystemencoding() is not the locale encoding on FreeBSD and 
OpenSolaris when the locale is not set
versions: Python 3.4

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



[issue16444] Use support.TESTFN_UNDECODABLE on UNIX

2012-11-11 Thread STINNER Victor

STINNER Victor added the comment:

 I suppose you noticed you broke a bunch of buildbots :)

Failures occur on FreeBSD, OpenIndiana and some other buildbots which don't set 
a locale and so use the C locale. main() decodes command line arguments from 
the locale encoding using _Py_char2wchar(). On these OSes, the C locale uses 
the ISO-8859-1 encoding, but the problem is that nl_langinfo(CODESET) announces 
ASCII :-/ test_cmd_line.test_undecodable_code() handles this case. Extract of a 
comment:

# _Py_char2wchar() decoded b'\xff' as '\xff' even if the locale is  
# C and the locale encoding is ASCII. It occurs on FreeBSD, Solaris 
# and Mac OS X. 

Mac OS X is now using UTF-8 to decode the command line arguments.

I just created the issue #16455 to fix FreeBSD and OpenIndiana.

I propose to close this issue because I consider it as fixed (#16455 will 
reenable TESTFN_UNDECODABLE in test_cmd_line_script).

--

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



[issue15667] PEP 3121, 384 refactoring applied to pickle module

2012-11-11 Thread Andreas Stührk

Andreas Stührk added the comment:

See also issue #11349.

--
nosy: +Trundle

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



[issue16456] UnicodeDecodeError thrown for 'encode' operation on string

2012-11-11 Thread Wojtek Szymilowski

New submission from Wojtek Szymilowski:

UnicodeDecodeError exception is reported for encode operation on strings.
This issue does not surface for the same operation on unicode string 
(UnicodeEncodeError exception is correctly reported).

 string:
 'AB\xff'.encode('ascii')

Traceback (most recent call last):
  File pyshell#27, line 1, in module
'AB\xff'.encode('ascii')
UnicodeDecodeError: 'ascii' codec can't decode byte 0xff in position 2: ordinal 
not in range(128)

 unicode string:
 u'AB\xff'.encode('ascii')

Traceback (most recent call last):
  File pyshell#28, line 1, in module
u'AB\xff'.encode('ascii')
UnicodeEncodeError: 'ascii' codec can't encode character u'\xff' in position 2: 
ordinal not in range(128)

--
components: Unicode
messages: 175404
nosy: Wojtek.Szymilowski, ezio.melotti
priority: normal
severity: normal
status: open
title: UnicodeDecodeError thrown for 'encode' operation on string
type: behavior
versions: Python 2.7

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



[issue16454] Mostly for discussion: _winapi as builtin for bootstrapping distutils.

2012-11-11 Thread Richard Oudkerk

Richard Oudkerk added the comment:

The patch does not apply correctly against vanilla Python 3.3.  I would guess 
that you are using a version of Python which has been patched to add mingw 
support.  Where did you get it from?

(In vanilla Python 3.3, setup.py does not contain any mention of _winapi.c.)

--

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



[issue16444] Use support.TESTFN_UNDECODABLE on UNIX

2012-11-11 Thread STINNER Victor

STINNER Victor added the comment:

 These encodings used not only on Windows.

You can uses cpXXX encodings explictly to read or write a file, but these 
encodings are not used for sys.getfilesystemencoding() (or sys.stdout.encoding).

--

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



[issue16454] Mostly for discussion: _winapi as builtin for bootstrapping distutils.

2012-11-11 Thread Ray Donnelly

Ray Donnelly added the comment:

I should have checked the situation better, it is indeed towards the back end 
of a series of patches to enable MinGW compilation, so the issue is irrelevant 
without the preceding patches.

Sorry for the noise.

--
resolution:  - invalid

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



[issue16455] sys.getfilesystemencoding() is not the locale encoding on FreeBSD and OpenSolaris when the locale is not set

2012-11-11 Thread STINNER Victor

STINNER Victor added the comment:

Attached patch works around the CODESET issue on OpenIndiana and FreeBSD. If 
the LC_CTYPE locale is C and nl_langinfo(CODESET) returns ASCII (or an alias 
of this encoding), b\xE9 is decoded from the locale encoding: if the result 
is U+00E9, the patch Python uses ISO-8859-1. (If decoding fails, the locale 
encoding is really ASCII, the workaround is not used.)

If the result is different (b'\xe9' is not decoded from the locale encoding to 
U+00E9), a ValueError is raised. I wrote this test to detect bugs. I hope that 
our buildbots will validate the code. We may choose a different behaviour (ex: 
keep ASCII).

Example on FreeBSD 8.2, original Python 3.4:

$ ./python
 import sys, locale
 sys.getfilesystemencoding()
'ascii'
 locale.getpreferredencoding()
'US-ASCII'

Example on FreeBSD 8.2, patched Python 3.4:

$ ./python 
 import sys, locale
 sys.getfilesystemencoding()
'iso8859-1'
 locale.getpreferredencoding()
'iso8859-1'

--
keywords: +patch
Added file: http://bugs.python.org/file27965/workaround_codeset.patch

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



[issue8865] select.poll is not thread safe

2012-11-11 Thread Christian Schubert

Christian Schubert added the comment:

 How about raising an error on concurrent modification, instead of trying to 
 make it thread-safe?

That's totally fine with me.

--

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




[issue16455] sys.getfilesystemencoding() is not the locale encoding on FreeBSD and OpenSolaris when the locale is not set

2012-11-11 Thread STINNER Victor

STINNER Victor added the comment:

Some tests are failing with the patch:

==
FAIL: test_undecodable_env (test.test_subprocess.POSIXProcessTestCase)
--
Traceback (most recent call last):
  File /usr/home/haypo/prog/python/default/Lib/test/test_subprocess.py, line 
1606, in test_undecodable_env
self.assertEqual(stdout.decode('ascii'), ascii(value))
AssertionError: 'abc\\xff' != 'abc\\udcff'
- 'abc\xff'
?  ^
+ 'abc\udcff'
?  ^^^

==
FAIL: test_strcoll_with_diacritic (test.test_locale.TestEnUSCollation)
--
Traceback (most recent call last):
  File /usr/home/haypo/prog/python/default/Lib/test/test_locale.py, line 364, 
in test_strcoll_with_diacritic
self.assertLess(locale.strcoll('\xe0', 'b'), 0)
AssertionError: 126 not less than 0

==
FAIL: test_strxfrm_with_diacritic (test.test_locale.TestEnUSCollation)
--
Traceback (most recent call last):
  File /usr/home/haypo/prog/python/default/Lib/test/test_locale.py, line 367, 
in test_strxfrm_with_diacritic
self.assertLess(locale.strxfrm('\xe0'), locale.strxfrm('b'))
AssertionError: '\xe0' not less than 'b'

--

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



[issue16456] UnicodeDecodeError thrown for 'encode' operation on string

2012-11-11 Thread STINNER Victor

STINNER Victor added the comment:

'AB\xff'.encode('ascii') raises a UnicodeDecodeError because the byte string 
'AB\xff' is decoded from the default encoding (sys.getdefaultencoding(), which 
is 'ASCII' in most cases), before  the .encode() method is called.

This is not a Python bug, but it is surprising. You should try Python 3 which 
does not have implicit conversion from/to bytes/unicode.

--
nosy: +haypo
resolution:  - invalid
status: open - closed

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



  1   2   >