[issue10684] Folders get deleted when trying to change case with shutil.move (case insensitive file systems only)

2011-01-25 Thread Nadeem Vawda

Nadeem Vawda nadeem.va...@gmail.com added the comment:

 BTW,what is the best way to check for case insensitive file-system?
 The test here merely checks if sys.platform returns mac, darwin or win32.
I would suggest not checking at all. If the system is case-sensitive, the test 
will pass, so it doesn't really make a difference. You could write a small 
function that creates a dummy file and then tries to access it via a case 
variant of its name, but that seems unnecessary.

 You can't solve this by trying to do different things on different
 operating systems. This bug depends on file system properties, not OS.
It's worth pointing out that it depends on both the FS *and* OS. For example, 
an NTFS filesystem is case-insensitive under Windows, but case-sensitive under 
Linux. This has caused me headaches in the past.

 I still think the best avenue would be to first try straight os.rename,
 and if that fails (maybe only if target exists), the logic
 that is currently in shutil.move.
I agree. If os.rename() succeeds, there is no need to copy the file and then 
delete the original. If it fails because the two paths are on different 
devices, the existing code can safely be used without any further checks. I'm 
not sure if there are any other failure cases that would need to be handled, 
though.

--
nosy: +nvawda

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



[issue9124] Mailbox module should use binary I/O, not text I/O

2011-01-25 Thread Steffen Daode Nurpmeso

Steffen Daode Nurpmeso sdao...@googlemail.com added the comment:

Re-New to Python - Re-Started with Py3K in 2011.
'Found myself in a dead-end after 10 days of work because a KOI8-R spam mail 
causes the file I/O decoding process to fail -
and there is NO WAY TO HANDLE THIS with mailbox.py!
(Went to python.org, searched for mailbox.py, was redirected to Google and 
found NOTHING related to this problem.
FINALLY found the IssueTracker but was too stupid to re-search.
Well.  Put an issue 10995 which was wrong - unfortunate.)

But now I will spend this entire day to back-port my script to Python 2.7 (and 
i did not work with Python for some six years)!

I mean - the plan to rewrite the entire mailbox.py exists for about six months 
now, but mailbox.py is included in the basic library, documented in the library 
book - but not a single word, not a single comment states that it is in fact 
*UNUSABLE* in Py3K!

Wouldn't it be sufficient *in the meanwhile* to apply the 10-minutes-work patch 
mentioned in my issue 10995?
I know it's almost as wrong, but it would gracefully integrate in my 
fetchmail(1)/mutt(1) local en_GB.UTF-8 stuff 8-}.
Python 3.2 is about to be released in two weeks - shall this unusable module be 
included the very same way once again?
Thanks for reading this book.

--
nosy: +sdaoden

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



[issue11003] os.system should be deprecated in favour of subprocess module

2011-01-25 Thread Jakob Bowyer

New submission from Jakob Bowyer jkb...@gmail.com:

os.system is broken in several fundamental ways. We already have the subprocess 
module for accessing other processes, lets send os.system the same way as 
os.Popen.

--
components: Library (Lib)
messages: 126995
nosy: Jakob.Bowyer
priority: normal
severity: normal
status: open
title: os.system should be deprecated in favour of subprocess module
type: feature request
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3

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



[issue9509] argparse FileType raises ugly exception for missing file

2011-01-25 Thread SilentGhost

SilentGhost ghost@gmail.com added the comment:

Steven, I'm wondering why do you raise ArgumentTypeError there? From reading 
doc strings of the relevant errors, it seems obvious to me that it should be 
ArgumentError. Argument is being used there, there's no conversion occurring 
anywhere.

--

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



[issue10976] json.loads() throws TypeError on bytes object

2011-01-25 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

anthony: this is python3-only problem.

--

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



[issue10882] Add os.sendfile()

2011-01-25 Thread Giampaolo Rodola'

Giampaolo Rodola' g.rod...@gmail.com added the comment:

Please note that on FreeBSD things work a little bit differently for 
non-blocking sockets:
http://www.freebsd.org/cgi/man.cgi?query=sendfilesektion=2

In details I'm talking about:

 When using a socket marked for non-blocking I/O, sendfile() may send
 fewer bytes than requested.  In this case, the number of bytes 
 success-fully written is returned in *sbytes (if specified), and the 
 error EAGAIN is returned.

...and the similar note about EBUSY, later in the page.
Something like this should work:


ret = sendfile(in, out, offset, sbytes, sf, flags);

...

if (ret == -1) {
if ((errno == EAGAIN) || (errno == EBUSY)) {
return Py_BuildValue(ll, sbytes, offset + sbytes);
} 
return posix_error();
}

--

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



[issue9124] Mailbox module should use binary I/O, not text I/O

2011-01-25 Thread Antoine Pitrou

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


--
priority: high - critical
versions: +Python 3.3

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



[issue11002] 'Upload' link on Files page is broken

2011-01-25 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

This bug tracker is used for Python only.  Problems with PyPI should be 
directed to catalog-...@python.org.  Thanks.

--
assignee: docs@python - 
components:  -Documentation
nosy: +eric.araujo -docs@python
resolution:  - invalid
stage:  - committed/rejected
status: open - closed

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



[issue10973] OS X 10.6 IDLE, tkinter: Cocoa Tk 8.5 crash when composite character typed in text field

2011-01-25 Thread Ronald Oussoren

Ronald Oussoren ronaldousso...@mac.com added the comment:

Michael: Why must the subprocess started by IDLE be in 32-bit mode if we'd run 
IDLE in 32-bit mode?  AFAIK there is no technical reason to do so.

Not that running IDLE in 32-bit mode is an option, it wouldn't fix the issue by 
itself unless we'd link Tkinter to Tk 8.4 and that would make it impossible to 
use Tkinter in 64-bit mode at all.

BTW. I'm -1 on using the X11 version of Tk, that would make IDLE look even less 
like a real Mac application. It would also require additional work to ensure 
that IDLE.app keeps working as expected.

--

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



[issue11004] AssertionError on collections.deque().count(1)

2011-01-25 Thread STINNER Victor

New submission from STINNER Victor victor.stin...@haypocalc.com:

Attached script, bug.py, ends with:

$ python3.2 source2.py 
deque.remove(x): x not in deque
python: ./Modules/_collectionsmodule.c:536: deque_count: Assertion 
`leftblock-rightlink != ((void *)0)' failed.
Abandon (core dumped)

--
components: Library (Lib)
files: bug.py
messages: 127001
nosy: haypo
priority: normal
severity: normal
status: open
title: AssertionError on collections.deque().count(1)
type: crash
versions: Python 3.2
Added file: http://bugs.python.org/file20512/bug.py

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



[issue9124] Mailbox module should use binary I/O, not text I/O

2011-01-25 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

I'm afraid so.  The python3 uptake process was expected to take five years 
overall, and we are only up to about the second year at this point.  So while 
you may have been away from Python for 6 years, you came back right in the 
middle of an unprecedented transition period.

I agree that it is unfortunate that a shipping library is not functioning 
correctly with respect to the Python3 bytes/string separation, but no one had 
tried to use mailbox in python3 enough to have encountered this problem.  You 
will note that that this bug report was a *performance* bug report initially, 
and as such had lower priority.  The encoding issue was recognized much more 
recently.  And before that could be fixed correctly, the email package had to 
be fixed to handle bytes input.  That happened only just before the end of the 
beta phase for 3.2.  Now it is too late to make further API changes for 3.3, 
and in any case it seems counter-productive to make an API change that we don't 
really want in the library long term.

You could work up a patch to fix this, use it locally, and contribute it so 
that it makes it in to 3.3.  Perhaps if you and/or someone else can come up 
with a patch before RC2 it could even go in to 3.2.  I haven't looked at it 
(yet), but I'm hoping that the patch isn't actually that hard to fix the 
encoding issues (as opposed to the performance issue, which may take more work).

Or perhaps you could monkey-patch in your encoding fix until 3.3 comes out.  Of 
course, right now using 2.7 with an eye to staying compatible with python3 is 
also a perfectly sensible option.

--

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



[issue10973] OS X 10.6 IDLE, tkinter: Cocoa Tk 8.5 crash when composite character typed in text field

2011-01-25 Thread Michael Foord

Michael Foord mich...@voidspace.org.uk added the comment:

Ronald: The subprocess also uses Tkinter (right?) so would also require 32bit. 

FWIW I'm -1 on X11 as well.

--

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



[issue11005] Assertion error on RLock._acquire_restore

2011-01-25 Thread STINNER Victor

New submission from STINNER Victor victor.stin...@haypocalc.com:

Attached script (bug2.py) ends with:

$ ~/prog/SVN/py3k/python bug2.py
 
python: ./Modules/_threadmodule.c:399: rlock_acquire_restore: Assertion 
`self-rlock_count == 0' failed.
Abandon

It should raise a classic Python exception, instead of stopping with a fatal 
assertion error.

--
components: Library (Lib)
files: bug2.py
messages: 127004
nosy: haypo
priority: normal
severity: normal
status: open
title: Assertion error on RLock._acquire_restore
versions: Python 2.7, Python 3.2
Added file: http://bugs.python.org/file20513/bug2.py

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



[issue11004] AssertionError on collections.deque().count(1)

2011-01-25 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@haypocalc.com:


--
versions: +Python 2.7

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



[issue9124] Mailbox module should use binary I/O, not text I/O

2011-01-25 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

That should have been too late to make API changes for 3.2.

--

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



[issue5863] bz2.BZ2File should accept other file-like objects.

2011-01-25 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

Interesting! If you are motivated, a further approach would be to expose the 
compressor and decompressor objects from the C extension, and write the file 
object in Python (as in Lib/gzip.py).

 One thing I was unsure of is how to handle exceptions that occur in
 BZ2File_dealloc(). Does the error status need to be cleared before it
 returns?

Yes, it should. Actually, it would be better to write out the exception using 
PyErr_WriteUnraisable().

 On a related note, the 'buffering' argument to __init__() is ignored, 
 and I was wondering whether this should be documented explicitly?

Yes, it should probably be deprecated if it's not useful anymore.

By the way, the current patch produces reference leaks:

$ ./python -m test -R 3:2 test_bz2
[1/1] test_bz2
beginning 5 repetitions
12345
.
test_bz2 leaked [44, 44] references, sum=88

--
stage: needs patch - patch review

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



[issue9509] argparse FileType raises ugly exception for missing file

2011-01-25 Thread Steven Bethard

Steven Bethard steven.beth...@gmail.com added the comment:

It's an ArgumentTypeError because that's what you're supposed to raise inside 
type functions:

http://docs.python.org/dev/library/argparse.html#type

(Note that argparse.FileType.__call__ is what will be called when we pass 
type=argparse.FileType(...) to add_argument.)

The current docstring for ArgumentTypeError is correct - it says it's An error 
from trying to convert a command line string to a type and we're converting a 
file path (string) into a file object.  But I certainly wouldn't complain if 
someone wanted to make the wording there clearer. Basically the rule is:

* Use ArgumentTypeError when you're defining a type= function
* Use ArgumentError otherwise

--

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



[issue5863] bz2.BZ2File should accept other file-like objects.

2011-01-25 Thread Nadeem Vawda

Nadeem Vawda nadeem.va...@gmail.com added the comment:

 Interesting! If you are motivated, a further approach would be to expose
 the compressor and decompressor objects from the C extension, and write
 the file object in Python (as in Lib/gzip.py).
I had initially considered doing something that, but I decided not to for 
reasons that I can't quite remember. However, in hindsight it seems like it 
would have been a better approach than doing everything in C. I'll start on it 
ASAP.

 On a related note, the 'buffering' argument to __init__() is ignored, 
 and I was wondering whether this should be documented explicitly?
 Yes, it should probably be deprecated if it's not useful anymore.
How would I go about doing this? Would it be sufficient to raise a 
DeprecationWarning if the argument is provided by the caller, and add a note to 
the docstring and documentation?

--

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



[issue5863] bz2.BZ2File should accept other file-like objects.

2011-01-25 Thread Nadeem Vawda

Nadeem Vawda nadeem.va...@gmail.com added the comment:

* I had initially considered doing something *like* that

--

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



[issue5863] bz2.BZ2File should accept other file-like objects.

2011-01-25 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

 How would I go about doing this? Would it be sufficient to raise a
 DeprecationWarning if the argument is provided by the caller, and add
 a note to the docstring and documentation?

Yes, totally.

--

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



[issue11006] warnings with subprocess and pipe2

2011-01-25 Thread Antoine Pitrou

New submission from Antoine Pitrou pit...@free.fr:

Since r87651, subprocess can raise a RuntimeWarning if pipe2() fails.
I'm not sure there's any point in that, since it's very low-level and it's 
nothing the user can do about anyway.

Ironically, there is no warning if pipe2() is not available at all.

--
components: Library (Lib)
messages: 127011
nosy: georg.brandl, gregory.p.smith, pitrou
priority: normal
severity: normal
status: open
title: warnings with subprocess and pipe2
type: behavior
versions: Python 3.2

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



[issue11006] warnings with subprocess and pipe2

2011-01-25 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

This can be seen on the sparc Debian buildbot by the way:

/home/pybot/buildarea-sid/3.x.klose-debian-sparc/build/Lib/subprocess.py:1085: 
RuntimeWarning: pipe2 set errno ENOSYS; falling back to non-atomic pipe+fcntl.
  c2pread, c2pwrite = _create_pipe()
/home/pybot/buildarea-sid/3.x.klose-debian-sparc/build/Lib/subprocess.py:1144: 
RuntimeWarning: pipe2 set errno ENOSYS; falling back to non-atomic pipe+fcntl.
  errpipe_read, errpipe_write = _create_pipe()
[etc.]

http://www.python.org/dev/buildbot/all/builders/sparc%20Debian%203.x/builds/1/steps/test/logs/stdio

--

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



[issue10973] OS X 10.6 IDLE, tkinter: Cocoa Tk 8.5 crash when composite character typed in text field

2011-01-25 Thread Ronald Oussoren

Ronald Oussoren ronaldousso...@mac.com added the comment:

On 25 Jan, 2011, at 13:41, Michael Foord wrote:

 
 Michael Foord mich...@voidspace.org.uk added the comment:
 
 Ronald: The subprocess also uses Tkinter (right?) so would also require 
 32bit. 

Not AFAIK.  I'm pretty sure I've had a 3-way build in the past where IDLE ran 
as a 32-bit binary and the subprocess was 64-bit one on supported systems.

--
title: OS X 10.6 IDLE, tkinter: Cocoa Tk 8.5 crash when composite character 
typed in text   field - OS X 10.6 IDLE, tkinter: Cocoa Tk 8.5 crash when 
composite character typed in  textfield

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



[issue10973] OS X 10.6 IDLE, tkinter: Cocoa Tk 8.5 crash when composite character typed in text field

2011-01-25 Thread Michael Foord

Michael Foord mich...@voidspace.org.uk added the comment:

The reason I think it is an issue is that a previous release of Python 2.7 
could start IDLE (the initial window would appear), but a dialog would also 
appear saying that it could not connect to the subprocess and IDLE would exit. 
IDLE itself had been set to run as a 32bit process by default, but various 
people thought the issue was caused by the subprocess not being launched as 
32bit.

--

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



[issue11007] stack tracebacks should give the relevant class name

2011-01-25 Thread Joshua Blount

New submission from Joshua Blount he...@joshuablount.com:

When I get a stack traceback, it would be very handy if the traceback gave me 
the relevant class name (along with all the current information).

--
components: Interpreter Core
messages: 127015
nosy: stickwithjosh
priority: normal
severity: normal
status: open
title: stack tracebacks should give the relevant class name
type: feature request
versions: Python 2.5, Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3

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



[issue6011] python doesn't build if prefix contains non-ascii characters

2011-01-25 Thread Nils Philippsen

Nils Philippsen n...@redhat.com added the comment:

NB: it's not the shell, but the kernel which interprets the shebang line (and 
subsequently calls the shell /bin/sh with it if it's missing, causing funny 
effects when it encounters the first import line and you happen to have 
ImageMagick installed).

--

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



[issue11004] AssertionError on collections.deque().count(1)

2011-01-25 Thread Andrew Brown

Andrew Brown brow...@gmail.com added the comment:

This bug trigger can be simplified down, see my attached bug_simplified.py

The problem seems to be in deque_count(). What's happening is that after the 
rotations, the 16 items reside in the last 16 slots of one block.

In deque_count()'s for loop, the block pointer is incremented regardless of 
whether the loop has another iteration to go or not. Thus, it's trying to grab 
the (nonexistant) next block, even though the for loop would have exited 
anyways.

--
nosy: +Andrew.Brown
Added file: http://bugs.python.org/file20514/bug_simplified.py

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



[issue10994] implementation details in sys module

2011-01-25 Thread Armin Rigo

Armin Rigo ar...@users.sourceforge.net added the comment:

 The expectation is that it returns the memory footprint of the given
 object, and only it (not taking into account sharing, caching,
 dependencies or anything else).

It would be nice if this was a well-defined definition, but unfortunately it is 
not.  For example, string objects may appear different from the user's point of 
view (e.g. as seen by id() and 'is') but share the implementation's data; they 
may even share only a part of it (if ropes are enabled).  Conversely, for 
user-defined objects you would typically think not to count the shape 
information, which is usually shared among several instances -- but then you 
risk a gross under-estimation in the (rarer) cases where it is not shared.

Another way to look at the official definition is to return the size of the 
object itself and none of its dependencies, because in theory they might be 
shared; but that would make all strings, lists, tuples, dicts, and so on have a 
getsizeof() of 8 or 12, which is rather useless.

I hope this clarifies fijal's original comment: it might be not well defined 
on other implementations.

--
nosy: +arigo

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



[issue10992] tests failing when run under coverage

2011-01-25 Thread Kristian Vlaardingerbroek

Kristian Vlaardingerbroek kristian.vlaardingerbr...@gmail.com added the 
comment:

Following tests in test_descr.py fail with both methods:

test_iter_items
test_iter_keys
test_iter_values

regrtest -T causes the following test to fail aswell:

test_slots

The test_iter_* tests fail because __locals__ gets added to the namespace of 
the class it is testing when tracing is enabled.

test_slots fails on line 1031 in a section marked Test lookup leaks [SF bug 
572567]

--

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



Re: [issue10838] subprocess __all__ is incomplete

2011-01-25 Thread Senthil Kumaran
On Thu, Jan 06, 2011 at 12:15:26AM +, Antoine Pitrou wrote:
 IMO they should all be prefixed with an underscore. Greg?
 

+1 to this suggestion. It would make it consistent with expectations.
But yeah, I also think that all public methods should be in __all__ is
not a guarantee.
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10848] Move test.regrtest from getopt to argparse

2011-01-25 Thread Sandro Tosi

Sandro Tosi sandro.t...@gmail.com added the comment:

On Tue, Jan 25, 2011 at 02:20, R. David Murray rep...@bugs.python.org wrote:
 That might be handy.  I thought you were trying to roughly reproduce the 
 current help (which dumps it all out at once), which is why I suggested 
 epilog.

actually that was my objective :) but facing the impossibility to
implement it, I asked for advice; I'll go with --help with only usage
 classic options descriptions and --more-help for --help + long
options descriptions

--

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



[issue10992] tests failing when run under coverage

2011-01-25 Thread Kristian Vlaardingerbroek

Kristian Vlaardingerbroek kristian.vlaardingerbr...@gmail.com added the 
comment:

Following tests in test_descr.py fail:

test_collect_generations (line 261)
test_frame (line 183)
test_get_count (line 249)

These tests count the number of allocations and a trace function can mess this 
up.

--

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



[issue10994] implementation details in sys module

2011-01-25 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

  The expectation is that it returns the memory footprint of the given
  object, and only it (not taking into account sharing, caching,
  dependencies or anything else).
 
 It would be nice if this was a well-defined definition, but
 unfortunately it is not.

I didn't claim it was. Actually, if you read the rest of my message, I
did mention that PyPy could tweak the semantics if it made more sense.
So, of course, the more sharing and caching takes place, the less
obvious these semantics are, but even with CPython they are not obvious
anyway. It's not supposed to be an exact measurement for the common
developer, rather a hint that experts can use to tweak their data
structures and algorithms; you need to know details of your VM's
implementation to use that information.

--

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



[issue11008] logging.dictConfig not documented as new in version 2.7

2011-01-25 Thread Day Barr

New submission from Day Barr bugs.python@daybarr.com:

logging.dictConfig is new in version 2.7 but the documentation does not say 
this.

http://docs.python.org/release/2.7/library/logging.html#logging.dictConfig

c.f. NullHandler, also new in version 2.7 and explicitly documented as such:

http://docs.python.org/release/2.7/library/logging.html#nullhandler

--
assignee: docs@python
components: Documentation
messages: 127024
nosy: daybarr, docs@python
priority: normal
severity: normal
status: open
title: logging.dictConfig not documented as new in version 2.7
versions: Python 2.7

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



[issue10994] implementation details in sys module

2011-01-25 Thread Maciej Fijalkowski

Maciej Fijalkowski fij...@gmail.com added the comment:

I can hardly think about a specification that would potentially help me 
identify actual sizes. Even as a rough estimation. Which experts you had in 
mind?

--

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



[issue10994] implementation details in sys module

2011-01-25 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

 Which experts you had in mind?

People who know how the Python implementation works.

--

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



[issue10994] implementation details in sys module

2011-01-25 Thread Maciej Fijalkowski

Maciej Fijalkowski fij...@gmail.com added the comment:

  Which experts you had in mind?

 People who know how the Python implementation works.

I'm serious. What semantics would make sense to anyone? Even if you know 
implementation quite well a single number per object does not provide enough 
information.

--

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



[issue10994] implementation details in sys module

2011-01-25 Thread Brett Cannon

Brett Cannon br...@python.org added the comment:

You could return -1 for everything. =)

In all seriousness, it could simply be proportional. IMO as long as people 
realize if a list takes up less space than a dict then the numbers seem fine to 
me.

--

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



[issue10994] implementation details in sys module

2011-01-25 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

 Even if you know implementation quite well a single number per object
 does not provide enough information.

Enough information for what? It can certainly provide information about
the overhead of that particular object (again, regardless of sharing).

--

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



[issue10992] tests failing when run under coverage

2011-01-25 Thread Kristian Vlaardingerbroek

Kristian Vlaardingerbroek kristian.vlaardingerbr...@gmail.com added the 
comment:

test_metaclass has some doctests failing because of the added __locals__.

--

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



[issue10992] tests failing when run under coverage

2011-01-25 Thread Kristian Vlaardingerbroek

Kristian Vlaardingerbroek kristian.vlaardingerbr...@gmail.com added the 
comment:

msg127022 applies to test_gc and not test_descr

--

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



[issue10572] Move test sub-packages to Lib/test

2011-01-25 Thread Alexander Belopolsky

Alexander Belopolsky belopol...@users.sourceforge.net added the comment:

Changing the title to reflect broader scope of this issue.  Json tests were 
moved to Lib/test/json_tests in r86875.

--
title: Move unittest test package to Lib/test - Move test sub-packages to 
Lib/test

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



[issue11004] AssertionError on collections.deque().count(1)

2011-01-25 Thread Raymond Hettinger

Changes by Raymond Hettinger rhettin...@users.sourceforge.net:


--
assignee:  - rhettinger
nosy: +rhettinger

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



[issue11003] os.system should be deprecated in favour of subprocess module

2011-01-25 Thread Skip Montanaro

Skip Montanaro s...@pobox.com added the comment:

I disagree.  Both os.popen and os.system work fine in the proper context
and are easier to use (and remember how to use) than the subprocess
module.  You don't give any examples of breakage, or whether said
breakage is platform-dependent.

--
nosy: +skip.montanaro

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



[issue10848] Move test.regrtest from getopt to argparse

2011-01-25 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

Hmm.  Am I misunderstanding something about epilog, then?  I thought it was 
placed at the end of the other help text?

--

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



[issue11007] stack tracebacks should give the relevant class name

2011-01-25 Thread Skip Montanaro

Skip Montanaro s...@pobox.com added the comment:

Given this code:

#!/usr/bin/env python

class C:
def bomb(self):
1/0

c = C()
c.bomb()

when run it produces

Traceback (most recent call last):
  File stdin, line 8, in module
  File stdin, line 5, in bomb
ZeroDivisionError: integer division or modulo by zero

You would like bomb to be C.bomb?

--
nosy: +skip.montanaro

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



[issue9124] Mailbox module should use binary I/O, not text I/O

2011-01-25 Thread Raymond Hettinger

Raymond Hettinger rhettin...@users.sourceforge.net added the comment:

ISTM an API change is okay if it fixes a critical usability bug.

Also, if this is going to ship as-is, the docs should get a big warning right 
at the top.  Perhaps the source code should also emit a notice that the module 
is hosed so that people like Steffen don't waste tons of time on hopeless 
endeavors.

--

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



[issue11007] stack tracebacks should give the relevant class name

2011-01-25 Thread Joshua Blount

Joshua Blount he...@joshuablount.com added the comment:

Yes!

--

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



[issue10848] Move test.regrtest from getopt to argparse

2011-01-25 Thread Sandro Tosi

Sandro Tosi sandro.t...@gmail.com added the comment:

On Tue, Jan 25, 2011 at 19:29, R. David Murray rep...@bugs.python.org wrote:

 R. David Murray rdmur...@bitdance.com added the comment:

 Hmm.  Am I misunderstanding something about epilog, then?  I thought it was 
 placed at the end of the other help text?

Sorry I get confused by the assonance with epydoc (ok they are quite
fare away but still :) now I see argparse.ArgumentParser has an
'epidoc' karg that does exactly what I meant: thanks!

--

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



[issue11003] os.system should be deprecated in favour of subprocess module

2011-01-25 Thread Raymond Hettinger

Raymond Hettinger rhettin...@users.sourceforge.net added the comment:

I'm inclined to reject this out-of-hand.  The os.system() call is a basic call 
that had been around for very long time, has been widely used successfully, and 
has parallels in other languages.

Please elaborate on is broken i several fundamental ways.

--
assignee:  - rhettinger
nosy: +rhettinger
versions:  -Python 2.6, Python 2.7, Python 3.1, Python 3.2

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



[issue11007] stack tracebacks should give the relevant class name

2011-01-25 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

Well, given you have the line number at which the method is defined, it is easy 
to know which class it belongs to.

--
nosy: +pitrou

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



[issue10848] Move test.regrtest from getopt to argparse

2011-01-25 Thread Raymond Hettinger

Raymond Hettinger rhettin...@users.sourceforge.net added the comment:

ISTM that moving from argument parser to another is more likely to introduce 
bugs than to solve them.  There may be other advantages, but reducing bugginess 
isn't one of them.  Lots of scripts have used getopts successfully.

--
nosy: +rhettinger

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



[issue11007] stack tracebacks should give the relevant class name

2011-01-25 Thread Skip Montanaro

Skip Montanaro s...@pobox.com added the comment:

I'm not sure you can get there from here, certainly not in a
straightforward way.  The traceback formatter gets a reference to
the code object (traceback - frame - code).  That object has a name
attribute (which is what's displayed) but it doesn't have a reference
back to the function object.

--

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



[issue10848] Move test.regrtest from getopt to argparse

2011-01-25 Thread Brett Cannon

Brett Cannon br...@python.org added the comment:

If Sandro is willing to write test for regrtest as part of the move then that 
would be a complete net win from the current situation.

--

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



[issue11007] stack tracebacks should give the relevant class name

2011-01-25 Thread Skip Montanaro

Skip Montanaro s...@pobox.com added the comment:

I agree with Antoine, however, if you can come up with a
reasonable patch which implements the desired behavior, I
think it would be reasonable to add it to Python 3.3.  The
definition of reasonable is subject to interpretation.
As I indicated in my earlier comment, there is no straight
path from the traceback object to the surrounding class.

--

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



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

2011-01-25 Thread Matthew Barnett

Matthew Barnett pyt...@mrabarnett.plus.com added the comment:

I've reduced the size of some internal tables.

--

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



[issue11004] AssertionError on collections.deque().count(1)

2011-01-25 Thread Raymond Hettinger

Raymond Hettinger rhettin...@users.sourceforge.net added the comment:

Victor, thanks for the bug report.  Score one for fuzzing.
Andrew, thanks for the analysis and simplified crasher.
See attached patch.

--
keywords: +needs review, patch
nosy: +benjamin.peterson, georg.brandl
priority: normal - release blocker
Added file: http://bugs.python.org/file20515/deque.patch

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



[issue11009] urllib.splituser is not documented

2011-01-25 Thread anatoly techtonik

New submission from anatoly techtonik techto...@gmail.com:

I'm studying old code that uses urllib.splituser() call and can't find 
description of this function in Python 2.6.6 docs.

--
assignee: docs@python
components: Documentation
messages: 127047
nosy: docs@python, techtonik
priority: normal
severity: normal
status: open
title: urllib.splituser is not documented
versions: Python 2.6

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



[issue10990] tests mutating sys.gettrace() w/o re-instating previous state

2011-01-25 Thread Kristian Vlaardingerbroek

Kristian Vlaardingerbroek kristian.vlaardingerbr...@gmail.com added the 
comment:

test_trace can be added to this list, each call to runfunc does a sys.settrace()

121:self.tracer.runfunc(traced_func_loop, 2, 3)
133:self.tracer.runfunc(traced_func_importing, 2, 5)
145:self.tracer.runfunc(traced_func_calling_generator)
160:self.tracer.runfunc(traced_caller_list_comprehension)
183:tracer.runfunc(method, 20)
225:self.tracer.runfunc(traced_func_simple_caller, 1)
234:self.tracer.runfunc(traced_func_importing_caller, 1)
248:self.tracer.runfunc(obj.inst_method_calling, 1)
266:self.tracer.runfunc(traced_func_importing_caller, 1)

--

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



[issue10848] Move test.regrtest from getopt to argparse

2011-01-25 Thread Raymond Hettinger

Raymond Hettinger rhettin...@users.sourceforge.net added the comment:

+1

--

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



[issue5114] 2.5.4.3 and 2.6.2 / test_threading hangs on Solaris

2011-01-25 Thread Salman Ahmed

Salman Ahmed ssahmed...@gmail.com added the comment:

Yes, this problem persists on Solaris 9 (SPARC) even with Python 2.7.1.
The problematic processes are:

ssahmed@blade:[~]$ ps -ef|grep -i python
 ssahmed   480   418  0 15:30:25 pts/19:14 ./python -Wd -3 -E -tt 
./Lib/test/regrtest.py -l
 ssahmed  3062   480  0 15:43:22 pts/10:00 
/space/home/ssahmed/Python-2.7.1/python -c if 1:import sys, os, ti
 ssahmed  3063  3062  0 15:43:22 pts/10:00 
/space/home/ssahmed/Python-2.7.1/python -c if 1:import sys, os, ti

I was able to workaround the problem by killing the bottom-most process in the 
list.

--
nosy: +Salman.Ahmed

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



[issue10990] tests mutating sys.gettrace() w/o re-instating previous state

2011-01-25 Thread Brett Cannon

Brett Cannon br...@python.org added the comment:

Thanks for the diagnosis, Kristian. Attached is a patch for test_trace which 
fixes its over-zealous setting of the trace function (doesn't address the 
failures, though).

--
Added file: http://bugs.python.org/file20516/test_trace.diff

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



[issue10990] tests mutating sys.gettrace() w/o re-instating previous state

2011-01-25 Thread Brett Cannon

Brett Cannon br...@python.org added the comment:

Here is a patch for test_pdb; the context manager made this dirt-simple to fix.

--
Added file: http://bugs.python.org/file20517/test_gdb.diff

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



[issue10848] Move test.regrtest from getopt to argparse

2011-01-25 Thread Sandro Tosi

Sandro Tosi sandro.t...@gmail.com added the comment:

Sure, that would be really interesting to do, and I do commit to write
a test suite to the tool that runs the python test suite :)

What I'm asking is: how would you do that? I'm quite new as
contributor so the ideas of experienced core devs are very valuable at
this stage of the task. David proposed to write a parallel
test-directory for regrtest, would you think it's feasible to do that?
and what to put in that dir to trigger weird behaviour in regrtest?
Any other input?

--

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



[issue10848] Move test.regrtest from getopt to argparse

2011-01-25 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

Some parts of regrtest have been obsoleted by changes in unittest.  Best not to 
write tests for something that will go.

--

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



[issue11010] Unicode BOM left in loaded text

2011-01-25 Thread onpon4

New submission from onpon4 onp...@yahoo.com:

This is for Python 2.7.1. It isn't an issue on 2.6.5 and I haven't tested it on 
3.1.

Quite simply, the Unicode BOM (unichr(65279)) is included in the text loaded 
from a UTF-8 text file. This can cause issues in some cases, but is easily 
worked around by calling s.strip(unichr(65279)) on the first line of loaded 
text.

--
components: IO, Unicode
messages: 127055
nosy: onpon4
priority: normal
severity: normal
status: open
title: Unicode BOM left in loaded text
type: behavior
versions: Python 2.7

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



[issue11004] AssertionError on collections.deque().count(1)

2011-01-25 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

deque.patch: I'm unable to say if the patch is correct or not, but it is always 
a good thing to remove asser(...) :-)

--

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



[issue10990] tests mutating sys.gettrace() w/o re-instating previous state

2011-01-25 Thread Brett Cannon

Brett Cannon br...@python.org added the comment:

Patch for doctest/test_doctest (yes, both files were wiping out the trace 
function.

--
Added file: http://bugs.python.org/file20518/test_doctest.diff

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



[issue10990] tests mutating sys.gettrace() w/o re-instating previous state

2011-01-25 Thread Brett Cannon

Brett Cannon br...@python.org added the comment:

And with this patch for test_zipimport_support to work thanks to the 
test_doctest changes, all of the test suites blasting the trace function 
*should* be fixed.

--
Added file: http://bugs.python.org/file20519/test_zipimport_support.diff

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



[issue11004] AssertionError on collections.deque().count(1)

2011-01-25 Thread Raymond Hettinger

Raymond Hettinger rhettin...@users.sourceforge.net added the comment:

Fixed in r88191 and r88192.

--
resolution:  - fixed
status: open - closed

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



[issue11004] AssertionError on collections.deque().count(1)

2011-01-25 Thread Raymond Hettinger

Changes by Raymond Hettinger rhettin...@users.sourceforge.net:


--
components: +Extension Modules -Library (Lib)

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



[issue10826] pass_fds sometimes fails

2011-01-25 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

So, I added some debug info to test_pass_fds:

 -- fds that should have been closed: {5, 6, 7, 8, 9, 10, 11, 12, 13}
 -- fds that remained open: {0, 1, 2, 3, 5}
 -- debug info:
0 8194 posix.stat_result(st_mode=8592, st_ino=12582920, st_dev=82051072, 
st_nlink=1, st_uid=1140, st_gid=7, st_size=0, st_atime=1295990436, 
st_mtime=1295991135, st_ctime=1295990436)
1 2 posix.stat_result(st_mode=4096, st_ino=79119887, st_dev=84148224, 
st_nlink=0, st_uid=1140, st_gid=1, st_size=0, st_atime=1295991135, 
st_mtime=1295991135, st_ctime=1295991135)
2 8194 posix.stat_result(st_mode=8592, st_ino=12582920, st_dev=82051072, 
st_nlink=1, st_uid=1140, st_gid=7, st_size=0, st_atime=1295990436, 
st_mtime=1295991135, st_ctime=1295990436)
3 2 posix.stat_result(st_mode=4096, st_ino=79119882, st_dev=84148224, 
st_nlink=0, st_uid=1140, st_gid=1, st_size=0, st_atime=1295991135, 
st_mtime=1295991135, st_ctime=1295991135)
5 8192 posix.stat_result(st_mode=53540, st_ino=56, st_dev=84410368, st_nlink=1, 
st_uid=0, st_gid=0, st_size=0, st_atime=1269710532, st_mtime=1269710532, 
st_ctime=1269710532)
FAIL

Each line is in the following form: fd value returned by F_GETFD 
os.fstat(fd)

Here is my interpretation for fd 5 (which is the offending fd):
- a F_GETFD value of 8192 is different from both pipes (which return 2) and 
standard stdin/stderr (which return 8194); if the values haven't changed 
between Solaris versions, 8192 is O_LARGEFILE + O_RDONLY
- a st_mode of 53540 is stat.S_IFSOCK + stat.S_IFIFO + stat.S_IRUSR + 
stat.S_IRGRP + stat.S_IROTH; so this seems to be some kind of read-only 
(filesystem-based?) socket

I think it is unlikely that this socket is inherited from the parent process, 
or present before calling exec(). Instead, perhaps it's the startup of the 
child Python interpreter (after exec()) which creates such a file descriptor, 
and doesn't close it. Unfortunately, it seems difficult to diagnose this in 
more detail.

--

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



[issue10973] OS X 10.6 IDLE, tkinter: Cocoa Tk 8.5 crash when composite character typed in text field

2011-01-25 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@haypocalc.com:


--
nosy:  -haypo

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



[issue9724] help('nonlocal') missing

2011-01-25 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

Was this left out of 3.1 and 2.7 on purpose?

--
nosy: +eric.araujo

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



[issue11011] More functools functions

2011-01-25 Thread Jason Baker

New submission from Jason Baker amnorv...@gmail.com:

I've created a patch that adds some common functional programming tools to 
functools.  I've made the patch to work against Python 3.2, but that may be a 
bit aggressive.  If so, then I can adapt it to work with 3.3.

I also wouldn't be opposed to writing some of these in C if there's a 
performance need.

The functions I added are:

* flip - flip the first two arguments of a function
* const - return a function that always returns the same thing
* compose - compose multiple functions together
* identity - returns what is passed in to it
* trampoline - calls a function and then calls any returned functions.

--
components: Library (Lib)
files: functools.patch
keywords: patch
messages: 127062
nosy: Jason.Baker
priority: normal
severity: normal
status: open
title: More functools functions
versions: Python 3.2, Python 3.3
Added file: http://bugs.python.org/file20520/functools.patch

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



[issue10826] pass_fds sometimes fails

2011-01-25 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

I managed to get further debug info from the OpenIndiana buildbot:

 -- maxfd = 65536
 -- fds that should have been closed: {5, 6, 7, 8, 9, 10, 11, 12, 13}
 -- fds that remained open: {0, 1, 2, 3, 5}
 -- debug info:
0 2 posix.stat_result(st_mode=4096, st_ino=38002789, st_dev=142868480, 
st_nlink=0, st_uid=101, st_gid=101, st_size=0, st_atime=1295994652, 
st_mtime=1295994652, st_ctime=1295994652)
1 2 posix.stat_result(st_mode=4096, st_ino=38019207, st_dev=142868480, 
st_nlink=0, st_uid=101, st_gid=101, st_size=0, st_atime=1295994988, 
st_mtime=1295994988, st_ctime=1295994988)
2 2 posix.stat_result(st_mode=4096, st_ino=38002791, st_dev=142868480, 
st_nlink=0, st_uid=101, st_gid=101, st_size=0, st_atime=1295994987, 
st_mtime=1295994987, st_ctime=1295994987)
3 2 posix.stat_result(st_mode=4096, st_ino=38019202, st_dev=142868480, 
st_nlink=0, st_uid=101, st_gid=101, st_size=0, st_atime=1295994988, 
st_mtime=1295994988, st_ctime=1295994988)
5 8192 posix.stat_result(st_mode=53540, st_ino=210, st_dev=146014208, 
st_nlink=1, st_uid=0, st_gid=0, st_size=0, st_atime=1290335283, 
st_mtime=1290335283, st_ctime=1290335283)
total 2
dr-x-- 2 buildbot buildbot 528 Jan 25 22:36 .
dr-x--x--x 5 buildbot buildbot 864 Jan 25 22:36 ..
p- 0 buildbot buildbot   0 Jan 25 22:30 0
p- 0 buildbot buildbot   0 Jan 25 22:36 1
p- 0 buildbot buildbot   0 Jan 25 22:36 2
p- 0 buildbot buildbot   0 Jan 25 22:36 3
D- 1 root root   0 Nov 21 10:28 5
  File: `/proc/22816/fd/5'
  Size: 0   Blocks: 0  IO Block: 0  weird file
Device: 8b4h/146014208d Inode: 210 Links: 1
Access: (/D-)  Uid: (0/root)   Gid: (0/root)
Access: 2010-11-21 10:28:03.659679536 +
Modify: 2010-11-21 10:28:03.659679536 +
Change: 2010-11-21 10:28:03.659679536 +


So, the offending fd (5) points to a weird file (!!) created in November 
2010... It definitely can't be the same file as pointed to by fd 5 in the 
parent process, since that is a standard anonymous pipe. This reinforces the 
idea that starting up the child Python interpreter sometimes creates that fd 
and doesn't close it.

Also, while the sparc solaris buildbot doesn't have the stat command, it 
still displays the following debug output:

total 4
dr-x--   2 buildbot other528 Jan 25 23:58 .
dr-x--x--x   5 buildbot other832 Jan 25 23:58 ..
c-   1 buildbot tty   24,  2 Jan 25 23:58 0
p-   0 buildbot other  0 Jan 25 23:58 1
c-   1 buildbot tty   24,  2 Jan 25 23:58 2
p-   0 buildbot other  0 Jan 25 23:58 3
D-   1 root root   0 Mar 27  2010 5

... where fd number 5 seems to be the same kind of weird file created by root 
a long time ago. Martin, does that date (Mar 27 2010) ring a bell? Is it when 
the system was installed? When the buildslave was started?

--
nosy: +loewis

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



[issue10848] Move test.regrtest from getopt to argparse

2011-01-25 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

I would say writing tests for regrtest is going to be a somewhat tricky task.  
I think you will have to do some code tweaking to even be able to run certain 
tests.  I believe that regrtest currently has some built in assumptions about 
the test directory (ie: that it is Lib/test), even though the regrtest main 
program provides a testdir argument.  So the first task is probably going to be 
getting that argument to actually work, and then exposing a way to set it at 
the regrtest command level (or, alternatively, moving all command functionality 
out of __main__ and into main).  Once you have that, your test suite can 
programatically generate a test test-directory and populate it with whatever 
files you need for each test, using the utilities in test.script_helper.

--

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



[issue11010] Unicode BOM left in loaded text

2011-01-25 Thread Martin v . Löwis

Martin v. Löwis mar...@v.loewis.de added the comment:

Can you please be more specific? What do you mean by text loaded from a UTF-8 
text file? How specifically did you load it?

--
nosy: +loewis

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



[issue11010] Unicode BOM left in loaded text

2011-01-25 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@haypocalc.com:


--
nosy: +haypo

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



[issue11011] More functools functions

2011-01-25 Thread Raymond Hettinger

Raymond Hettinger rhettin...@users.sourceforge.net added the comment:

Some of these have been proposed and rejected before.

Compose has a problematic API because the traditional order of application in 
mathematics is counter-intuitive for many people.

Const seems reasonable except that we already have ways to do it:  
 twos = lambda :2
 twos = itertools.repeat(2).__next__
The principal use case for const is with map() and itertools.repeat() is 
already targeted at that use-case:
 cubes = list(map(pow, range(10), repeat(3)))

Flip would be nice on occasion:
 colorseq = list(map(flip, enumerate(
   'red orange yellow green blue indigo violet'.split(

Identity is problematic for a few reasons.  First, there doesn't seem to be one 
signature that fits all use cases:
 identity1 = lambda *args:  *args   # always returns a tuple
 identity2 = lambda arg:  arg   # always returns a scalar
Also, the availability of 'identity' seems to encourage bad design.
Speedwise, it is usually better to have two paths (predicate is None vs some 
given predicate) than have an identity function default (predict=identity).  
See the itertools module for examples.

Trampoline is interesting, but the use case doesn't seem to arise much in 
Python programming and when it does, it is usually clearer to write:
for f in get_actions():
f()
That straight-forward code is superior, not just because of its readability but 
also because it is easily modified to handle return values being feed in to 
consecutive calls, adding optional and keyword arguments, introducing logging, 
etc.  

In short, some of these constructs are better suited for languages that a more 
purely functional in nature.  Those don't treat scalar arguments differently 
than multiple arguments, those don't use keywords or optional arguments, 
currying can be done cleanly etc.

Experiences with the itertools module have shown than not all of the usual 
favorite functional gizmos fit well in the Python language.  They are tempting 
toys, but typically don't beat regular, clean Python code.

One last comment, any time a group of interoperative tools is proposed, I think 
it absolutely necessary to construct a bunch of sample code to exercise the 
APIs working in concert with one another.  With the itertools module, 
considerable effort was directed at designing a toolkit with cleanly 
interoperative parts.

Also, when proposing something that changes the fundamentals of how people 
would design their programs, I think it is necessary to scan real-world code to 
find many examples where the code would be much improved if it used the new 
constructs.  (This is similar to the notion of a Phase III clinical trial -- 
even if something works, it needs to be shown to be better than existing 
alternatives).

--
nosy: +rhettinger
versions:  -Python 3.2

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



[issue11011] More functools functions

2011-01-25 Thread Raymond Hettinger

Raymond Hettinger rhettin...@users.sourceforge.net added the comment:

One other thought:  The use of list comprehensions (a.k.a. list displays) and 
generator expressions has made many functional tools less necessary than ever.

   # preferred over map(pow, repeat(2), range(5))
   [pow(2, x) for x in range(5)]

   # preferred over map(flip, dict.items())
   [(v, k) for k, v in mydict.items()]

The list comprehension and genexp styles are much more flexible and works well 
with default arguments, constants, and using a combination of features:

   # hard to do with functionals
   [f(g(2,x), h(x, 3, y, flag=True)) for x, y in zip(X, Y) if xy//2]

--

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



[issue6926] socket module missing IPPROTO_IPV6, IPPROTO_IPV4

2011-01-25 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

Should this be fixed before the final release?

--
components: +Library (Lib) -IO
nosy: +eric.araujo, georg.brandl

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



[issue6926] socket module missing IPPROTO_IPV6, IPPROTO_IPV4

2011-01-25 Thread Gregory P. Smith

Gregory P. Smith g...@krypto.org added the comment:

IMNSHO it should but that would violate our release practices to do it this 
late in the cycle.  I expect the release manager to decline.

It isn't a critical issue, the end result is that people will hard code the 
constants into their own code themselves since we don't have them in the 
library yet.

--

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



[issue6926] socket module missing IPPROTO_IPV6, IPPROTO_IPV4

2011-01-25 Thread Antoine Pitrou

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


--
stage:  - needs patch
versions: +Python 3.3 -Python 3.2

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



[issue11012] Add log1p(), exp1m(), gamma(), and lgamma() to cmath

2011-01-25 Thread Raymond Hettinger

New submission from Raymond Hettinger rhettin...@users.sourceforge.net:

Where it makes sense, cmath needs to stay in-sync with the math module as much 
as possible:

   set(dir(math)) - set(dir(cmath))
  {'pow', 'fsum', 'ldexp', 'hypot', 'fabs', 'floor', 'lgamma',
   'frexp', 'degrees', 'modf', 'factorial', 'copysign', 'ceil',
   'trunc', 'expm1', 'radians', 'atan2', 'erf', 'erfc', 'fmod',
   'log1p', 'gamma'}

At some point, it may make sense to implement cmath.fsum() along the lines of:
 
 c_fsum = lambda iterable: 
   complex(*map(fsum, zip(*((z.real, z.imag) for z in iterable

--
assignee: mark.dickinson
components: Extension Modules
messages: 127070
nosy: mark.dickinson, rhettinger
priority: normal
severity: normal
stage: needs patch
status: open
title: Add log1p(), exp1m(), gamma(), and lgamma() to cmath
type: feature request
versions: Python 3.3

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



[issue6926] socket module missing IPPROTO_IPV6, IPPROTO_IPV4

2011-01-25 Thread Raymond Hettinger

Raymond Hettinger rhettin...@users.sourceforge.net added the comment:

I would consider it to be regression and bugfix that is not inappropriate to 
repair at this point.

--
nosy: +rhettinger

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



[issue6926] socket module missing IPPROTO_IPV6, IPPROTO_IPV4

2011-01-25 Thread Martin v . Löwis

Martin v. Löwis mar...@v.loewis.de added the comment:

 I would consider it to be regression and bugfix that is not inappropriate to 
 repair at this point.

I'd also be in favor of fixing it. To reduce the risk of breaking
something, I'd only raise socketmodule to a more recent Windows API.
Of course, this, in itself, might also break something.

--

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



[issue11010] Unicode BOM left in loaded text

2011-01-25 Thread onpon4

onpon4 onp...@yahoo.com added the comment:

Like this:

f = io.open()
f.readline()

--

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



[issue5863] bz2.BZ2File should accept other file-like objects.

2011-01-25 Thread Nadeem Vawda

Nadeem Vawda nadeem.va...@gmail.com added the comment:

Here is a quick-and-dirty reimplementation of BZ2File in Python, on top of the 
existing C implementation of BZ2Compressor and BZ2Decompressor.

There are a couple of issues with this code that need to be fixed:
* BZ2Decompressor doesn't signal when it reaches the EOS marker, so doesn't 
seem possible to detect a premature end-of-file. This was easy in the C 
implementation, when using bzDecompress() directly.
* The read*() methods are implemented very inefficiently. Since they have to 
deal with the bytes objects returned by BZ2Decompressor.decompress(), a large 
read results in lots of allocations that weren't necessary in the C 
implementation.

I hope to resolve both of these issues (and do a general code cleanup), by 
writing a C extension module that provides a thin wrapper around 
bzCompress()/bzDecompress(), and reimplementing the module's public interface 
in Python on top of it. This should reduce the size of the code by close to 
half, and make it easier to read and maintain. I'm not sure when I'll be able 
to get around to it, though, so I thought I should post what I've done so far.

Other changes in the patch:
* write(), writelines() and seek() now return meaningful values instead of 
None, in line with the behaviour of other file-like objects.
* Fixed a typo in test_bz2's testReadChunk10() that caused the test to pass 
regardless of whether the data read was correct (self.assertEqual(text, text) 
- self.assertEqual(text, self.TEXT)). This one might be worth committing now, 
since it isn't dependent on the rewrite.

--
Added file: http://bugs.python.org/file20521/bz2module-v2.diff

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



[issue11010] Unicode BOM left in loaded text

2011-01-25 Thread Martin v . Löwis

Martin v. Löwis mar...@v.loewis.de added the comment:

Why are you saying this isn't an issue in 2.6.5? It behaves exactly the same as 
2.7.1.

In any case, this is not a bug. Pass encoding=utf-8-sig to io.open to have 
the signature stripped when the file is read.

--
resolution:  - invalid
status: open - closed

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



[issue11011] More functools functions

2011-01-25 Thread Jason Baker

Jason Baker amnorv...@gmail.com added the comment:

Ray,  thanks for prompt and thorough feedback.  To address your concerns:

* I'm fine with doing away with const and identity (long story short I haven't 
really used them in functional languages anyway).  There were reasons for 
defining identity the way it is, but it's hardly a big deal if that doesn't 
make it in.
* Personally, I see the mathematical notation for compose to be very intuitive, 
however it's typically described in a non-intuitive manner.  The functions get 
called in a left-to-right manner (as is intuitive), however, when you see it 
defined it is usually in a right-to-left manner.  Thus it can be confusing 
because we say compose(f, g)(x) [left-to-right]  is equivalent to g(f(x)) 
[which reads right-to-left, but is still doing what you might expect 
intuitively].  But I doubt most people that use Python will care about the 
mathematical usage anyway.  What if we called  the function pipeline?  That's 
essentially what it's doing, and I think people would find that easier to 
understand.
* I'm not saying you're wrong about trampoline, but I want to make sure that 
you and I are discussing the same thing.  :-)  The idea for trampoline comes 
from clojure, which is unique among functional languages in that it has no 
tail-call recursion.  Trampoline is a way to write a function that is tail 
recursive, but won't blow the stack.  So your example, while similar isn't 
*quite* the same thing.  The documentation I wrote shows an example function 
count_to_a_million.  If I wrote it like this I'd blow the stack:

def count_to_a_million(i):
if i  100:
return count_to_a_million(i)
else:
return i

Of course, you could definitely argue that it would just be easier to use a 
loop (or even better range).  However, many functional programmers' brains have 
just been wired to use recursion which they might find more intuitive as a 
means of iteration.  Of course, one could argue that it would be better for 
them to learn the Pythonic way of doing things, and I would agree.  Python is a 
multi-paradigm language that supports both functional and imperative 
approaches, therefore it's Pythonic to provide a functional approach.
* It sounds like you feel flip is useful, but it's a matter of whether you feel 
it's useful enough to add to the standard library.

Lastly, I love list comprehensions and see where you're coming from, but why do 
the two have to be mutually exclusive?  I mean, the idea for them came from 
Haskell which hasn't done away with them.  For instance, take your example:

[f(g(2,x), h(x, 3, y, flag=True)) for x, y in zip(X, Y) if xy//2]

I certainly hope you don't really write code like that.  :-)

I think something like this is more readable:

fg = partial(compose(f, g), 2)
h1 = lambda x, y:  h(x, 3, y, flag=True)
[(fg(x), h1(x, y)) for x, y in zip(X, Y) if xy//2]

...but maybe I'm weird.

If you're still opposed to adding these functions, let me know.  I feel that 
they have use-cases in the Python standard library, but I can add them to 
pysistence when I port it to Python 3 and make it a functional data 
structure/algorithm library.  :-)

--

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



[issue10990] tests mutating sys.gettrace() w/o re-instating previous state

2011-01-25 Thread Brett Cannon

Brett Cannon br...@python.org added the comment:

I have a patch that I am testing right now which deals which fixes all the test 
suites.

--
assignee:  - brett.cannon

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




[issue9124] Mailbox module should use binary I/O, not text I/O

2011-01-25 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

mailbox.patch:
 - open files in binary mode not as text
 - parse as bytes not as Unicode
 - replace email.generator.Generator() by email.generator.BytesGenerator()
 - use .message_from_bytes() instead of .message_from_str()
 - use .message_from_binary_file() instead of .message_from_file()
 - use BytesIO() instead of StringIO()
 - add more methods to _ProxyFile: readable, writable, seekable, flush, closed
 - don't use universal newline (not supported by binary files): I don't 
remember if the email binary parser supports directly universal newline

I don't know anything about the mailbox module. I just replaced str functions 
by bytes functions.

Keep Unicode for some things: MH.get_sequence() reads the file using UTF-8 
encoding, labels and sequences.

The patch have to be tested on Windows (Windows uses \r\n newline). I only 
tested on Linux.

--
keywords: +patch
Added file: http://bugs.python.org/file20522/mailbox.patch

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



[issue9124] Mailbox module should use binary I/O, not text I/O

2011-01-25 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

While working on this issue, I found and fixed two bugs in the email binary 
parser: r88196 and r88197.

--

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



[issue11013] Build of CVS version 2.7 fails in readline

2011-01-25 Thread Geoge R. Goffe

New submission from Geoge R. Goffe grgo...@yahoo.com:

Howdy,

I just updated my copy of the SVN version of 2.7 and got the following error 
messages. Did I do something wrong?

Regards,

George...

building dbm using bdb
building 'readline' extension
gcc -pthread -fPIC -fno-strict-aliasing -g -O2 -g -O0 -Wall -Wstrict-prototypes 
-I/usr/lsd/Linux/include -I. -IInclude -I./Include -I/usr/local/include 
-I/usr/local/google/tools/python/release27-maint/Include 
-I/usr/local/google/tools/python/release27-maint -c 
/usr/local/google/tools/python/release27-maint/Modules/readline.c -o 
build/temp.linux-x86_64-2.7-pydebug/usr/local/google/tools/python/release27-maint/Modules/readline.o
/usr/local/google/tools/python/release27-maint/Modules/readline.c: In function 
‘write_history_file’:
/usr/local/google/tools/python/release27-maint/Modules/readline.c:147: warning: 
implicit declaration of function ‘history_truncate_file’
/usr/local/google/tools/python/release27-maint/Modules/readline.c: In function 
‘_py_free_history_entry’:
/usr/local/google/tools/python/release27-maint/Modules/readline.c:385: warning: 
passing argument 1 of ‘free’ discards qualifiers from pointer target type
/usr/include/stdlib.h:488: note: expected ‘void *’ but argument is of type 
‘const char *’
/usr/local/google/tools/python/release27-maint/Modules/readline.c: In function 
‘py_replace_history’:
/usr/local/google/tools/python/release27-maint/Modules/readline.c:436: warning: 
implicit declaration of function ‘replace_history_entry’
/usr/local/google/tools/python/release27-maint/Modules/readline.c:436: warning: 
assignment makes pointer from integer without a cast
/usr/local/google/tools/python/release27-maint/Modules/readline.c: In function 
‘_py_get_history_length’:
/usr/local/google/tools/python/release27-maint/Modules/readline.c:523: error: 
‘HISTORY_STATE’ undeclared (first use in this function)
/usr/local/google/tools/python/release27-maint/Modules/readline.c:523: error: 
(Each undeclared identifier is reported only once
/usr/local/google/tools/python/release27-maint/Modules/readline.c:523: error: 
for each function it appears in.)
/usr/local/google/tools/python/release27-maint/Modules/readline.c:523: error: 
‘hist_st’ undeclared (first use in this function)
/usr/local/google/tools/python/release27-maint/Modules/readline.c:523: warning: 
implicit declaration of function ‘history_get_history_state’
/usr/local/google/tools/python/release27-maint/Modules/readline.c: In function 
‘insert_text’:
/usr/local/google/tools/python/release27-maint/Modules/readline.c:628: warning: 
implicit declaration of function ‘rl_insert_text’
/usr/local/google/tools/python/release27-maint/Modules/readline.c: In function 
‘flex_complete’:
/usr/local/google/tools/python/release27-maint/Modules/readline.c:847: error: 
‘rl_completion_suppress_append’ undeclared (first use in this function)
/usr/local/google/tools/python/release27-maint/Modules/readline.c:853: warning: 
implicit declaration of function ‘rl_completion_matches’
/usr/local/google/tools/python/release27-maint/Modules/readline.c:853: error: 
‘rl_compentry_func_t’ undeclared (first use in this function)
/usr/local/google/tools/python/release27-maint/Modules/readline.c:853: error: 
expected expression before ‘)’ token
/usr/local/google/tools/python/release27-maint/Modules/readline.c: In function 
‘setup_readline’:
/usr/local/google/tools/python/release27-maint/Modules/readline.c:886: warning: 
passing argument 2 of ‘rl_bind_key_in_map’ from incompatible pointer type
/usr/lsd/Linux/include/readline/readline.h:195: note: expected ‘int (*)(const 
char *, int)’ but argument is of type ‘int (*)(int,  int)’
/usr/local/google/tools/python/release27-maint/Modules/readline.c:887: warning: 
passing argument 2 of ‘rl_bind_key_in_map’ from incompatible pointer type
/usr/lsd/Linux/include/readline/readline.h:195: note: expected ‘int (*)(const 
char *, int)’ but argument is of type ‘int (*)(int,  int)’
/usr/local/google/tools/python/release27-maint/Modules/readline.c: In function 
‘readline_until_enter_or_signal’:
/usr/local/google/tools/python/release27-maint/Modules/readline.c:940: error: 
‘rl_catch_signals’ undeclared (first use in this function)
/usr/local/google/tools/python/release27-maint/Modules/readline.c:979: warning: 
implicit declaration of function ‘rl_free_line_state’
/usr/local/google/tools/python/release27-maint/Modules/readline.c:980: warning: 
implicit declaration of function ‘rl_cleanup_after_signal’

Python build finished, but the necessary bits to build these modules were not 
found:
bsddb185   dl gdbm
imageopsunaudiodev
To find the necessary bits, look in setup.py in detect_modules() for the 
module's name.


Failed to build these modules:
readline

--
components: Build
messages: 127080
nosy: grgo...@yahoo.com
priority: normal
severity: normal
status: open
title: Build of CVS version 2.7 fails in readline
type: compile 

[issue10990] tests mutating sys.gettrace() w/o re-instating previous state

2011-01-25 Thread Brett Cannon

Brett Cannon br...@python.org added the comment:

OK, here is a single patch (from `hg outgoing --patch`) that fixes all the 
tests by introducing the test.support.no_tracing decorator.

--
Added file: http://bugs.python.org/file20523/trace_fxn_protected.diff

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



[issue10990] tests mutating sys.gettrace() w/o re-instating previous state

2011-01-25 Thread Brett Cannon

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


Removed file: http://bugs.python.org/file20498/sys_gettrace_monitor.diff

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



[issue10990] tests mutating sys.gettrace() w/o re-instating previous state

2011-01-25 Thread Brett Cannon

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


Removed file: http://bugs.python.org/file20508/test_scope.diff

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



[issue10990] tests mutating sys.gettrace() w/o re-instating previous state

2011-01-25 Thread Brett Cannon

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


Removed file: http://bugs.python.org/file20509/test_sys_settrace.diff

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



[issue10990] tests mutating sys.gettrace() w/o re-instating previous state

2011-01-25 Thread Brett Cannon

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


Removed file: http://bugs.python.org/file20516/test_trace.diff

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



  1   2   >