[issue1520662] support all of strftime(3)

2010-07-15 Thread Alexander Belopolsky

Changes by Alexander Belopolsky :


--
status: pending -> closed

___
Python tracker 

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



[issue9205] Parent process hanging in multiprocessing if children terminate unexpectedly

2010-07-15 Thread Ask Solem

Ask Solem  added the comment:

Greg,

> Before I forget, looks like we also need to deal with the
> result from a worker being un-unpickleable:

This is what my patch in bug 9244 does...

> Yep.  Again, as things stand, once you've lost an worker,
> you've lost a task, and you can't really do much about it.
> I guess that depends on your application though... is your
> use-case such that you can lose a task without it mattering?
> If tasks are idempotent, one could have the task handler
> resubmit them, etc..  But really, thinking about the failure
> modes I've seen (OOM kills/user-initiated interrupt) I'm not
> sure under what circumstances I'd like the pool to try to
> recover.

Losing a task is not fun, but there may still be other tasks
running that are just as important. I think you're thinking
from a map_async perspective here.

user-initiated interrupts, this is very important to recover from,
think of some badly written library code suddenly raising SystemExit,
this shouldn't terminate other jobs, and it's probably easy to recover from, so 
why shouldn't it try?

> The idea of recording the mapping of tasks -> workers
> seems interesting. Getting all of the corner cases could
> be hard (e.g. making removing a task from the queue and
> recording which worker did the removing atomic, detecting if the worker 
> crashed while still holding the queue lock) and doing
> this would require extra mechanism.  This feature does seem
> to be useful for pools running many different jobs, because
> that way a crashed worker need only terminate one job.

I think I may have an alternative solution. Instead of keeping track of what 
the workers are doing, we could simply change the result handler
so it gives up when there are no more alive processes.

while state != TERMINATE:
result = get(timeout=1)
if all_processes_dead():
break;

--

___
Python tracker 

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



[issue9164] 2.7 sysconfig should handle arch duplicates while building universal on OS X

2010-07-15 Thread Ronald Oussoren

Ronald Oussoren  added the comment:

Thanks for investigation why MacPorts can use duplicate flags.

My patch is in the repository and will be in the next releases of all 4 
actively maintained branches.

--
status: pending -> closed

___
Python tracker 

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



[issue1724366] cPickle module doesn't work with universal line endings

2010-07-15 Thread Ronald Oussoren

Ronald Oussoren  added the comment:

Antoine, to answer your question about universal newlines in pickle in 
msg87622. The pickle.py docsstrings in 2.7+ contain the following text (amongst 
others): 

The optional protocol argument tells the pickler to use the
given protocol; supported protocols are 0, 1, 2.  The default
protocol is 0, to be backwards compatible.  (Protocol 0 is the
only protocol that can be written to a file opened in text
mode and read back successfully.  When using a protocol higher
than 0, make sure the file is opened in binary mode, both when
pickling and unpickling.)

This clearly indicates that protocol 0 is supposed to compatible with text-mode 
files. That would mean this issue probably is not invalid, the documentation 
above implies that a pickle file written in text mode on Windows should be 
readable on a Unix system.

That said, I'd advise anyone to use the highest possible protocol because 
higher protocol levels are more efficient and better support newstyle classes.

--
status: pending -> open

___
Python tracker 

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



[issue9260] A finer grained import lock

2010-07-15 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> Graham Dumpleton  added the comment:
> 
> How is this going to deal with cyclical imports where different
> threads could import at the same time different modules within that
> cycle? I need to look through the proposed patch and work out exactly
> what it does, but am concerned about whether this approach would cause
> the classic deadlock problem if not done right?

You're right, I hadn't thought about that. Additional machinery will be
needed to detect potential deadlocks (and break them).

--

___
Python tracker 

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



[issue9260] A finer grained import lock

2010-07-15 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> That's my point; loaders are using the lock implicitly so that's why
> we don't need to worry about the global import lock just for path
> hooks. It seems like you are suggesting using the global import lock
> purely for compatibility, and what I am saying is that loaders don't
> care so there is no compatibility to care about. I say only use the
> global import lock for serializing creation.

What is your take on the threadimp2.patch in issue9251?

--

___
Python tracker 

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



[issue9110] contextlib.ContextDecorator

2010-07-15 Thread Nick Coghlan

Nick Coghlan  added the comment:

Bumping back to open until the documentation is tweaked.

--
components: +Documentation -Library (Lib)
status: closed -> open

___
Python tracker 

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



[issue9110] contextlib.ContextDecorator

2010-07-15 Thread Éric Araujo

Changes by Éric Araujo :


--
nosy: +d...@python
stage: committed/rejected -> needs patch

___
Python tracker 

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



[issue9265] Can't choose other shell in subprocess

2010-07-15 Thread Éric Araujo

Éric Araujo  added the comment:

Thank you for the report. The docs indeed say “If shell=True, the executable 
argument specifies which shell to use”.

Could you provide your change as a diff file following the guidelines on 
http://www.python.org/dev/patches/ ? Diffs are easier to review than whole 
files. A unit test is needed too, to make sure the bug is fixed, would you like 
to write a patch for test_subprocess.py?

Thanks again!

--
nosy: +merwok
resolution:  -> accepted
stage:  -> unit test needed
title: Can't choose other shell in subprocess module. Includes fix. -> Can't 
choose other shell in subprocess
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



[issue9265] Can't choose other shell in subprocess

2010-07-15 Thread Stefan Krah

Stefan Krah  added the comment:

I think this is invalid. Please run:

>>> from subprocess import Popen
>>> Popen("echo $SHELL", executable="/bin/bash", shell=True)
/bin/bash

>>>

--
nosy: +skrah

___
Python tracker 

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



[issue9265] Can't choose other shell in subprocess

2010-07-15 Thread Eric Smith

Changes by Eric Smith :


--
nosy: +eric.smith

___
Python tracker 

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



[issue9265] Can't choose other shell in subprocess

2010-07-15 Thread Éric Araujo

Éric Araujo  added the comment:

The SHELL variable is not to be trusted, since e.g. dash (my system’s /bin/sh) 
in a bash will have SHELL=bash. I tested this command: "help set >/dev/null && 
echo ok". Bash prints ok but dash gives an error. This test worked for versions 
2.4 up to 3.2.

Narnie, perhaps you have a /bin/sh configuration problem?

Is there a test for this in test_subprocess? If not, we should add one.

--

___
Python tracker 

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



[issue9266] ctypes "ValueError: NULL pointer access" on Win7 x64

2010-07-15 Thread Greg Hazel

New submission from Greg Hazel :

ctypes on Windows on a 64bit Python installation gets a NULL pointer access 
where one is not expected.

To reproduce the problem, run make.bat then "python ctypes_test.py"


Failure output looks like this:

Three! 1 2 <__main__.LP_Some object at 0x0209C4C8>
<__main__.Some object at 0x0209C548>
91
Four! 1 2 3 <__main__.LP_Some object at 0x0209C4C8>
Traceback (most recent call last):
  File "_ctypes/callbacks.c", line 291, in 'calling callback function'
  File "ctypes_test.py", line 21, in fourprinter
print(to.contents)
ValueError: NULL pointer access


Otherwise, successful output looks something like:

Three! 1 2 
<__main__.Some object at 0x2acc9482ae50>
91
Four! 1 2 3 
<__main__.Some object at 0x2acc9482ae50>
91



Environments exhibiting this problem:

Python 2.7 (r27:82525, Jul  4 2010, 07:43:08) [MSC v.1500 64 bit (AMD64)] on 
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import platform
>>> platform.architecture()
('64bit', 'WindowsPE')

Python 3.1.2 (r312:79149, Mar 20 2010, 22:55:39) [MSC v.1500 64 bit (AMD64)] on 
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import platform
>>> platform.architecture()
('64bit', 'WindowsPE')


Environments NOT exhibiting the problem:

Python 2.4.3 (#1, Sep  3 2009, 15:37:37)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-46)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import platform
>>> platform.architecture()
('64bit', 'ELF')

Also Windows on a 32bit architecture seems unaffected.

--
assignee: theller
components: ctypes
files: ctypes_test.zip
messages: 110362
nosy: ghazel, theller
priority: normal
severity: normal
status: open
title: ctypes "ValueError: NULL pointer access" on Win7 x64
type: crash
versions: Python 2.7, Python 3.1
Added file: http://bugs.python.org/file18012/ctypes_test.zip

___
Python tracker 

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



[issue9265] Can't choose other shell in subprocess

2010-07-15 Thread R. David Murray

R. David Murray  added the comment:

>From looking at the code, it appears that what happens currently is that 
>executable is used to run /bin/sh when shell=True.  So I'm pretty sure there 
>is a bug here.  What isn't clear is whether or not fixing this bug will cause 
>currently working code to break (that is, we may not be able to backport the 
>fix.)

The patch as given in the message has at minimum some formatting problems, but 
in any case is not complete.  Later logic in the subprocess code uses 
'executable' to run the 'args' string, which means that with this fix you'd be 
using executable to execute executable.  This might be benign in most cases, 
but it is certainly wrong and could lead to subtle bugs.

There should also be some doc updates as the current docs implicitly assume 
that '/bin/sh' is the shell when discussing shell=True cases.  This assumption 
should be made explicit.

--
nosy: +r.david.murray

___
Python tracker 

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



[issue9265] Can't choose other shell in subprocess

2010-07-15 Thread Stefan Krah

Stefan Krah  added the comment:

Isn't just the name of the executable wrong? /bin/bash is
executed all right, but the name is set to "/bin/sh".



Index: Lib/subprocess.py
===
--- Lib/subprocess.py   (revision 82816)
+++ Lib/subprocess.py   (working copy)
@@ -1091,6 +1091,8 @@
 
 if shell:
 args = ["/bin/sh", "-c"] + args
+if executable:
+args[0] = executable



In general though, I'd prefer to specify another shell by shell="bin/bash".

--

___
Python tracker 

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



[issue9265] Incorrect name passed as arg[0] when shell=True and executable specified

2010-07-15 Thread R. David Murray

R. David Murray  added the comment:

Stephan: that might be a cleaner API, rather than overloading the semantics of 
'executable'.  But that would be a separate feature request.

I see what you are saying about "just the name".  I misread Éric's message as 
saying he'd confirmed the bug, but I guess he's saying he confirmed that it 
works as documented.

It does look like subprocess lacks a test for this case.

--
title: Can't choose other shell in subprocess -> Incorrect name passed as 
arg[0] when shell=True and executable specified

___
Python tracker 

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



[issue9205] Parent process hanging in multiprocessing if children terminate unexpectedly

2010-07-15 Thread Ask Solem

Ask Solem  added the comment:

Ok. I implemented my suggestions in the patch attached
(multiprocessing-tr...@82502-termination2.patch)
What do you think?

Greg, Maybe we could keep the behavior in termination.patch as an option for 
map jobs? It is certainly a problem that map jobs won't terminate until the 
pool is joined.

--
Added file: 
http://bugs.python.org/file18013/multiprocessing-tr...@82502-termination2.patch

___
Python tracker 

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



[issue9249] struct.pack and Long Integer datatype should be 4, but is 8 bytes

2010-07-15 Thread hannes reuter

hannes reuter  added the comment:

Hi Mark,

If you would add a footnote to the L/l formats table and mention what
you wrote, it would make things clearer. Something along the lines
like that I reformulated from your explanation:

On most common platforms the 'l' and 'L' codes are the only ones
likely to differ due to formating differences between Native and
Little are. The Size for 'l' and 'L' on a typical 64-bit Unix-alike
platform will be 8 for 'l' and 'L'; on 64-bit Windows and most 32-bit
platforms, it's 4.   This is due to the fact that in Native mode
native size, native byteorder and alignment will be set, while with a
Little endian formating standard size, little-endian, no alignment
will be set.
<<

Cheers Hannes

On 7/14/10, Mark Dickinson  wrote:
>
> Mark Dickinson  added the comment:
>
>> However, as my system is a little endian one(e.g.
>> sys.byteorder=little), whats the difference between native and little
>
> Native mode uses:  native size, native byteorder and alignment that
>   matches your platform
> Little endian: standard size, little-endian, no alignment
>
> The *native* size means the size of the corresponding C type (e.g., as
> computed by sizeof) on your platform.  So on a typical 64-bit Unix-alike
> platform, that's 8 for 'l' and 'L'; on 64-bit Windows and most 32-bit
> platforms, it's 4 for 'l' and 'L'.
>
> The *standard* size is as given by the table.  It's the same on all
> platforms.
>
> It's true that on most common platforms the 'l' and 'L' codes are the only
> ones likely to differ.
>
>> b) Where could I look up/find such a native format table ?
> Why not just use struct.calcsize?
>
> This is all explained in the docs;  I'm going to close this issue, since I
> don't think there's any discrepancy between the docs and the behaviour of
> the module.
>
> However, if you have ideas for specific improvements to the documentation,
> please do open another issue.
>
> --
> status: open -> closed
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue9244] multiprocessing.pool: Worker crashes if result can't be encoded

2010-07-15 Thread Ask Solem

Ask Solem  added the comment:

Updated patch with Greg's suggestions.
(multiprocessing-tr...@82502-handle_worker_encoding_errors2.patch)

--
Added file: 
http://bugs.python.org/file18014/multiprocessing-tr...@82502-handle_worker_encoding_errors2.patch

___
Python tracker 

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



[issue9205] Parent process hanging in multiprocessing if children terminate unexpectedly

2010-07-15 Thread Greg Brockman

Greg Brockman  added the comment:

>> Before I forget, looks like we also need to deal with the
>> result from a worker being un-unpickleable:
>This is what my patch in bug 9244 does...
Really?  I could be misremembering, but I believe you deal with the case of the 
result being unpickleable.  I.e. you deal with the put(result) failing, but not 
the get() in the result handler.  Does my sample program work with your patch 
applied?

> while state != TERMINATE:
>  result = get(timeout=1)
>  if all_processes_dead():
>  break;
Will this sort of approach work with the supervisor, which continually respawns 
workers?

> user-initiated interrupts, this is very important to recover from,
> think of some badly written library code suddenly raising SystemExit,
> this shouldn't terminate other jobs, and it's probably easy to 
> recover from, so why shouldn't it try?
To be clear, in this case I was thinking of KeyboardInterrupts.

I'll take a look at your patch in a bit.  From our differing use-cases, I do 
think it could make sense as a configuration option, but where it probably 
belongs is on the wait() call of ApplyResult.

--

___
Python tracker 

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



[issue9205] Parent process hanging in multiprocessing if children terminate unexpectedly

2010-07-15 Thread Ask Solem

Changes by Ask Solem :


Removed file: 
http://bugs.python.org/file18013/multiprocessing-tr...@82502-termination2.patch

___
Python tracker 

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



[issue9205] Parent process hanging in multiprocessing if children terminate unexpectedly

2010-07-15 Thread Ask Solem

Ask Solem  added the comment:

Just some small cosmetic changes to the patch.
(added multiprocessing-tr...@82502-termination3.patch)

--
Added file: 
http://bugs.python.org/file18015/multiprocessing-tr...@82502-termination3.patch

___
Python tracker 

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



[issue9265] Incorrect name passed as arg[0] when shell=True and executable specified

2010-07-15 Thread Stefan Krah

Stefan Krah  added the comment:

Here's a patch with a test case. Without the fix in subprocess.py,
the test prints:

==
FAIL: test_specific_shell (__main__.POSIXProcessTestCase)
--
Traceback (most recent call last):
  File "Lib/test/test_subprocess.py", line 650, in test_specific_shell
self.assertEqual(p.stdout.read().strip(), sh)
AssertionError: '/bin/sh' != '/bin/bash'


I think trying bash and ksh is sufficient; "echo $0" works for both
(for csh it does not). David, does the patch look good?




Éric, I'm by no means a tracker expert, so I wonder why you set the
resolution to 'accepted' at such an early stage. Does 'accepted' mean
'This is a valid report.' or does it mean 'I think the patch is correct.'?

--
keywords: +needs review
stage: unit test needed -> patch review

___
Python tracker 

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



[issue9265] Incorrect name passed as arg[0] when shell=True and executable specified

2010-07-15 Thread Stefan Krah

Changes by Stefan Krah :


--
keywords: +patch
Added file: http://bugs.python.org/file18016/issue9265.patch

___
Python tracker 

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



[issue9265] Incorrect name passed as arg[0] when shell=True and executable specified

2010-07-15 Thread R. David Murray

R. David Murray  added the comment:

The test unfortunately is too fragile.  There is no guarantee that those shells 
will exist with those paths on any given system.  Maybe you could use 'which' 
to find the path to the alternate shell for use in the test, and skip it if you 
can't find said shell.[*]  I don't think there's a need to test more than one 
alternate shell.

Does this combo (executable + shell=True) have a meaning on Windows?

[*] or make issue 444582 a dependency for this bug :)

--
nosy: +brian.curtin

___
Python tracker 

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



[issue1724366] cPickle module doesn't work with universal line endings

2010-07-15 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

> The pickle.py docsstrings in 2.7+ contain the following text
> (amongst others): 
>
>   .. Protocol 0 is the
>   only protocol that can be written to a file opened in text
>   mode and read back successfully.

Hmm, indeed.  The ReST documentation also has the following note:

"""
Note: Be sure to always open pickle files created with protocols >= 1 in binary 
mode. For the old ASCII-based pickle protocol 0 you can use either text mode or 
binary mode as long as you stay consistent.
"""

but as Gabriel mentioned above, this should be qualified by at least adding 
unless pickle contains unicode strings with embedded '\r' on platforms that use 
'\r' as a part of its end of line sequence.

I don't think changing the way unicode is pickled is an option.  Fixing this 
aspect of cPickle to behave more like pickle.py given the number of other 
differences does not look like a good use of developer's time.

I think this is the case were existing behavior should just be better 
documented.  See also issue616013.

--
assignee: belopolsky -> 
components: +Documentation
dependencies: +cPickle documentation incomplete
resolution: invalid -> 
versions: +Python 2.7 -Python 2.6

___
Python tracker 

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



[issue9264] trace.py documentation is incomplete

2010-07-15 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

I am reviewing doc + patch against the code. Do not commit yet.

--
assignee: d...@python -> tjreedy
stage:  -> patch review

___
Python tracker 

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



[issue9265] Incorrect name passed as arg[0] when shell=True and executable specified

2010-07-15 Thread Éric Araujo

Éric Araujo  added the comment:

David: My message was ambiguous. Your second reading was correct :)

Stefan: $0 works with dash too (no reason why it should not, but I still tested 
:). “Accepted” means “valid bug report”; to say that the patch is good people 
use a message or commit directly.

--

___
Python tracker 

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



[issue1448060] gettext.py breaks on plural-forms header (PATCH)

2010-07-15 Thread Mark Lawrence

Mark Lawrence  added the comment:

I'm closing this as a duplicate of 1475523 as the latter has a unit test patch 
file attached, I'll also merge the nosy lists.

--
nosy: +BreamoreBoy
resolution:  -> duplicate
status: open -> closed

___
Python tracker 

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



[issue9265] Incorrect name passed as arg[0] when shell=True and executable specified

2010-07-15 Thread Stefan Krah

Stefan Krah  added the comment:

Hm, /bin/sh should actually be removed from the list. It might be a
symlink to csh, for example.

I know this isn't an exhaustive test. If /bin/bash or /bin/ksh don't
exist, the test is skipped. I thought this is good enough, since the
majority of systems have one of those, so the test is guaranteed to
fail on one of the buildbots should the changes to subprocess.py be
removed in the future.

If a system only has /bin/csh, I wouldn't know how to write the test.

--

___
Python tracker 

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



[issue1448060] gettext.py breaks on plural-forms header (PATCH)

2010-07-15 Thread Éric Araujo

Changes by Éric Araujo :


--
superseder:  -> patch fixing #1448060 (gettext.py bug)

___
Python tracker 

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



[issue7384] curses crash on FreeBSD

2010-07-15 Thread Arfrever Frehtes Taifersar Arahesis

Arfrever Frehtes Taifersar Arahesis  added the comment:

This patch allows to build Python 3.* in this locale.

It might be safer to open tmpfile in binary mode to avoid potential problems 
with non-ASCII characters in paths to libraries.

--

___
Python tracker 

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



[issue9260] A finer grained import lock

2010-07-15 Thread Brett Cannon

Brett Cannon  added the comment:

I'll have a look when I can (hopefully EuroPython).

--

___
Python tracker 

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



[issue1475523] gettext breaks on plural-forms header

2010-07-15 Thread Éric Araujo

Changes by Éric Araujo :


--
resolution:  -> accepted
title: patch fixing #1448060 (gettext.py bug) -> gettext breaks on plural-forms 
header
versions: +Python 2.7, Python 3.2

___
Python tracker 

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



[issue1475523] gettext breaks on plural-forms header

2010-07-15 Thread Éric Araujo

Changes by Éric Araujo :


--
nosy: +merwok

___
Python tracker 

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



[issue9265] Incorrect name passed as arg[0] when shell=True and executable specified

2010-07-15 Thread R. David Murray

R. David Murray  added the comment:

Ah, I misread the test the first time.

Well, I'd prefer a test that always did a real test on posix, but I suppose 
this has to be good enough since there could be systems that Python otherwise 
supports that *only* have /bin/sh.  Actually I suppose one could create a local 
symlink to /bin/sh and call through that...but I don't think this issue 
warrants going to any more effort, so I think the patch is fine as is.

You could argue that /bin/sh is good to have in the list since it makes sure 
that arg[0] doesn't get changed inappropriately in the default case.  I'd be 
more comfortable if the test generated a skip message if the only one of the 
shells that is found is /bin/sh, but I'm not going to insist on it.  (This will 
be true, for example, on FreeBSD (at least on 6, which is the install I can 
easily check...maybe you could add /usr/local/bin/bash as one of your 
candidates?  Most FreeBSDs will end up having that one installed, though not of 
course all of them).

I vote we don't worry about the csh only case :)

--

___
Python tracker 

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



[issue9028] test_support.run_unittest cmdline options and arguments

2010-07-15 Thread anatoly techtonik

anatoly techtonik  added the comment:

Cool, unittest.main() worked for me, but I still lack the introspection to see 
what tests are available inside the file. Would there be any objections against 
quickly adding -l, --list option to expose the result of test discovery as it 
works now?

What are requirements for the old test_support.run_unittest code to reach 
unittest compatibility? Can't you just deprecate test_support.run_unittest() so 
maintainers get signal to upgrade their tests suite? Then the upgrade happen 
faster.


P.S. I do not need many plugin use cases right now. The test suite tools are 
often separated into three components - test discovery, test runner and test 
formatting, but that's all.

--

___
Python tracker 

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



[issue9028] test_support.run_unittest cmdline options and arguments

2010-07-15 Thread anatoly techtonik

anatoly techtonik  added the comment:

s/need/have/

--

___
Python tracker 

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



[issue5180] 3.1 cannot unpickle 2.7-created pickle

2010-07-15 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

Antoine,

I think I have found a better solution.  Since we are dealing with classic 
classes, they should not define __new__.  If in porting to 3.x, users introduce 
__new__ that requires arguments, they will not be able to unpickle 2.x pickles 
no matter what we do.

Therefore, I propose to replace _EmptyClass trick in pickle.py with a call to 
klass.__new__:

-value = _EmptyClass()
-value.__class__ = klass
+value = klass.__new__(klass)

and do the same in _pickle.c's instantiate:

r = PyObject_CallMethod(cls, "__new__", "O", cls);

Note that I am not even calling tp_new here directly, so all the hoops in 
tp_new_wrapper get jumped through.

The advantage of this scheme is that python and C code will work exactly the 
same and users that have corner cases for which the scheme does not work will 
be able to figure out what is going on by looking at the python code.

Attaching issue5180a.diff

--
Added file: http://bugs.python.org/file18017/issue5180a.diff

___
Python tracker 

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



[issue9267] Update pickle opcode documentation in pickletools for 3.x

2010-07-15 Thread Alexander Belopolsky

New submission from Alexander Belopolsky :

Pickle opcode documentation in pickletools still refers to old/new style 
classes and changes made in 2.x series.  Opcodes such as INT, INST, and OBJ 
that are no longer produced by 3.x pickling code should be described as such 
and discussion added on how 2.x features that are removed in 3.x are emulated 
when 2.x pickles are loaded in 3.x.

See also issue5180.

--
assignee: belopolsky
components: Documentation
keywords: easy
messages: 110384
nosy: belopolsky
priority: normal
severity: normal
stage: needs patch
status: open
title: Update pickle opcode documentation in pickletools for 3.x
type: feature request
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



[issue9267] Update pickle opcode documentation in pickletools for 3.x

2010-07-15 Thread Alexander Belopolsky

Changes by Alexander Belopolsky :


--
dependencies: +3.1 cannot unpickle 2.7-created pickle
nosy: +alexandre.vassalotti, lemburg, mark.dickinson, pitrou

___
Python tracker 

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



[issue3163] module struct support for ssize_t and size_t

2010-07-15 Thread Jean Brouwers

Changes by Jean Brouwers :


Removed file: http://bugs.python.org/file18006/unnamed

___
Python tracker 

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



[issue3163] module struct support for ssize_t and size_t

2010-07-15 Thread Jean Brouwers

Jean Brouwers  added the comment:

It would be sufficient to support size_t/ssize_t in native mode for my usage.  
The workaround I have been using is in this recipe

  

in the function calcsize.  That maps the 'z' and 'Z' format to either 'l', 'L' 
or 'P' for lack of anything better.

--

___
Python tracker 

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



[issue9205] Parent process hanging in multiprocessing if children terminate unexpectedly

2010-07-15 Thread Ask Solem

Ask Solem  added the comment:

> Really?  I could be misremembering, but I believe you deal
> with the case of the result being unpickleable.  I.e. you
> deal with the put(result) failing, but not the get() in the
> result handler. 

Your example is demonstrating the pickle error on put(), not on get().

> Does my sample program work with your patch applied?

Yeah, check this out:

/opt/devel/Python/trunk(master)$> patch -p1 < 
multiprocessing-tr...@82502-handle_worker_encoding_errors2.patch 
patching file Lib/multiprocessing/pool.py
patching file Lib/test/test_multiprocessing.py
/opt/devel/Python/trunk(master)$> ./python.exe  
Python 2.7 (unknown, Jul 13 2010, 13:28:35) 
[GCC 4.2.1 (Apple Inc. build 5659)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import multiprocessing
>>> def foo():
... return lambda: 42
... 
>>> p = multiprocessing.Pool(2)
>>> p.apply_async(foo).get()
Traceback (most recent call last):
  File "", line 1, in 
  File "/opt/devel/Python/trunk/Lib/multiprocessing/pool.py", line 518, in get
raise self._value
multiprocessing.pool.MaybeEncodingError: Error sending result: ' at 0x1005477d0>'. Reason: 'Can't pickle : attribute 
lookup __builtin__.function failed'
>>> import operator
>>> p.apply_async(operator.add, (2, 2)).get()
4

> To be clear, in this case I was thinking of KeyboardInterrupts.

In termination2.patch I handle BaseExceptions, by exiting the worker process, 
and then letting the _worker_handler replace the process.

It's very useful, because then people can kill -INT the worker process
if they want to cancel the job, and without breaking other jobs running.

> From our differing use-cases, I do think it could make sense as
> a configuration option, but where it probably belongs is on the
> wait() call of ApplyResult.

Indeed! This could be done by adding listeners for this type of errors.

pool.add_worker_missing_callback(fun)

So MapResults could install a callback like this:

   def __init__():
...
_pool.add_worker_missing_callback(self._on_worker_missing)
...

   def _on_worker_missing(self):
   err = WorkerLostError(
   "Worker lost while running map job")
   self._set(None, (False, err))
   
What do you think about that?

IMHO, even though the worker lost could be unrelated to the map job in
question, it would still be a better alternative than crashing the whole pool.

--

___
Python tracker 

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



[issue9205] Parent process hanging in multiprocessing if children terminate unexpectedly

2010-07-15 Thread Greg Brockman

Greg Brockman  added the comment:

Actually, the program you demonstrate is nonequivalent to the one I posted.  
The one I posted pickles just fine because 'bar' is a global name, but doesn't 
unpickle because it doesn't exist in the parent's namespace.  (See 
http://docs.python.org/library/pickle.html#what-can-be-pickled-and-unpickled.)  
Although, if you're able to run my test program verbatim, then it's entirely 
possible I'm just missing something.

Anyway, I do think that adding a 'worker_missing_callback' could work.  You'd 
still have to make sure the ApplyResult (or MapResult) can crash the pool if it 
deems necessary though.

--

___
Python tracker 

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



[issue9268] Add annotation option to pickletools.dis

2010-07-15 Thread Alexander Belopolsky

New submission from Alexander Belopolsky :

Example:

>>> dis(pickle.dumps(T, 3), annotate=1) 
>>> 
>>> 
0: \x80 PROTO  3 | Protocol version indicator.  


2: ]EMPTY_LIST   | Push an empty list.  


3: qBINPUT 0 | Store the stack top into the memo.  The stack is not 
popped. 

5: hBINGET 0 | Read an object from the memo and push it on the 
stack.  
 
7: \x85 TUPLE1   | One-tuple.   


8: qBINPUT 1 | Store the stack top into the memo.  The stack is not 
popped. 

   10: aAPPEND   | Append an object to a list.  


   11: 0POP  | Discard the top stack item, shrinking the stack by 
one item.   
  
   12: hBINGET 1 | Read an object from the memo and push it on the 
stack.  
 
   14: .STOP | Stop the unpickling machine.

--
assignee: belopolsky
files: pickletools-annotate.diff
keywords: easy, patch
messages: 110388
nosy: alexandre.vassalotti, belopolsky, lemburg, mark.dickinson, pitrou
priority: normal
severity: normal
stage: unit test needed
status: open
title: Add annotation option to pickletools.dis
type: feature request
versions: Python 3.2
Added file: http://bugs.python.org/file18018/pickletools-annotate.diff

___
Python tracker 

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



[issue1475523] gettext breaks on plural-forms header

2010-07-15 Thread Mark Lawrence

Mark Lawrence  added the comment:

Attached patch is my take on the fix to this, it's a two line change to 
gettext.py for 2.7.  If the change is accepted I'll provide another patch for 
py3k.  Nosy list updated while I'm at it.

--
nosy: +BreamoreBoy, dsegan, potorange -merwok
versions:  -Python 2.6
Added file: http://bugs.python.org/file18019/gettext.diff

___
Python tracker 

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



[issue1581183] pickle protocol 2 failure on int subclass

2010-07-15 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

I am going to close this as a duplicate of issue 1062277.  The later has a 
patch, but Raymond questioned whether proposed feature is desirable. [msg47268] 
 I am -1, but will look at the patch there.

--
nosy: +rhettinger
resolution:  -> duplicate
status: open -> pending
superseder:  -> Pickle breakage with reduction of recursive structures

___
Python tracker 

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



[issue900092] hotshot.stats.load fails with AssertionError

2010-07-15 Thread Mark Lawrence

Mark Lawrence  added the comment:

Is it worth leaving this open, given this from section 26.5 of the 2.7 docs.  
"For common usage it is recommended to use cProfile instead. hotshot is not 
maintained and might be removed from the standard library in the future."

--
nosy: +BreamoreBoy

___
Python tracker 

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



[issue991266] Cookie.py does not correctly quote Morsels

2010-07-15 Thread Mark Lawrence

Mark Lawrence  added the comment:

Can someone please take a look at this Cookie.py two line patch.

--
nosy: +BreamoreBoy

___
Python tracker 

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



[issue9236] Invalid reads in fastsearch.h

2010-07-15 Thread Stefan Krah

Changes by Stefan Krah :


--
resolution:  -> duplicate
stage:  -> committed/rejected
status: open -> closed
superseder:  -> Stringlib fastsearch can read beyond the front of an array

___
Python tracker 

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



[issue991266] Cookie.py does not correctly quote Morsels

2010-07-15 Thread Mark Lawrence

Changes by Mark Lawrence :


--
versions: +Python 2.7, Python 3.1, Python 3.2 -Python 2.6

___
Python tracker 

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



[issue8530] Stringlib fastsearch can read beyond the front of an array

2010-07-15 Thread Stefan Krah

Changes by Stefan Krah :


--
nosy: +skrah

___
Python tracker 

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



[issue5404] Cross-compiling Python

2010-07-15 Thread Mark Lawrence

Mark Lawrence  added the comment:

I understand that cross-compilation is not supported so this must now be aimed 
at 3.2.

--
nosy: +BreamoreBoy
versions: +Python 3.2 -Python 2.5

___
Python tracker 

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



[issue1597850] Cross compiling patches for MINGW

2010-07-15 Thread Mark Lawrence

Mark Lawrence  added the comment:

I understand that cross-compilation is not supported so this must now be aimed 
at 3.2.

--
nosy: +BreamoreBoy
versions: +Python 3.2 -Python 2.6

___
Python tracker 

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



[issue1006238] cross compile patch

2010-07-15 Thread Mark Lawrence

Mark Lawrence  added the comment:

As a cross compile patch and being a feature request this must target 3.2.

--
nosy: +BreamoreBoy
versions: +Python 3.2 -Python 2.7

___
Python tracker 

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



[issue1475523] gettext breaks on plural-forms header

2010-07-15 Thread Mark Lawrence

Mark Lawrence  added the comment:

Sorry, forgot to say that the patched code passed all tests in the patched unit 
test file.

--

___
Python tracker 

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



[issue9269] Cannot pickle self-referencing sets

2010-07-15 Thread Alexander Belopolsky

New submission from Alexander Belopolsky :

Attached script, cycle.py demonstrates a simplification of the behavior 
reported by mike bayer in msg77200.

Essentially, the script attempts to pickle a set that contains a class instance 
that has an attribute referring back to the set:

class C:
pass
c = C()
cycle = set([c])
c.foo = cycle

An attempt to pickle the *cycle* object triggers an assertion error in 2.7 or 
in 3.2 with disabled _pickle acceleration and produces a broken cycle in 3.2 or 
if cPickle is used instead of pickle in 2.7.

$ python3 cycle.py
FAIILURE
..

$ python2 cycle.py
Traceback (most recent call last):
  ..
  File ".../pickle.py", line 244, in memoize
assert id(obj) not in self.memo
AssertionError

If you run cycle.py with an argument, it uses a dict instead of set to create 
the cycle and shows that the cycles with dict can be pickled correctly:

$ python3 cycle.py dict
SUCCESS
..

After reporting success or failure, cycle.py, prints a disassembly of the 
pickle stream which makes it clear what happens:

In case of dict, we see the following:

$ python3 cycle.py dict
SUCCESS
 ..
2: }EMPTY_DICT
3: qBINPUT 0
 ..
   26: XBINUNICODE 'foo'
..
   36: hBINGET 0
   38: sSETITEM
..
   40: NNONE
   41: sSETITEM

An empty dict is created and saved in the memo.  Then a C object is built with 
foo attribute is set to the dict retrieved from the memo. Finally, the same 
dict is updated with (C object, None) key-value pair.  The result is the cycle 
identical to the one we built in python code.

The sets, however, are built differently.  There is no pickle opcode to add 
items to a set, so all set items must exist by the time set is built.  So here 
is what we see:  

$ python3 cycle.py
FAIILURE
2: cGLOBAL 'builtins set'
   16: qBINPUT 0
.. instead of empty set the constructor is saved in memo
   42: XBINUNICODE 'foo'
   52: hBINGET 0
..
   63: RREDUCE
.. a set object containing c is constructed 
   66: sSETITEM  
.. and assigned to c.foo
   72: RREDUCE
.. another set object is constructed containing c
 
As a result, we have

cycle = {c}
c.foo = {c}

Instead of 

c.foo = cycle

--
assignee: belopolsky
components: Interpreter Core
files: cycle.py
messages: 110397
nosy: belopolsky
priority: normal
severity: normal
stage: needs patch
status: open
title: Cannot pickle self-referencing sets
type: behavior
versions: Python 2.7, Python 3.2
Added file: http://bugs.python.org/file18020/cycle.py

___
Python tracker 

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



[issue1043706] External storage protocol for large email messages

2010-07-15 Thread Mark Lawrence

Mark Lawrence  added the comment:

The patch if fairly small and if accepted could be implemented quite easily 
despite its age as the code doesn't appear to have changed much in the interim.

--
nosy: +BreamoreBoy
versions: +Python 3.2 -Python 2.7

___
Python tracker 

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



[issue9269] Cannot pickle self-referencing sets

2010-07-15 Thread Alexander Belopolsky

Changes by Alexander Belopolsky :


--
nosy: +alexandre.vassalotti, grubert, rhettinger, schmir, zzzeek

___
Python tracker 

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



[issue9269] Cannot pickle self-referencing sets

2010-07-15 Thread Alexander Belopolsky

Changes by Alexander Belopolsky :


Added file: http://bugs.python.org/file18021/cycle.py

___
Python tracker 

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



[issue9269] Cannot pickle self-referencing sets

2010-07-15 Thread Alexander Belopolsky

Changes by Alexander Belopolsky :


Removed file: http://bugs.python.org/file18020/cycle.py

___
Python tracker 

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



[issue9205] Parent process hanging in multiprocessing if children terminate unexpectedly

2010-07-15 Thread Greg Brockman

Greg Brockman  added the comment:

Started looking at your patch.  It seems to behave reasonably, although it 
still doesn't catch all of the failure cases.  In particular, as you note, 
crashed jobs won't be noticed until the pool shuts down... but if you make a 
blocking call such as in the following program, you'll get a hang:
"""
#!/usr/bin/env python
import multiprocessing, os, signal
def foo(x):
  os.kill(os.getpid(), signal.SIGKILL)
multiprocessing.Pool(1).apply(foo, [1])
"""

The tests also occasionally hang in e.g.
test_job_killed_by_signal (__main__.WithProcessesTestPoolSupervisor) ...

--

___
Python tracker 

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



[issue998998] pickle bug - recursively memoizing class?

2010-07-15 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

There are two issues here.  The original issue is a duplicate of #1062277.  The 
other issue is specific to cycles containing a set. [msg77200]

I am opening a separate issue for that. See #9269.

--
resolution:  -> duplicate
status: open -> pending
superseder:  -> Cannot pickle self-referencing sets

___
Python tracker 

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



[issue9120] Reduce pickle size for an empty set

2010-07-15 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

Chances are we will need to add protocol support for sets.  See issue9269.

--

___
Python tracker 

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



[issue9269] Cannot pickle self-referencing sets

2010-07-15 Thread Éric Araujo

Changes by Éric Araujo :


--
nosy: +merwok

___
Python tracker 

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



[issue9269] Cannot pickle self-referencing sets

2010-07-15 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

I am reclassifying this as an RFE because as a bug, this is a duplicate of 
issue1062277.  The later contains an excellent description of the problem by 
Dima Dorfman:

 Our pickle implementations don't check for reduce
 cycles. This is somewhat cosmetic except that stack
 overflow protection is imperfect (for cPickle), causing
 crashes, and some kinds of cycles trigger asserts (in
 pickle).  [msg47267]

This is undeniably a bug and the solution offered in issue1062277 is quite 
reasonable: detect reduce cycles and bail out with an informative message.  
This will not solve the problem of pickling self-referencing sets, but at least 
once documented can be defended as expected behavior.

What remains after issue1062277 is a feature request to allow pickling of 
self-referencing sets.  I would argue that this is really a pathological case.  
Sets are not supposed to contain mutable items and immutable objects cannot 
create reference cycles among themselves.

The test case in cycle.py tricks set into accepting mutable objects by creating 
a class with default __hash__.  This falls into a category of "don't do it".

I am lowering the priority and adding #1062277 as a dependency.  Once #1062277 
is fixed, I would not mind closing this as "won't fix".

--
dependencies: +Pickle breakage with reduction of recursive structures
priority: normal -> low
type: behavior -> feature request

___
Python tracker 

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



[issue9269] Cannot pickle self-referencing sets

2010-07-15 Thread mike bayer

mike bayer  added the comment:

where is it defined that sets are not "supposed" to contain mutable items?   
such a requirement vastly limits the usefulness of sets.

Consider that relational database rows are mutable.  A result set containing 
multiple rows which each have a primary key comprises a set, hashed on primary 
key.  But other attributes of each row can be updated.   Surely this is not 
controversial ?  What Python data structure should I (and a whole bunch of 
Python ORMs) be using to represent mutable, relational database rows, unordered 
and unique on primary key, in memory ?

--

___
Python tracker 

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



[issue7991] test_ntpath fails on Windows XP

2010-07-15 Thread Austin English

Austin English  added the comment:

Runs fine in 3.1.2 on that machine.

--
status: open -> closed

___
Python tracker 

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



[issue7991] test_ntpath fails on Windows XP

2010-07-15 Thread Austin English

Austin English  added the comment:

Runs fine in 3.1.2 on that machine.

--

___
Python tracker 

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



[issue7645] test_distutils fails on Windows XP

2010-07-15 Thread Austin English

Austin English  added the comment:

Still present in 3.1.2.

--
Added file: http://bugs.python.org/file18022/distutils.txt

___
Python tracker 

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



[issue9269] Cannot pickle self-referencing sets

2010-07-15 Thread Jack Diederich

Jack Diederich  added the comment:

Mike, it is better to think of database rows as immutable tuples.  During the 
course of a query the contents of the database are considered static - hence 
all that locking and kvetching about this or that database not having "true" 
foreign key support.  If database rows were mutable the results of a JOIN could 
be nonsensical.

--
nosy: +jackdied

___
Python tracker 

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



[issue9269] Cannot pickle self-referencing sets

2010-07-15 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

On Thu, Jul 15, 2010 at 8:26 PM, mike bayer  wrote:
..
> where is it defined that sets are not "supposed" to contain mutable items?   
> such a requirement vastly limits the usefulness of sets.
>

Well, there is no such requirement. The actual requirement is that
they should be hashable.  For built-in types, however hashable is the
same as immutable.  Arguably, user-defined classes should emulate
that.

> Consider that relational database rows are mutable.  A result set containing 
> multiple rows which each have a primary key comprises a set, hashed on 
> primary key.  But other attributes of each row can be updated.   Surely this 
> is not controversial ?  What Python data structure should I (and a whole 
> bunch of Python ORMs) be using to represent mutable, relational database 
> rows, unordered and unique on primary key, in memory ?

Why wouldn't you represent a result set as a dict mapping primary key
(tuple) to list of column values?

--

___
Python tracker 

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



[issue9269] Cannot pickle self-referencing sets

2010-07-15 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

On Thu, Jul 15, 2010 at 8:52 PM, Jack Diederich  wrote:
..
>   If database rows were mutable the results of a JOIN could be nonsensical.

And if your result set is self-referential you have a bigger problem
on your hands than not being able to pickle it. :-)

--

___
Python tracker 

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



[issue9269] Cannot pickle self-referencing sets

2010-07-15 Thread mike bayer

mike bayer  added the comment:

OK, more specifically, here's the kind of situation where items in a set are 
mutable:

company = Session.query(Company).first()

# company.employees is a set()
company.employees

# each employee references the parent company
for e in company.employees:
assert e.company is company

So nothing is mutated relationally in this case.   It's just a plain old 
bidirectional structure.If two objects are related via many-to-many, then 
you might have a set in both directions.   I'm not sure if this specific 
situation produces the pickle bug, however, it's been awhile since I've seen 
which specific case causes the problem.   But there are mutable items in a set 
in these examples and it doesn't seem unreasonable to me.

--

___
Python tracker 

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



[issue9270] distutils.util.getplatform and sysconfig.getplatform differ

2010-07-15 Thread bugs-pyt...@vendor.thewrittenword.com

New submission from bugs-pyt...@vendor.thewrittenword.com 
:

We had issues building python 2.7 on hppa-hp-hpux machines because sysconfig 
and distutils had different ideas of the platform name.

./python -c 'import os, sys; from distutils.util import get_platform as plat1; 
from sysconfig import get_platform as plat2; print plat1();print plat2()'
hp-ux-B.11.11-9000_785
hp-ux-B.11.11-9000-785

Notice that one has an underscore, the other a dash.

Either the code is sysconfig or distutils needs to change slightly so that they 
match.
e.g.
Index: Lib/sysconfig.py
===
--- Lib/sysconfig.py.orig   2010-05-19 22:20:14.0 +
+++ Lib/sysconfig.py2010-07-16 02:52:39.385322407 +
@@ -569,3 +569,3 @@
 machine = machine.replace(' ', '_')
-machine = machine.replace('/', '-')
+machine = machine.replace('/', '_')

--
assignee: tarek
components: Distutils
messages: 110411
nosy: bugs-pyt...@vendor.thewrittenword.com, tarek
priority: normal
severity: normal
status: open
title: distutils.util.getplatform and sysconfig.getplatform differ
type: compile error
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



[issue9266] ctypes "ValueError: NULL pointer access" on Win7 x64

2010-07-15 Thread Greg Hazel

Changes by Greg Hazel :


Removed file: http://bugs.python.org/file18012/ctypes_test.zip

___
Python tracker 

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



[issue9266] ctypes "ValueError: NULL pointer access" on Win7 x64

2010-07-15 Thread Greg Hazel

Greg Hazel  added the comment:

Ok, this issue is worse, and much easier to reproduce, than I thought. Here is 
an updated ctypes_test.zip with a repro using only integers and callbacks.

Correct output:
('three', (1, 2, 3))
('four', (1, 2, 3, 4))
('five', (1, 2, 3, 4, 5))

Incorrect output:
('three', (1, 2, 3))
('four', (1, 2, 3, 0))
('five', (1, 2, 3, 0, 5))

I built Python 2.7 from source with MSVC 9. This is not reproducible in Debug 
mode, or Win32 Release mode. It only happens in x64 Release mode. 

One very interesting discovery is that if I set these options:

Optimization: Disabled (/Od)
Enable Instrinsic Functions: No

the error does not occur!

--
Added file: http://bugs.python.org/file18023/ctypes_test.zip

___
Python tracker 

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



[issue1475523] gettext breaks on plural-forms header

2010-07-15 Thread Senthil Kumaran

Senthil Kumaran  added the comment:

Minor change request. 

+class Bug1448060(GettextBaseTest):

Can you name the test class something more meaningful like PluralFormsTest or 
something like that. It is helpful when looking at it later. (Btw, this can be 
done by the committer during checkin too)

--
nosy: +orsenthil

___
Python tracker 

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



[issue9271] Python throws `IOError: [Errno 27] File too large' on long file names

2010-07-15 Thread Jason Gross

New submission from Jason Gross :

On attempting to open files with sufficiently long file names, python throws 
IOError: [Errno 27] File too large.  This is misleading, and perhaps should be 
relabeled as 'File name too long.'

I have only tested this on unix with Python 2.5.2.  This error was thrown when 
I opened 
/afs/athena.mit.edu/user/j/g/jgross/web_scripts/alphabets/results/turk/armenian_01_A3NOO9K3CY1YU5.cstroke
 for writing.

--
components: IO
messages: 110414
nosy: Jason.Gross
priority: normal
severity: normal
status: open
title: Python throws `IOError: [Errno 27] File too large' on long file names
type: behavior
versions: Python 2.5

___
Python tracker 

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



[issue9073] Tkinter module missing from install on OS X 10.6.4

2010-07-15 Thread Ned Deily

Ned Deily  added the comment:

The Python 2 Tkinter has been renamed to tkinter in Python 3 and the lib-tk no 
longer exists.  See http://docs.python.org/py3k/library/tkinter.html

--
assignee:  -> ronaldoussoren
components: +Macintosh
nosy: +ned.deily, ronaldoussoren

___
Python tracker 

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



[issue7645] test_distutils fails on Windows XP

2010-07-15 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

It's just a data file missing from the .msi installer.

--
nosy: +amaury.forgeotdarc

___
Python tracker 

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