[issue10930] dict.setdefault: Bug: default argument is ALWAYS evaluated, i.e. no short-circuit eval

2011-01-18 Thread Albert

New submission from Albert albert@gmail.com:

Hello!

Is it intentional, that the default argument is ALWAYS evaluated, even if it is 
not needed???

Is it not a bug, that this method has no short-circuit eval 
(http://en.wikipedia.org/wiki/Short-circuit_evaluation)
??

Example1:
=
infinite = 1e100

one_div_by = {0.0 : infinite}

def func(n):
return one_div_by.setdefault(float(n), 1/float(n))

for i in [1, 2, 3, 4]:
print i, func(i)
print one_div_by
# works!!

for i in [0, 1, 2, 3, 4]: # added 0 - FAIL!
print i, func(i)
print one_div_by
# fail!!



Example2:
=
fib_d = {0 : 0, 1 : 1}

def fibonacci(n):
return fib_d.setdefault(n, fibonacci(n-1) + fibonacci(n-2))

for i in range(10):
print i, fibonacci(i)
print fib_d

--
messages: 126456
nosy: albert.neu
priority: normal
severity: normal
status: open
title: dict.setdefault: Bug: default argument is ALWAYS evaluated, i.e. no 
short-circuit eval
type: behavior
versions: Python 2.6

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



[issue10931] print() from pipe enclosed between 'b and 'pair on python3

2011-01-18 Thread ricardw

New submission from ricardw rica...@intervisit.com:

The following script produces different output on python2.6.6 vs. python3.1.2:
-
import subprocess, sys

ls = subprocess.Popen(['ls', '-l', '/etc/motd'], stdout=subprocess.PIPE,)

end_of_pipe = ls.stdout

print('Result:')

for line in end_of_pipe:
print(line.strip())
-

Result from invoking with python2 and python3 are respectively:

Result:
-rw-rw 1 root root 25 Jan 18 10:25 /etc/motd

and:

Result:
b'-rw-rw 1 root root 25 Jan 18 10:25 /etc/motd'

Is this difference a feature, or a bug ?

--
components: Interpreter Core
messages: 126457
nosy: ricardw
priority: normal
severity: normal
status: open
title: print() from pipe enclosed between 'b and 'pair on python3
type: behavior
versions: Python 3.1

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



[issue10924] Adding salt and Modular Crypt Format to crypt library.

2011-01-18 Thread Sean Reifschneider

Changes by Sean Reifschneider j...@tummy.com:


Removed file: http://bugs.python.org/file20428/python-underscore_crypt-3.patch

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



[issue10930] dict.setdefault: Bug: default argument is ALWAYS evaluated, i.e. no short-circuit eval

2011-01-18 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc amaur...@gmail.com added the comment:

setdefault() is a method, its arguments are evaluated then the function is 
called. This is not a bug, and this behavior cannot change.

If you are trying to cache the computation of a function, you should try 
memoizing techniques, like the one mentioned here: 
http://code.activestate.com/recipes/52201-memoizing-cacheing-function-return-values/
Then you can write::

@Memoize
def fib(n):
return fib(n-1) + fib(n-2)
fib.memo = {(0,): 1, (1,): 1}

@Memoize
def func(n):
return 1/float(n)
func.memo = {(0.0,): infinite}

--
nosy: +amaury.forgeotdarc
resolution:  - invalid
status: open - closed

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



[issue10932] distutils.core.setup - data_files missbehaviour ?

2011-01-18 Thread Thorsten Simons

New submission from Thorsten Simons t...@snomis.de:

Hi !

when specifying additional files to be distributed by distutils.core.setup, 
documentation says that:

Each file name in files is interpreted relative to the setup.py script at the 
top of the package source distribution. No directory information from files is 
used to determine the final location of the installed file; only the name of 
the file is used

(http://docs.python.org/py3k/distutils/setupscript.html#distutils-additional-files)

Well, this seems to be incorrect - I tried to specify a file from a higher 
level directory, which get's copies to a target based on the whole path I 
specified, not just the name...

Pls. see attached file for details

--
assignee: tarek
components: Distutils
files: issue.txt
messages: 126459
nosy: Thorsten.Simons, eric.araujo, tarek
priority: normal
severity: normal
status: open
title: distutils.core.setup - data_files missbehaviour ?
type: behavior
versions: Python 3.1
Added file: http://bugs.python.org/file20435/issue.txt

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



[issue10933] Tracing disabled when a recursion error is triggered (even if properly handled)

2011-01-18 Thread Fabio Zadrozny

New submission from Fabio Zadrozny fab...@users.sourceforge.net:

It seems that tracing in the interpreter is lost after some recursion error is 
triggered (even if it's properly handled).

This breaks any debugger working after any recursion error is triggered (which 
suppose shouldn't happen).

The attached test case shows the problem in action.

Tested the problem with Python 2.6.5 and 3.1.3

--
components: Interpreter Core
files: recursion_error_disables_tracing.py
messages: 126460
nosy: fabioz
priority: normal
severity: normal
status: open
title: Tracing disabled when a recursion error is triggered (even if properly 
handled)
type: behavior
versions: Python 2.6, Python 3.1
Added file: http://bugs.python.org/file20436/recursion_error_disables_tracing.py

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



[issue10451] memoryview can be used to write into readonly buffer

2011-01-18 Thread Ross Lagerwall

Ross Lagerwall rosslagerw...@gmail.com added the comment:

From what I can see, this issue is in memoryview and allows memoryview to 
export a readonly buffer as writable (because memoryview.getbuffer() removes 
the writable flag from flags before calling the underlying buffer).

This causes segfaults when using mmap. 

If a bytes object is used as the underlying buffer, it allows the bytes object 
to be changed.

Given this code:

import io
b=b
m=memoryview(b)
i=io.BytesIO(b'')
i.readinto(m)
print(b)
print(b == b)

The output is:
b''
True

I think this is due to interning.

Anyway, attached is a patch which hopefully fixes the issue + a test.

--
keywords: +patch
nosy: +rosslagerwall
Added file: http://bugs.python.org/file20437/i10451.patch

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



[issue10931] print() from pipe enclosed between b' and 'pair on python3

2011-01-18 Thread ricardw

Changes by ricardw rica...@intervisit.com:


--
title: print() from pipe enclosed between 'b and 'pair on python3 - print() 
from pipe enclosed between b' and 'pair on python3

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



[issue10931] print() from pipe enclosed between b' and 'nbsp; pair on python3

2011-01-18 Thread ricardw

Changes by ricardw rica...@intervisit.com:


--
title: print() from pipe enclosed between b' and 'pair on python3 - print() 
from pipe enclosed between b' and 'nbsp;pair on python3

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



[issue10931] print() from pipe enclosed between {b'} and {'}-pair on python3

2011-01-18 Thread ricardw

Changes by ricardw rica...@intervisit.com:


--
title: print() from pipe enclosed between b' and 'nbsp;pair on python3 - 
print() from pipe enclosed between {b'} and {'}-pair on python3

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



[issue10931] print() from pipe enclosed between {b'} and {'}-pair on python3

2011-01-18 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc amaur...@gmail.com added the comment:

It's a feature. Subprocess output is binary data, not text; and since python3, 
the string type is now what python2 called unicode!

Please read 
http://docs.python.org/py3k/whatsnew/3.0.html#text-vs-data-instead-of-unicode-vs-8-bit
for an explanation of the most important difference between python2 and python3.

--
nosy: +amaury.forgeotdarc
resolution:  - invalid
status: open - closed

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



[issue10451] memoryview can be used to write into readonly buffer

2011-01-18 Thread Mark Dickinson

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


--
nosy: +mark.dickinson

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



[issue10934] imaplib: Internaldate2tuple() is documented to return UTC, but it returns local time

2011-01-18 Thread Joe Peterson

New submission from Joe Peterson j...@skyrush.com:

Patched documentation for Internaldate2tuple() to correctly state it returns 
local time.

Also, Time2Internaldate() (its inverse) did not state that it needs local time 
as input, so patched this as well.

Patches for 3.2 and 2.7 are attached.

--
assignee: docs@python
components: Documentation
files: imaplib_Internaldate2tuple_doc_python32.patch
keywords: patch
messages: 126463
nosy: docs@python, lavajoe
priority: normal
severity: normal
status: open
title: imaplib: Internaldate2tuple() is documented to return UTC, but it 
returns local time
versions: Python 2.7, Python 3.2
Added file: 
http://bugs.python.org/file20438/imaplib_Internaldate2tuple_doc_python32.patch

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



[issue10934] imaplib: Internaldate2tuple() is documented to return UTC, but it returns local time

2011-01-18 Thread Joe Peterson

Changes by Joe Peterson j...@skyrush.com:


Added file: 
http://bugs.python.org/file20439/imaplib_Internaldate2tuple_doc_python27.patch

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



[issue10921] imaplib: Internaldate2tuple() string/bytes issues, does not handle negative TZ offsets, does not handle DST correctly

2011-01-18 Thread Joe Peterson

Joe Peterson j...@skyrush.com added the comment:

I have started splitting these up as recommended.  First one (documentation) 
is: issue 10934.  I will split out more later today...

--

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



[issue10924] Adding salt and Modular Crypt Format to crypt library.

2011-01-18 Thread Antoine Pitrou

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

Can you use diff -u (or simply svn diff) when generating a patch?

 6) I don't know, I thought everything in Python 3 was a new style
 class?

It is indeed.

--

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



[issue10921] imaplib: Internaldate2tuple() string/bytes issues, does not handle negative TZ offsets, does not handle DST correctly

2011-01-18 Thread R. David Murray

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

If I understand correctly, what Alexander means by only work in the C locale 
is that both strptime and strftime are locale dependent, and so if the locale 
is something other than C it may fail to parse the month name and may generate 
a non-standard month name.

--

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



[issue10930] dict.setdefault: Bug: default argument is ALWAYS evaluated, i.e. no short-circuit eval

2011-01-18 Thread Eric Smith

Eric Smith e...@trueblade.com added the comment:

Or use a collections.defaultdict, which has a factory function as a constructor 
argument. It sort of depends on what you're trying to do.

--
nosy: +eric.smith

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



[issue10451] memoryview can be used to write into readonly buffer

2011-01-18 Thread Antoine Pitrou

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

The patch produces a failure in test_getargs2, but that test is wrong and 
should be fixed:

==
ERROR: test_w_star (test.test_getargs2.Bytes_TestCase)
--
Traceback (most recent call last):
  File /home/antoine/py3k/__svn__/Lib/test/test_getargs2.py, line 385, in 
test_w_star
self.assertEqual(getargs_w_star(memoryview(b'memoryview')), b'[emoryvie]')
TypeError: must be read-write buffer, not memoryview


I'm surprised no other test failures arise. I did add that line (which I 
commented with XXX for whatever reason...) for a reason, but I don't remember 
which one. It seemed necessary at the time, I'm glad it isn't anymore.

So, about the patch itself: you should simply use assertRaises. There's no 
reason for readinto() not to fail with a TypeError (silent failure is wrong). 
Thank you.

--

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



[issue10451] memoryview can be used to write into readonly buffer

2011-01-18 Thread Antoine Pitrou

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


--
nosy: +georg.brandl
priority: normal - critical

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



[issue10451] memoryview can be used to write into readonly buffer

2011-01-18 Thread Ross Lagerwall

Ross Lagerwall rosslagerw...@gmail.com added the comment:

Attached is an updated patch with a simpler test.

--
Added file: http://bugs.python.org/file20440/i10451_v2.patch

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



[issue10451] memoryview can be used to write into readonly buffer

2011-01-18 Thread Ross Lagerwall

Ross Lagerwall rosslagerw...@gmail.com added the comment:

And a simple fix for the test_getargs2 test - it wraps the memoryview around a 
bytearray.

--
Added file: http://bugs.python.org/file20441/testfix.patch

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



[issue10935] wsgiref.handlers.BaseHandler and subclasses of str

2011-01-18 Thread Tim Perevezentsev

New submission from Tim Perevezentsev riffm2...@gmail.com:

This code:

assert type(val) is StringType,Header values must be strings

(from here 
http://svn.python.org/view/python/tags/r271/Lib/wsgiref/handlers.py?revision=86833view=markup)

from start_response method, is not allowing to use str subclasses objects as 
header value.

Usecase:

I made class URL which subclasses str and has additional methods to manipulate 
query string. It is very handy. But when I need to set header
Location with URL object as value I get assertion error.

Can't we do this instead:

assert isinstance(val, str),Header values must be strings

--
components: Library (Lib)
messages: 126471
nosy: riffm
priority: normal
severity: normal
status: open
title: wsgiref.handlers.BaseHandler and subclasses of str
type: behavior
versions: Python 2.5, Python 2.6, Python 2.7

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



[issue10451] memoryview can be used to write into readonly buffer

2011-01-18 Thread Georg Brandl

Georg Brandl ge...@python.org added the comment:

So, does critical mean should be release blocker?

--

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



[issue10918] **kwargs unnecessarily restricted in concurrent.futures 'submit' API

2011-01-18 Thread Ron Adam

Ron Adam ron_a...@users.sourceforge.net added the comment:

Yes, you are correct.  Pulling the first value off of args would work.

This is new for 3.2, can it still be changed?


One more thing to consider...

One of the things I look at for functions like these is, how easy is it to 
separate the data from the program interface?

I prefer:
submit_data = [fn, args, kwds]
e.submit(*submit_data)

or..
submit_args = [(a, k), (a, k), ... ]
for args, kwds in submit_args:
e.submit(fn, args, kwds)

But its a trade off against easier direct calling.  My feelings, is submit will 
be used more in an indirect way, like these examples, rather than being used 
directly by writing out each submit separately.

--

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



[issue10451] memoryview can be used to write into readonly buffer

2011-01-18 Thread Antoine Pitrou

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

 So, does critical mean should be release blocker?

It's up to you to decide. It's not a new bug AFAICT.

--

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



[issue10451] memoryview can be used to write into readonly buffer

2011-01-18 Thread Georg Brandl

Georg Brandl ge...@python.org added the comment:

The patch looks trivial enough.  You're the memoryview guru, so if you have no 
doubts about it, I would say it can go in.

--

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



[issue10451] memoryview can be used to write into readonly buffer

2011-01-18 Thread Antoine Pitrou

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

Patch with modified tests committed in r88097 (3.2), r88098 (3.1) and r88099 
(2.7). Thank you!

--
resolution:  - fixed
stage:  - committed/rejected
status: open - closed
versions: +Python 2.7

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



[issue10936] Simple CSS fix for left margin at docs.python.org

2011-01-18 Thread Christopher Dunn

New submission from Christopher Dunn cdunn2...@gmail.com:

This is an easy one.

When I zoom my browser in (with Ctrl+ or Apple+) the left-side navigation 
margin gets bigger and bigger, pushing the useful text off the screen. That has 
bothered me (and anyone else with 40+ year old eyes) ever since the switch to 
the newest doc format with Sphinx.

There is no fix that will satisfy everyone. People with perfect vision might 
like to zoom out (with Ctrl- or Apple-), since the margin currently gets 
smaller and smaller. But we need a compromise.

The relevant CSS, in default.css, is this:

 div.bodywrapper {
margin: 0 0 0 230px;
 }

If instead it were something like this:

 div.bodywrapper {
margin: 0 0 0 10%;
 }

then at least the navigation margin would stay the same size always.

If you really want it to grow and shrink, then you need some sort of javascript 
control of its position.

--
assignee: docs@python
components: Documentation
messages: 126477
nosy: cdunn2001, docs@python
priority: normal
severity: normal
status: open
title: Simple CSS fix for left margin at docs.python.org
type: behavior
versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3

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



[issue10935] wsgiref.handlers.BaseHandler and subclasses of str

2011-01-18 Thread Éric Araujo

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

This is by design.  PEP 333 and PEP  contain more information about that.  
You’ll need to convert your objects to str before passing them to 
start_response.  Sorry!

--
nosy: +eric.araujo, pje
resolution:  - invalid
stage:  - committed/rejected
status: open - closed
versions:  -Python 2.5, Python 2.6

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



[issue10937] WinPE 64 bit execution results with errors

2011-01-18 Thread Jeremy Langley

New submission from Jeremy Langley gettingback2bas...@gmail.com:

old versions of python worked on old versions of winpe by copying the 
c:\python25\ directory over to the mounted (iso,usb) filesystem, then rebooting 
with the media and running the python.exe from the ramdrive.
This formula no longer works with 64 bit versions of winpe (which is one way to 
push win7-64bit.

When it's tried one gets platform based errors.

--
components: Build
messages: 126479
nosy: gettingback2basics
priority: normal
severity: normal
status: open
title: WinPE 64 bit execution results with errors
type: feature request

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



[issue10935] wsgiref.handlers.BaseHandler and subclasses of str

2011-01-18 Thread Tim Perevezentsev

Tim Perevezentsev riffm2...@gmail.com added the comment:

str - immutable. So every str subclass object is normal string. I don't see any 
design violation here.

--

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



[issue10938] Undocumented option for datetime.strftime: %s

2011-01-18 Thread Humberto Diogenes

New submission from Humberto Diogenes humbe...@digi.com.br:

On some systems, datetime.strftime() accepts a %s format string that returns 
epoch / UNIX timestamp, but this behavior is not documented at 
http://docs.python.org/library/datetime.html

Python 2.7 (r27:82508, Jul  3 2010, 21:12:11) 
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
Type help, copyright, credits or license for more information.
 import datetime
 datetime.datetime.now().strftime('%s')
'1295376929'

--
assignee: docs@python
components: Documentation
messages: 126481
nosy: docs@python, hdiogenes
priority: normal
severity: normal
status: open
title: Undocumented option for datetime.strftime: %s
versions: Python 2.7

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



[issue10918] **kwargs unnecessarily restricted in concurrent.futures 'submit' API

2011-01-18 Thread Adrian Dries

Adrian Dries adr...@gmail.com added the comment:

Have your cake and eat it:

def submit(self, fn, args, kw):
# submit implementation

def sugar(*args, **kw):
return args[0].submit(args[1], args[2:], kw)

--

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



[issue10937] WinPE 64 bit execution results with errors

2011-01-18 Thread Antoine Pitrou

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


--
nosy: +loewis

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



[issue10935] wsgiref.handlers.BaseHandler and subclasses of str

2011-01-18 Thread R. David Murray

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

Eric, could you point out the part of the specification that requires exactly a 
string and makes a string subclass invalid?  I did a quick scan and couldn't 
find it, and unfortunately don't have the time to re-read the whole spec right 
now.

--
nosy: +r.david.murray

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



[issue10937] WinPE 64 bit execution results with errors

2011-01-18 Thread Brian Curtin

Brian Curtin cur...@acm.org added the comment:

Do you have any log files or screenshots of what exactly happens?

I have zero experience with WinPE, so that's an obvious barrier here, but 
there's also nothing to go by in figuring out where the problem may be.

--
nosy: +brian.curtin
stage:  - needs patch

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



[issue10938] Undocumented option for datetime.strftime: %s

2011-01-18 Thread R. David Murray

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

As you say, on some systems.  The variation is documented, and the documented 
codes are documented as being just those required by the C standard.

--
nosy: +r.david.murray
resolution:  - invalid
stage:  - committed/rejected
status: open - closed
type:  - behavior

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



[issue10918] **kwargs unnecessarily restricted in concurrent.futures 'submit' API

2011-01-18 Thread Georg Brandl

Georg Brandl ge...@python.org added the comment:

It could be changed, as it is not an incompatible API change.  However, I'd 
like Brian to ok it.

--

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



[issue10936] Simple CSS fix for left margin at docs.python.org

2011-01-18 Thread Brian Curtin

Changes by Brian Curtin cur...@acm.org:


--
nosy: +ezio.melotti, georg.brandl

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



[issue10935] wsgiref.handlers.BaseHandler and subclasses of str

2011-01-18 Thread Éric Araujo

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

See http://bugs.python.org/issue5800#msg121958

--

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



[issue10935] wsgiref.handlers.BaseHandler and subclasses of str

2011-01-18 Thread R. David Murray

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

OK.  So he is saying that when the spec says an object of type str he means 
'type(x) is str' as opposed to 'isinstance(x, str)'.  I would naively have 
expected the latter, as other people clearly do as well.  I didn't participate 
in any of the discussions that led to this decision, so I won't pursue it 
further, but it does break the expectation that many people have about how 
python programs work, so I expect we'll be seeing this bug report again 
sometime :)

--

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



[issue10898] posixmodule.c redefines FSTAT

2011-01-18 Thread Antoine Pitrou

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

How about adding #undef FSTAT instead? Would it work for you?

--
components: +Extension Modules
nosy: +pitrou
stage:  - needs patch
versions: +Python 2.7, Python 3.1, Python 3.2

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



[issue10898] posixmodule.c redefines FSTAT

2011-01-18 Thread Alan Hourihane

Alan Hourihane al...@fairlite.co.uk added the comment:

On Tue, 2011-01-18 at 19:59 +, Antoine Pitrou wrote:
 Antoine Pitrou pit...@free.fr added the comment:
 
 How about adding #undef FSTAT instead? Would it work for you?

Sure.

Alan.

--

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



[issue10924] Adding salt and Modular Crypt Format to crypt library.

2011-01-18 Thread Sean Reifschneider

Sean Reifschneider j...@tummy.com added the comment:

Sure thing, here's an svn diff.  I had switched to the diff because I 
couldn't get it to patch into a fresh trunk, but the format looked fine; not 
sure why it couldn't find the files.  Anyway, here's a new version.

--
Added file: http://bugs.python.org/file20442/python-underscore_crypt-5.patch

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



[issue10924] Adding salt and Modular Crypt Format to crypt library.

2011-01-18 Thread Antoine Pitrou

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

 Sure thing, here's an svn diff.  I had switched to the diff because
 I couldn't get it to patch into a fresh trunk, but the format looked
 fine; not sure why it couldn't find the files.  Anyway, here's a new
 version.

You also have to svn add the relevant files :)

--

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



[issue10938] Undocumented option for datetime.strftime: %s

2011-01-18 Thread Humberto Diogenes

Humberto Diogenes humbe...@digi.com.br added the comment:

David, as discussed on the IRC channel: maybe we could just add pointers to the 
OS-specific docs. Something like:


If you want to use platform-specific format strings, search for strftime in 
your OS documentation (`man strftime` on POSIX systems).

Linux: http://www.kernel.org/doc/man-pages/online/pages/man3/strftime.3.html

Mac OS: 
http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man3/strftime.3.html


--

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



[issue10938] Provide links to system specific strftime/ptime docs

2011-01-18 Thread R. David Murray

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

All right, I'll open it back up for that suggestion (I've changed the title 
accordingly) and let the docs folks decide.  The most useful link would be one 
to the relevant Windows documentation, since that's the hardest one to find.

Although this scheme avoids the problem of having to maintain a list of 'extra' 
format codes, it does have one of the same problems that doing so would have: 
the supported codes may change from OS version to OS version, and do we 
maintain the links accordingly?  The mitigating factor is that I don't think 
the supported codes do change much.

--
resolution: invalid - 
stage: committed/rejected - needs patch
status: closed - open
title: Undocumented option for datetime.strftime: %s - Provide links to system 
specific strftime/ptime docs
type: behavior - feature request
versions: +Python 3.1, Python 3.2

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



[issue10923] Python 2.7 hangs on Unicode+threading

2011-01-18 Thread STINNER Victor

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


--
nosy: +haypo

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



[issue10924] Adding salt and Modular Crypt Format to crypt library.

2011-01-18 Thread Sean Reifschneider

Sean Reifschneider j...@tummy.com added the comment:

Not sure if that was meant to be a suggestion for why my local patching wasn't 
working from the svn diff output, but obviously -5 was messed up.  Here's a 
new version that I can apply to my fresh trunk and passes make test.

If the suggestion was how to fix my patching from svn diff, the problem I ran 
into was that it had the files in it, say crypt.py, but it was trying to apply 
them as if I had specified patch -p1, even though the svn diff contained 
the paths and I hadn't done -p1.

Anyway, this diff is diff -urN.  I just can't win, I usually use diff -u, 
but in the distant past Guido asked me for diff -c instead.  :-)

--
Added file: http://bugs.python.org/file20443/python-underscore_crypt-6.patch

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



[issue4681] mmap offset should be off_t instead of ssize_t, and size calculation needs corrected

2011-01-18 Thread STINNER Victor

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


--
nosy: +haypo

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



[issue10920] cp65001, PowerShell, Python crash.

2011-01-18 Thread STINNER Victor

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


--
status: open - closed

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



[issue9257] cElementTree iterparse requires events as bytes; ElementTree uses strings

2011-01-18 Thread STINNER Victor

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


--
nosy: +haypo

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



[issue10937] WinPE 64 bit execution results with errors

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

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

You need to install the MS CRT (msvcrt90.dll, along with its assembly manifests 
and stuff) as well; it's not surprising that copying over an installation 
doesn't work.

I'll also point out that this is not a bug: copying over an installation is not 
supposed to work.

--

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



[issue10924] Adding salt and Modular Crypt Format to crypt library.

2011-01-18 Thread Antoine Pitrou

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

 Not sure if that was meant to be a suggestion for why my local
 patching wasn't working from the svn diff output, but obviously -5
 was messed up.  Here's a new version that I can apply to my fresh
 trunk and passes make test.

Thank you! The important is that we now have a workable patch in unified
diff format :)

 If the suggestion was how to fix my patching from svn diff, the
 problem I ran into was that it had the files in it, say crypt.py, but
 it was trying to apply them as if I had specified patch -p1, even
 though the svn diff contained the paths and I hadn't done -p1.

For the record, when using svn diff, you have to use patch -p0 to
apply the resulting patch. Not -p1.

 Anyway, this diff is diff -urN.  I just can't win, I usually use
 diff -u, but in the distant past Guido asked me for diff -c
 instead.  :-)

I would bet even Guido changed his habits :) Rietveld computes and
displays unified diffs as far as I remember.

--

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



[issue5527] multiprocessing won't work with Tkinter (under Linux)

2011-01-18 Thread Philip Winston

Philip Winston pwins...@gmail.com added the comment:

We ran into this. Forking before importing Tkinter worked for us.  We did the 
following which seems pretty clean:

main.py
import stdlib only
if __name__ == 'main':
   fork via multiprocessing.Process
   from application import App
   App()

application.py
import Tkinter 
class App...

--
nosy: +pbwinston

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



[issue10939] imaplib: Internaldate2tuple fails to parse month and does not work with negative TZ offset due to bytes/str issues

2011-01-18 Thread Joe Peterson

New submission from Joe Peterson j...@skyrush.com:

There are two issues with conversion to Python 3:

1. It raise KeyError.  This is because the Mon2num dictionary keys are 
strings (str), not bytes objects (note that many other strings in imaplib have 
been updated, but not Mon2num).

2. The sign character of the TZ offset (e.g. -0700) is compared to the string 
(str) '-', not bytes array b'-', so the compare is never true, causing a large 
error when the TZ offset is negative.

Patch attached that also adds a unit test.

--
components: Library (Lib)
files: imaplib_Internaldate2tuple_bytes_fixes_python32.patch
keywords: patch
messages: 126499
nosy: lavajoe
priority: normal
severity: normal
status: open
title: imaplib: Internaldate2tuple fails to parse month and does not work with 
negative TZ offset due to bytes/str issues
type: behavior
versions: Python 3.2
Added file: 
http://bugs.python.org/file20444/imaplib_Internaldate2tuple_bytes_fixes_python32.patch

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



[issue10939] imaplib: Internaldate2tuple raises KeyError parsing month and does not work with negative TZ offset due to bytes/str issues

2011-01-18 Thread Joe Peterson

Changes by Joe Peterson j...@skyrush.com:


--
title: imaplib: Internaldate2tuple fails to parse month and does not work with 
negative TZ offset due to bytes/str issues - imaplib: Internaldate2tuple 
raises KeyError parsing month and does not work with negative TZ offset due to 
bytes/str issues

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



[issue10940] IDLE hangs with Cmd-M hotkey on Mac O/S

2011-01-18 Thread Raymond Hettinger

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


--
assignee: ned.deily
components: IDLE
nosy: brett.cannon, ned.deily, rhettinger
priority: high
severity: normal
status: open
title: IDLE hangs with Cmd-M hotkey on Mac O/S
type: crash
versions: Python 3.2

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



[issue10940] IDLE hangs with Cmd-M hotkey on Mac O/S

2011-01-18 Thread Ned Deily

New submission from Ned Deily n...@acm.org:

Is this on OS X 10.6 with ActiveState 8.5.9 installed?

--

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



[issue10940] IDLE hangs with Cmd-M hotkey on Mac O/S

2011-01-18 Thread Raymond Hettinger

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

On the Mac O/S 64-bit install, Idle hangs when the Cmd-M hotkey is pressed, but 
selecting OpenModule directly from the File menu works fine.

For me, it hangs with the pinwheel of death and requires a force-quit.  For 
Brett, it changes colors as if an unhandled event if being fired-off.

--

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



[issue10940] IDLE 3.2 hangs with Cmd-M hotkey on OS X 10.6 with 64-bit installer and A/S Tk 8.5

2011-01-18 Thread Ned Deily

Changes by Ned Deily n...@acm.org:


--
title: IDLE hangs with Cmd-M hotkey on Mac O/S - IDLE 3.2 hangs with Cmd-M 
hotkey on OS X 10.6 with 64-bit installer and A/S Tk 8.5

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



[issue4106] multiprocessing occasionally spits out exception during shutdown

2011-01-18 Thread Brian Thorne

Brian Thorne hardb...@gmail.com added the comment:

With the example script attached I see the exception every time. On Ubuntu 
10.10 with Python 2.6

Since the offending line in multiprocesing/queues.py (233) is a debug 
statement, just commenting it out seems to stop this exception.

Looking at the util file shows the logging functions to be all of the form:

if _logger:
_logger.log(...

Could it be possible that after the check the _logger global (or the debug 
function) is destroyed by the exit handler? Can we convince them to stick 
around until such a time that they cannot be called?

Adding a small delay before joining also seems to work, but is ugly. Why should 
another Process *have* to have a minimum amount of work to not throw an 
exception?

--
nosy: +Thorney
versions: +Python 2.6 -Python 2.7
Added file: http://bugs.python.org/file20445/test_mult.py

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



[issue10941] imaplib: Internaldate2tuple produces wrong result if date is near a DST change

2011-01-18 Thread Joe Peterson

New submission from Joe Peterson j...@skyrush.com:

DST is not handled correctly.  Specifically, when the input date/time, ignoring 
the TZ offset (and treated as if it is local time) is on the other side of the 
DST changeover from the actual local time represented, the result will be off 
by one hour.  This can happen, e.g., when the input date/time is actually UTC 
(offset +).

This is because the check for DST is done after converting the time into a 
local time tuple, thereby treating as real local time.  This can be corrected 
by keeping the time in real UTC (by using calendar.timegm() instead of checking 
the DST flag) until the final conversion to local time.

Here is an example:  Run the following two dates, that represent exactly the 
same time, through Internaldate2tuple:

'25 (INTERNALDATE 01-Apr-2000 19:02:23 -0700)'
'101 (INTERNALDATE 02-Apr-2000 02:02:23 +)'

Note that a variant of this issue (but identifying it as a different problem) 
was addressed in a similar way in an old post I found by Colin Brown in 2004 
(http://www.velocityreviews.com/forums/t336162-imaplib-function-bug.html).

Patch also adds unit test to check the above example dates.  Python 3 version 
of patch assumes patch from issue 10939 has been applied.

Patch also corrects code python doc that currently states time is UT, not local 
(see issue 10934).

--
components: Library (Lib)
messages: 126503
nosy: lavajoe
priority: normal
severity: normal
status: open
title: imaplib: Internaldate2tuple produces wrong result if date is near a DST 
change
type: behavior
versions: Python 2.7, Python 3.2

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



[issue10941] imaplib: Internaldate2tuple produces wrong result if date is near a DST change

2011-01-18 Thread Joe Peterson

Changes by Joe Peterson j...@skyrush.com:


--
keywords: +patch
Added file: 
http://bugs.python.org/file20446/imaplib_Internaldate2tuple_dst_fix_python32.patch

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



[issue10941] imaplib: Internaldate2tuple produces wrong result if date is near a DST change

2011-01-18 Thread Joe Peterson

Changes by Joe Peterson j...@skyrush.com:


Added file: 
http://bugs.python.org/file20447/imaplib_Internaldate2tuple_dst_fix_python27.patch

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



[issue10921] imaplib: Internaldate2tuple() string/bytes issues, does not handle negative TZ offsets, does not handle DST correctly

2011-01-18 Thread Joe Peterson

Joe Peterson j...@skyrush.com added the comment:

Two more issues split out into their own issues:

issue 10939 (bytes/str issues)
issue 10941 (DST handled incorrectly)

--

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



[issue10876] Zipfile sometimes considers a false password to be correct

2011-01-18 Thread Kira Erethon

Kira Erethon shinjieret...@gmail.com added the comment:

Sorry to re-open this, but I consider it an important bug. Tried it in 3.1 also 
and it's still there. To sum up what's happening, zipfile sometimes considers a 
false password to be correct and proceeds with decrypting the file. Is there a 
workaround in this? Or even checking if a file has been decrypted correctly?

--
resolution: invalid - 
status: closed - open
title: Zipfile crashes when zip password is set to 610/844/numerous other 
numbers - Zipfile sometimes considers a false password to be correct

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



[issue10876] Zipfile sometimes considers a false password to be correct

2011-01-18 Thread Kira Erethon

Changes by Kira Erethon shinjieret...@gmail.com:


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

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



[issue10942] xml.etree.ElementTree.tostring returns type bytes, expected type str

2011-01-18 Thread J_Tom_Moon_79

New submission from J_Tom_Moon_79 jtm.moon.forum.user+pyt...@gmail.com:

method xml.etree.ElementTree.tostring from module returns type bytes.
The documentation reads
Returns an encoded string containing the XML data.
(from 
http://docs.python.org/py3k/library/xml.etree.elementtree.html#xml.etree.ElementTree.tostring
 as of 2011-01-18)

===
Here is a test program:
---
#!/usr/bin/python
# created for python 3.1

import sys
print(sys.version) # for help verifying version tested
from xml.etree import ElementTree

sampleinput = ?xml version=1.0?Hello/Hello
xmlobj = ElementTree.fromstring(sampleinput)
type(xmlobj)
xmlstr = ElementTree.tostring(xmlobj,'utf-8')
print(xmlstr value is ', xmlstr, ', sep=)
print(xmlstr type is ', type(xmlstr), ', sep=)
---
test program output:
---
3.1.3 (r313:86834, Nov 27 2010, 18:30:53) [MSC v.1500 32 bit (Intel)]
xmlstr value is 'b'Hello /''
xmlstr type is 'class 'bytes''
===

This cheap fix for this bug may be simply be a change in documentation.
However, a method called tostring really should return something nearer to 
the built-in str.

--
assignee: docs@python
components: Documentation, XML
messages: 126506
nosy: JTMoon79, docs@python
priority: normal
severity: normal
status: open
title: xml.etree.ElementTree.tostring returns type bytes, expected type str
type: behavior
versions: Python 3.1

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



[issue10942] xml.etree.ElementTree.tostring returns type bytes, expected type str

2011-01-18 Thread J_Tom_Moon_79

J_Tom_Moon_79 jtm.moon.forum.user+pyt...@gmail.com added the comment:

Some other bugs affecting the tostring method (for consideration by the 
reviewer):
http://bugs.python.org/issue6233#msg89718
http://bugs.python.org/msg101037
http://bugs.python.org/issue9692

--

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



[issue10876] Zipfile sometimes considers a false password to be correct

2011-01-18 Thread Antoine Pitrou

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

As I already explained:
* why it doesn't detect that the password is bad is because the ZIP format is 
not well-designed enough
* you can catch the zlib error which indicates that decryption returned junk

--
resolution:  - invalid
status: open - closed

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



[issue10924] Adding salt and Modular Crypt Format to crypt library.

2011-01-18 Thread Sean Reifschneider

Sean Reifschneider j...@tummy.com added the comment:

Thanks for the pointer about patch -p0.  I *HAD* tried that, but it didn't 
seem to work either.  I'll double check that though...  svn diff is what I'd 
prefer, because then I can svn commit it when it's ready.

Any other review feedback?  I'll probably let this sit until 3.2 goes to 
maintenance and then check it into trunk, so there's some time yet...

--

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



[issue10924] Adding salt and Modular Crypt Format to crypt library.

2011-01-18 Thread Antoine Pitrou

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

 Thanks for the pointer about patch -p0.  I *HAD* tried that, but it
 didn't seem to work either.  I'll double check that though...  svn
 diff is what I'd prefer, because then I can svn commit it when it's
 ready.

Ok, it seems the code inside crypt.py is duplicated in your patch.
Also, when you commit, it'll be better if you use svn rename for the C
file, so that history isn't broken.

 Any other review feedback?  I'll probably let this sit until 3.2 goes
 to maintenance and then check it into trunk, so there's some time
 yet...

Looks good mostly. Why do you need _MethodListClass()? Executing code at
module startup sounds fine to me. Or, at worse, use a global variable.

+   *salt* (either a random 2 or 16 character string, possibly prefixed with
+   ``$digit$`` to indicate the method) which will be used to perturb the
+   encryption algorithm.  The characters in *salt* must be in the set
+   ``[./a-zA-Z0-9]``, with the exception of Modular Crypt Format which
+   prefixes a ``$digit$``.

That paragraph is a bit confusing. Also, other uses of *salt* are
described separately two paragraphs above.

--

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



[issue10876] Zipfile sometimes considers a false password to be correct

2011-01-18 Thread Kira Erethon

Kira Erethon shinjieret...@gmail.com added the comment:

I'm catching all errors and exceptions and zipfile still decompresses it, 
that's what I've been trying to tell you. I don't face my original problem 
anymore, I'm catching that exception, now zipfile considers some passwords to 
be correct and throw no exception, it just decompresses the file (which 
contains junk since the password was wrong). That's for the second bullet of 
your message.

--

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



[issue10876] Zipfile sometimes considers a false password to be correct

2011-01-18 Thread Antoine Pitrou

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

 I'm catching all errors and exceptions and zipfile still decompresses
 it, that's what I've been trying to tell you. I don't face my original
 problem anymore, I'm catching that exception, now zipfile considers
 some passwords to be correct and throw no exception, it just
 decompresses the file (which contains junk since the password was
 wrong). That's for the second bullet of your message.

Then I suppose the file(s) inside the zip archive are not compressed,
or the compressed contents are miraculously good enough for the zlib
not to complain. But, really, unless you have a precise solution to
propose, that's nothing Python can do anything about.

(of course, if you have an idea about the contents of that zip file, you
can devise an application-specific algorithm for validating the
contents)

--

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



[issue10876] Zipfile sometimes considers a false password to be correct

2011-01-18 Thread Kira Erethon

Kira Erethon shinjieret...@gmail.com added the comment:

I'm a newbie in python and tried this in order to learn.I created all the zip 
files (first created a .txt file and zipped it with a password), so I know the 
file inside the zip is encrypted ( ofc I know the password too). Tried this 
with different .txt files and file names just in case there was some problem 
with the naming (didn't use any unicode file names). I'm not really at a level 
I can propose a solution, only thing I know is that zipfile can decompress 
the same file with 4 or more passwords without throwing any exception. Of 
course only one of those passwords is correct.
So, bottom line is it's a problem of the zip format and not Python eh?

--

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



[issue3080] Full unicode import system

2011-01-18 Thread STINNER Victor

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

Here is a work-in-progress patch: issue3080-3.patch. The patch is HUGE and 
written for Python 3.3.

$ diffstat issue3080-3.patch 
 Doc/c-api/module.rst   |   24 
 Include/import.h   |   73 +
 Include/moduleobject.h |2 
 Include/pycapsule.h|4 
 Modules/zipimport.c|  272 +++---
 Objects/moduleobject.c |   52 -
 PC/import_nt.c |   84 +-
 Python/dynload_aix.c   |2 
 Python/dynload_dl.c|2 
 Python/dynload_hpux.c  |2 
 Python/dynload_next.c  |4 
 Python/dynload_os2.c   |2 
 Python/dynload_shlib.c |2 
 Python/dynload_win.c   |2 
 Python/import.c| 1910 +++--
 Python/importdl.c  |   79 +-
 Python/importdl.h  |2 
 issue3080.py   |   29 
 18 files changed, 1484 insertions(+), 1063 deletions(-)

As expected, most of the work in done in import.c.

Decode the module name earlier and encode it later. Try to manipulate 
PyUnicodeObject objects instead of char* buffers (so we have directly the 
string length).

Split the huge and very complex find_module() function into 3 functions 
(find_module, find_module_filename and find_module2) and document them. Drop 
OS/2 support in find_module() (it can be kept, but it was easier for me to drop 
it and the OS/2 maintainer wrote that Python 3 is far from being compatible 
with OS/2).

The patch creates some functions: PyModule_GetNameObject(), 
PyImport_ExecCodeModuleUnicode(), PyImport_AddModuleUnicode(), 
PyImport_ImportFrozenModuleUnicode(), PyModule_NewUnicode(), ...

Use U format to parse a module name, and %R to format a module name (to 
escape surrogates characters and add quotes, instead of ... '%.200s' ...).

PyWin_FindRegisteredModule() is now private. Remove fqname argument from 
_PyImport_GetDynLoadFunc(), it wasn't used.

Replace open_exclusive() by fopen(name, wb) on Windows: is it correct?

TODO:

 - rename xxxobj = xxx to keep original names and have a short patch (eg. I 
renamed name to nameobj during the transition to detect bugs)
 - catch encoding errors in case_ok()
 - don't encode in case_ok() if case_ok() does nothing (eg. on Linux)
 - find a better name for find_module2()

The patch contains a tiny script, issue3080.py, to test the patch using an 
ISO-8859-1 locale.

I will open a thread on the mailing list (python-dev) to decide if this patch 
is needed or not. If we agree that this issue should be fixed, I will split the 
patch into smaller parts and start a review process.

--
keywords: +patch
Added file: http://bugs.python.org/file20448/issue3080-3.patch

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



[issue3080] Full unicode import system

2011-01-18 Thread STINNER Victor

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

This patch changes more lines of code than my previous crazy unicode patch 
(msg103663, issue #8242 #8611 #9425), but it changes less files.

--

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



[issue3080] Full unicode import system

2011-01-18 Thread STINNER Victor

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

Oh, msg103663 was not the final patch. A more recent version of my patch for 
#8611 / #9425 is http://codereview.appspot.com/1874048:

 Doc/library/sys.rst |6 
 Include/Python.h|4 
 Include/fileobject.h|   20 
 Include/import.h|   21 
 Include/moduleobject.h  |1 
 Include/sysmodule.h |5 
 Include/warnings.h  |2 
 Lib/distutils/file_util.py  |2 
 Lib/platform.py |   50 +-
 Lib/test/test_import.py |7 
 Lib/test/test_sax.py|5 
 Lib/test/test_subprocess.py |   14 
 Lib/test/test_sys.py|5 
 Lib/test/test_urllib.py |8 
 Lib/test/test_urllib2.py|5 
 Lib/test/test_xml_etree.py  |6 
 Modules/getpath.c   |  209 +
 Modules/main.c  |   99 +++-
 Modules/zipimport.c |  202 +
 Objects/codeobject.c|   17 
 Objects/fileobject.c|   32 +
 Objects/moduleobject.c  |   25 -
 Objects/object.c|6 
 Objects/typeobject.c|   12 
 Objects/unicodeobject.c |   11 
 PC/import_nt.c  |   18 
 Parser/tokenizer.c  |   12 
 Python/_warnings.c  |   69 ++-
 Python/ast.c|   16 
 Python/bltinmodule.c|   24 -
 Python/ceval.c  |7 
 Python/compile.c|   14 
 Python/errors.c |2 
 Python/import.c |  958 ++--
 Python/importdl.c   |   27 -
 Python/importdl.h   |2 
 Python/pythonrun.c  |  169 +++
 Python/sysmodule.c  |   60 ++
 38 files changed, 1404 insertions(+), 748 deletions(-)

So, issue3080-3.patch and issue1874048_1.diff are close :-)

--

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



[issue10942] xml.etree.ElementTree.tostring returns type bytes, expected type str

2011-01-18 Thread R. David Murray

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

This is indeed a doc problem, although there was some discussion of working 
toward a method rename.  See issue 8047 (but be prepared to read a novel to 
understand why tostring returns bytes...)  The doc for 3.2 is slightly clearer, 
but both 3.1 and 3.2 could be made clearer by referring to an 'encoded byte 
string' rather than just an 'encoded string'.  (An encoded string has to be a 
byte string, but that isn't obvious unless you've dealt with encode/decode a 
bunch.)

Technically this could be closed as a duplicate of issue 8047, since that issue 
proposes that the API fix (which would include the doc change) be backported to 
3.1.  But no one has proposed a patch there, so at a minimum the 3.1 docs 
should be clarified.

--
nosy: +r.david.murray
stage:  - needs patch

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



[issue10924] Adding salt and Modular Crypt Format to crypt library.

2011-01-18 Thread Sean Reifschneider

Sean Reifschneider j...@tummy.com added the comment:

Affirmative on the svn mv for the C module.

The duplicated code, thanks for pointing that out.  Someone else mentioned it, 
but I didn't understand what they were saying and they didn't reply to my 
request for clarification.  Fixed.

On the modules() list, how about if I just make it a list and build it at 
import time?  The class was the way I thought most straightforward to do it as 
a function, so maybe this is more reasonable?

Per the documentation, I pulled down the description from above, which I think 
captured the uses of *salt* and removed the duplication.

--
Added file: http://bugs.python.org/file20449/python-underscore_crypt-7.patch

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



[issue10924] Adding salt and Modular Crypt Format to crypt library.

2011-01-18 Thread Sean Reifschneider

Changes by Sean Reifschneider j...@tummy.com:


Removed file: http://bugs.python.org/file20433/python-underscore_crypt-4.patch

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



[issue10924] Adding salt and Modular Crypt Format to crypt library.

2011-01-18 Thread Sean Reifschneider

Changes by Sean Reifschneider j...@tummy.com:


Removed file: http://bugs.python.org/file20442/python-underscore_crypt-5.patch

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



[issue10924] Adding salt and Modular Crypt Format to crypt library.

2011-01-18 Thread Sean Reifschneider

Changes by Sean Reifschneider j...@tummy.com:


Removed file: http://bugs.python.org/file20443/python-underscore_crypt-6.patch

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