[issue5180] 3.1 cannot unpickle 2.7-created pickle

2010-06-28 Thread Marc-Andre Lemburg

Marc-Andre Lemburg  added the comment:

Alexander Belopolsky wrote:
> 
> Alexander Belopolsky  added the comment:
> 
> I am attaching a patch which makes python3 read 27.bench without errors.  I 
> think this should be applied while a complete solution for unpickling old 
> style class instances from text mode (protocol = 0) pickles is found.

Please use a different strategy for "porting" the Unicode tests to
Python3:

Create a new test modules Bytes (which reuses the Strings
tests) and a new test module Strings3 which reuses the Unicode
tests. The Strings3 module should then use the patches you
applied to the Unicode module.

Finally, let the two test module Strings and Unicode fail with
an ImportError in Python3.

--

___
Python tracker 

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



[issue3428] httplib.HTTPMessage undocumented

2010-06-28 Thread Senthil Kumaran

Senthil Kumaran  added the comment:

Fixed in r82322 and r82323.

Actually urllib.urlopen.info method return a mimetools.Message instance and a 
HTTPMessage instance is used within httplib only. It is more internal purposes 
to deal with headers with add_continue like methods is required.

ipatrol, the return codes of HTTP is documented in the httplib documentation.

--
resolution:  -> fixed
stage: needs patch -> committed/rejected
status: open -> closed

___
Python tracker 

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



[issue3990] The Linux2 platform definition is incorrect for alpha, hppa, mips, sparc

2010-06-28 Thread Jakub Wilk

Changes by Jakub Wilk :


--
nosy: +jwilk

___
Python tracker 

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



[issue5180] 3.1 cannot unpickle 2.7-created pickle

2010-06-28 Thread Marc-Andre Lemburg

Marc-Andre Lemburg  added the comment:

Alexander Belopolsky wrote:
> 
> Alexander Belopolsky  added the comment:
> 
> The bytes/string issu was a red herring: with pickle.load(open('27.bench', 
> 'b')), I get the same stack trace as from command line pybench invocation.
> 
> 
 pickle.load(open('27.bench', 'rb'))
> Traceback (most recent call last):
>   File "", line 1, in 
>   File "/Users/sasha/Work/python-svn/py3k-commit/Lib/pickle.py", line 1321, 
> in load
> encoding=encoding, errors=errors).load()
>   File "/Users/sasha/Work/python-svn/py3k-commit/Lib/pickle.py", line 830, in 
> load
> dispatch[key[0]](self)
>   File "/Users/sasha/Work/python-svn/py3k-commit/Lib/pickle.py", line 1055, 
> in load_inst
> klass = self.find_class(module, name)
>   File "/Users/sasha/Work/python-svn/py3k-commit/Lib/pickle.py", line 1115, 
> in find_class
> __import__(module, level=0)
>   File "/Users/sasha/Work/python-svn/py3k-commit/Tools/pybench/Unicode.py", 
> line 17
> s = unicode(u''.join(map(str,range(100
>   ^
> SyntaxError: invalid syntax

Note that pybench is written in a way that it can handle ImportErrors
and SyntaxErrors gracefully. This is per design, since test modules can
well be written for more recent Python versions that support a certain
features or syntax not present in earlier versions.

In the above case, it may be a good idea to redirect pickle to
the new Strings3 module (see my other message). Likewise, the
Strings test module should redirect to the new Bytes test module
in Python3.

The Unicode and Strings modules should not be loaded in Python3.
Instead, the Bytes and Strings3 modules should be used. This can
be changed in Setup.py of pybench.

--

___
Python tracker 

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



[issue9097] os.chdir(path) to return current dir

2010-06-28 Thread anatoly techtonik

New submission from anatoly techtonik :

os.chdir(path) is often used with os.getcwd() call and doesn't return anything. 
It can return the name of the directory before the change.

prev = os.chdir(path)
...
os.chdir(prev)

Maybe it will also be possible to implement 'with' construct:

with os.chdir(path):
  ...

--
messages: 108822
nosy: techtonik
priority: normal
severity: normal
status: open
title: os.chdir(path) to return current dir
type: feature request

___
Python tracker 

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



[issue8611] Python3 doesn't support locale different than utf8 and an non-ASCII path (POSIX)

2010-06-28 Thread Nick Coghlan

Changes by Nick Coghlan :


--
priority: normal -> release blocker

___
Python tracker 

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



[issue9098] MSYS build fails with `S_IXGRP' undeclared

2010-06-28 Thread Martin Ellison

New submission from Martin Ellison :

Python 2.6.5 build fails on MSYS with the following messages

mar...@edward /c/Downloads/Python-2.6.5
$ make
gcc -c -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes  -
I. -IInclude -I./Include   -DPy_BUILD_CORE -o Python/import.o Python/import.c
Python/import.c: In function `write_compiled_module':
Python/import.c:882: error: `S_IXGRP' undeclared (first use in this function)
Python/import.c:882: error: (Each undeclared identifier is reported only once
Python/import.c:882: error: for each function it appears in.)
Python/import.c:882: error: `S_IXOTH' undeclared (first use in this function)
Python/import.c: In function `PyImport_ImportModuleNoBlock':
Python/import.c:2063: warning: unused variable `me'
make: *** [Python/import.o] Error 1

--
components: Build
messages: 108823
nosy: Martin.Ellison
priority: normal
severity: normal
status: open
title: MSYS build fails with `S_IXGRP' undeclared
versions: Python 2.6

___
Python tracker 

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



[issue9099] multiprocessing/win32:

2010-06-28 Thread Alexander Myodov

New submission from Alexander Myodov :

I am using Python 2.6.5/win32, and working with multiprocessing module, doing 
that with Python interpreter embedded using Cython (if that may be related to 
the problem).

While creating a subprocess and a Pipe to communicate with it, I've got the 
following traceback (particulaly on the line "parent_conn, child_conn = 
Pipe()"):

Traceback (most recent call last):
  File "test_fork.py", line 24, in init test_fork (test_fork.c:810)
vasia.main()
  File "Z:\multiprocessing_cython_w32\vasia.py", line 15, in main
parent_conn, child_conn = Pipe()
  File "Z:\python-win32\2.6.5\Lib\multiprocessing\__init__.py", line 106, in 
Pipe
return Pipe(duplex)
  File "Z:\python-win32\2.6.5\Lib\multiprocessing\connection.py", line 202, in 
Pipe
h2, win32.PIPE_READMODE_MESSAGE, None, None
WindowsError: [Error 0] Success

Lines 202-204 in multiprocessing/connection.py contain the following: 

win32.SetNamedPipeHandleState(  
   
h2, win32.PIPE_READMODE_MESSAGE, None, None 
   
) 

It seems to me that for some reason SetNamedPipeHandleState might be returning 
0 even while it didn't fail actually; a quick check confirmed that it could be 
fixed by changing the above lines to the following:

try:
   
win32.SetNamedPipeHandleState(  
   
h2, win32.PIPE_READMODE_MESSAGE, None, None 
   
)   
   
except WindowsError, e: 
   
(win32) 
  
if e.args[0] != 0: # 0 is error code for SUCCESS
   
raise

--
components: Extension Modules, Windows
messages: 108824
nosy: honeyman
priority: normal
severity: normal
status: open
title: multiprocessing/win32:
type: behavior
versions: Python 2.6

___
Python tracker 

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



[issue8852] _socket fails to build on OpenSolaris x64

2010-06-28 Thread David Kirkby

David Kirkby  added the comment:

Thank you Mark for confirming what I found. 

I understand your reservations about the code if you don't know of its 
correctness. I must admit I don't myself. I don't have a clue how this _socket 
module should be built. 

But it is clear to me that the original code is attempting to compile code 
using PACKET_LOOPBACK, PACKET_FASTROUTE and SIOCGIFNAME, despite they are not 
defined. Although I'm not a mind-reader, I believer the original programmer 
probably thought they were defined in the header file netpacket/packet.h, when 
in fact they are not on Solaris. 

I wish I could take Martin v. Löwis up on his "5-for-one deal", where I review 
5 issues and he deals with this one. Unfortunately, I'm very new to python, so 
really are not going to be a lot of help to anyone in reviewing issues. I will 
just have to keep that patch in Sage until it either gets to the top of 
Martin's TODO list, or someone else deals with it. 

Dave

--

___
Python tracker 

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



[issue9099] multiprocessing/win32: WindowsError: [Error 0] Success on Pipe()

2010-06-28 Thread Alexander Myodov

Alexander Myodov  added the comment:

Sorry for formatting above, a copypaste issue.

The lines 202-204:
win32.SetNamedPipeHandleState(
h2, win32.PIPE_READMODE_MESSAGE, None, None
)

The change that fixes the problem (at least for me):
try:
win32.SetNamedPipeHandleState(
h2, win32.PIPE_READMODE_MESSAGE, None, None
)
except WindowsError, e:
if e.args[0] != 0: # 0 is error code for SUCCESS
raise

--
title: multiprocessing/win32: -> multiprocessing/win32: WindowsError: [Error 0] 
Success on Pipe()

___
Python tracker 

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



[issue9098] MSYS build fails with `S_IXGRP' undeclared

2010-06-28 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

I don't think MSYS (or mingw32) is supported at all.
I'm even surprised that the build went so far.

--
assignee:  -> loewis
nosy: +amaury.forgeotdarc, loewis

___
Python tracker 

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



[issue9100] test_sysconfig fails (test_user_similar)

2010-06-28 Thread Zsolt Cserna

New submission from Zsolt Cserna :

Python 2.7rc2

test_user_similar test in test_sysconfig fails for me. I think it's because I 
have different --exec-prefix and --prefix specified. The test assumes that 
get_config_var('base') is the part of the global_path = get_path('platstdlib', 
'posix_prefix') which is not necessarily true.

I've attached the pdb output containing the variable names.

--
components: Tests
files: pdb_test_user_similar.txt
messages: 108828
nosy: csernazs
priority: normal
severity: normal
status: open
title: test_sysconfig fails (test_user_similar)
versions: Python 2.7
Added file: http://bugs.python.org/file17789/pdb_test_user_similar.txt

___
Python tracker 

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



[issue9097] os.chdir(path) to return current dir

2010-06-28 Thread Brian Curtin

Brian Curtin  added the comment:

-0 for having os.chdir be responsible for the previous directory. I'm not too 
much against this, but it's very easily done in it's current state.

-1 for making os.chdir into a context manager which reverts itself upon exit. 
There are a number of race conditions this would have to handle and I think 
it's better for something like this to be implemented by the user. For example, 
if the original directory gets removed while you are within the block, what is 
the best fallback directory to change to upon exit? For the standard library, I 
don't think we can answer that.

--
nosy: +brian.curtin

___
Python tracker 

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



[issue9098] MSYS build fails with `S_IXGRP' undeclared

2010-06-28 Thread Martin Ellison

Martin Ellison  added the comment:

I thought Python ran everywhere. That's what the documentation says.

Regards,
Martin
(m...@acm.org)

On 28 June 2010 21:00, Amaury Forgeot d'Arc  wrote:

>
> Amaury Forgeot d'Arc  added the comment:
>
> I don't think MSYS (or mingw32) is supported at all.
> I'm even surprised that the build went so far.
>
> --
> assignee:  -> loewis
> nosy: +amaury.forgeotdarc, loewis
>
> ___
> Python tracker 
> 
> ___
>

--
Added file: http://bugs.python.org/file17790/unnamed

___
Python tracker 

___I thought Python ran everywhere. That's what the documentation says.Regards,Martin(mailto:m...@acm.org";>m...@acm.org)
On 28 June 2010 21:00, Amaury Forgeot d'Arc rep...@bugs.python.org> 
wrote:

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

I don't think MSYS (or mingw32) is supported at all.
I'm even surprised that the build went so far.

--
assignee:  -> loewis
nosy: +amaury.forgeotdarc, loewis

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

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



[issue9099] multiprocessing/win32: WindowsError: [Error 0] Success on Pipe()

2010-06-28 Thread R. David Murray

Changes by R. David Murray :


--
nosy: +jnoller

___
Python tracker 

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



[issue9098] MSYS build fails with `S_IXGRP' undeclared

2010-06-28 Thread Brian Curtin

Brian Curtin  added the comment:

> I thought Python ran everywhere. That's what the documentation says.

Python does *run* on Windows (when compiled with Visual Studio or gcc via 
Cygwin), it just might not be setup to build with the MSYS compiler.

--
nosy: +brian.curtin

___
Python tracker 

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



[issue8653] urlparse.urlparse/urlsplit doc missing

2010-06-28 Thread Senthil Kumaran

Senthil Kumaran  added the comment:

Fixed in r82324, r82325, r82326, r82327.
Only the urlunsplit need the docstrings, I added that.

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

___
Python tracker 

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



[issue9101] reference json format in file formats chapter

2010-06-28 Thread anatoly techtonik

New submission from anatoly techtonik :

Quite often people use .json files for storing configuration. Having a 
reference to json module from chapter "14. File Formats" would be a good 
pointer for those looking to .ini alternatives.

--
assignee: d...@python
components: Documentation
messages: 108833
nosy: d...@python, techtonik
priority: normal
severity: normal
status: open
title: reference json format in file formats chapter
versions: Python 2.6, Python 2.7, Python 3.2

___
Python tracker 

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



[issue9102] pybench: Cannot compare 2.x and 3.x benchmarks

2010-06-28 Thread Alexander Belopolsky

New submission from Alexander Belopolsky :

There are several issues that prevent

$ python3 Tools/pybench/pybench.py -s 27.bench -c 32.bench

from working.

1. There is a bug in _pickle that prevents 2.x pickles that contain classic 
class instances from loading in 3.x.  This is addressed in issue5180.

2. Once _pickle issue is addresses, 2.7 benchmark files still cannot be loaded 
because they contain references to the Unicode tests and Unicode.py is not 
loadable in python3.

3. Once Unicode.py gets 2to3 treatment, we are still left with 

* Benchmark versions differ: cannot compare this benchmark to "32.bench" !


The last issue is probably the simplest.  Version number was bumped up in 
r69411, and a log entry says that the intent was to keep pybench 2.1 compatible 
with 2.x.  Indeed, pybench 2.1 from py3k runs under trunk python and resulting 
benchmark file can be compared with 3.x generated benchmark once issues 1 and 2 
above are resolved.  It may, however be worth consideration to synchronize 
pybench versions shipped with 27 and 32.  I understand that this is likely to 
be too late for 2.7, but I am checking 2.7 version in case this is considered 
appropriate for 2.7.1.

The Unicode.py issue was discussed under issue5180 in msg108819 and msg108821.  
I like MAL's suggestion of Strings3 module, but I think it would be useful to 
be able to compare 2.x str performance to both 3.x str and 3.x bytes.  
Similarly, I think String3 should have from __future__ import unicode_literals 
and be loadable in 2.7/2.6 and server as means to compare 2.x and 3.x unicode 
performance.

For the _pickle issue, I am about to attach a patch to issue5180.

--
components: Demos and Tools
messages: 108834
nosy: belopolsky, lemburg, pitrou
priority: normal
severity: normal
stage: needs patch
status: open
title: pybench: Cannot compare 2.x and 3.x benchmarks
type: behavior
versions: Python 2.7, Python 3.2

___
Python tracker 

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



[issue9097] os.chdir(path) to return current dir

2010-06-28 Thread Senthil Kumaran

Senthil Kumaran  added the comment:

-1 on chdir returning a the directory name.
-1 on having it as context manager.

Both are non-intuitive and may not serve any utility value. This can be 
verified by looking the code at the places where these functions are currently 
used. Brian also mentions about the dangers in that approach.
.

--
nosy: +orsenthil

___
Python tracker 

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



[issue9102] pybench: Cannot compare 2.x and 3.x benchmarks

2010-06-28 Thread Alexander Belopolsky

Changes by Alexander Belopolsky :


--
dependencies: +3.1 cannot unpickle 2.7-created pickle

___
Python tracker 

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



[issue9103] API keyword

2010-06-28 Thread anatoly techtonik

New submission from anatoly techtonik :

Need API keyword to filter refused API proposals.
-- 
anatoly t.

--
messages: 108836
nosy: techtonik
priority: normal
severity: normal
status: open
title: API keyword

___
Python tracker 

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



[issue3428] httplib.HTTPMessage undocumented

2010-06-28 Thread ipatrol

ipatrol  added the comment:

What about urllib2? It's explicitly mentioned as the return value of .info()

--

___
Python tracker 

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



[issue9103] API keyword

2010-06-28 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

Please post on meta-tracker.

--
nosy: +benjamin.peterson
resolution:  -> invalid
status: open -> closed

___
Python tracker 

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



[issue9103] API keyword

2010-06-28 Thread anatoly techtonik

anatoly techtonik  added the comment:

Oops. Wrong tracker http://psf.upfronthosting.co.za/roundup/meta/issue341

--

___
Python tracker 

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



[issue9104] test_exceptions does not test pickling with pickle.py

2010-06-28 Thread Alexander Belopolsky

New submission from Alexander Belopolsky :

This is probably one example of many where pickling is only tested with _pickle 
module if it is available rather than separately with C and Python 
implementation.  I am attaching a patch which implements one possible testing 
strategy.  If this is acceptable, I think the machinery of retrieving multiple 
module implementations should be moved to test.support and reused in other test 
modules.

--
components: Library (Lib)
files: test_exceptions.diff
keywords: patch
messages: 108840
nosy: alexandre.vassalotti, belopolsky, pitrou
priority: normal
severity: normal
stage: patch review
status: open
title: test_exceptions does not test pickling with pickle.py
type: feature request
versions: Python 3.2
Added file: http://bugs.python.org/file17791/test_exceptions.diff

___
Python tracker 

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



[issue9097] os.chdir(path) to return current dir

2010-06-28 Thread anatoly techtonik

anatoly techtonik  added the comment:

Brian, in case you remove previous directory - you will get the same exception 
that in the following code.

prev = os.chdir(somepath)
os.rmdir(prev)
os.chdir(prev)

Senthil, your arguments are strange. Both use cases are at least useful for me 
(if not intuitive). I also can't see how can I verify you assumptions by 
looking at the code. If you want to say that not every piece of code need to 
return to parent directory after chdir - that's pretty obvious. If you had a 
list of use cases for os.chdir() - I could go through them to mark where this 
can be used (or not).

label:api

--

___
Python tracker 

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



[issue9104] test_exceptions does not test pickling with pickle.py

2010-06-28 Thread Alexander Belopolsky

Changes by Alexander Belopolsky :


--
nosy: +benjamin.peterson

___
Python tracker 

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



[issue9077] argparse does not handle arguments correctly after --

2010-06-28 Thread Domen Kožar

Domen Kožar  added the comment:

I always used optparse like this, using the rargs (maybe this is not main 
intention, but worked so far):

>>> import optparse
>>> parser = optparse.OptionParser()
>>> parser.add_option('--test', action='store_true')

>>> parser.parse_args(['--test', 'foo', 'foo1', '--', 'foo2', 'foo3'])
(, ['foo', 'foo1', 'foo2', 'foo3'])
>>> parser.rargs
['foo2', 'foo3']
>>> parser.largs
['foo', 'foo1']

--

___
Python tracker 

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



[issue9104] test_exceptions does not test pickling with pickle.py

2010-06-28 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

It looks good on the principle. As you say, factoring out this kind of 
machinery in test.support is probably the way to go.

--

___
Python tracker 

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



[issue3428] httplib.HTTPMessage undocumented

2010-06-28 Thread Senthil Kumaran

Senthil Kumaran  added the comment:

That was a Documentation mistake. Thanks for pointing out.
Corrected it in revision 82334 and merged to other branches.

--

___
Python tracker 

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



[issue9097] os.chdir(path) to return current dir

2010-06-28 Thread Senthil Kumaran

Senthil Kumaran  added the comment:

On Mon, Jun 28, 2010 at 04:50:12PM +, anatoly techtonik wrote:
>I also can't see how can I verify you assumptions by looking at the code.

In the python source:

find -name "*.py" | xargs grep 'os.chdir'

gives 143 instances of its usage. 

I looked a couple of them (subprocess.py, forking.py) and found that
returning a value as per your suggestion would add in an additional
line of code instead of any obvious advantage.

--

___
Python tracker 

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



[issue5180] 3.1 cannot unpickle 2.7-created pickle

2010-06-28 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

I am attaching a patch which focuses on fixing _pickle behavior.   I opened a 
separate issue9102 to deal with pybench specific problems.

Marc-Andre,

I am reassigning this issue to myself and assigning issue9102 to you.  I hope 
you don't mind.

My patch attempts to emulate 2.x PyInstance_NewRaw with a call to tp_alloc.  I 
considered using tp_new, but although __new__ is not special for classic 
classes, there is nothing to prevent users to define __new__ in their classic 
classes or add __new__ when they port these classes to 3.x.  (BTW, I wonder 
what 2to3 does if classic class has __new__ defined.)  This is slightly 
unorthodox use of tp_alloc, so I will follow up with a question on python-dev.

--
assignee: lemburg -> belopolsky
nosy: +mark.dickinson
Added file: http://bugs.python.org/file17792/issue5180.diff

___
Python tracker 

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



[issue9105] pickle security note should be more prominent

2010-06-28 Thread anatoly techtonik

New submission from anatoly techtonik :

Pickle warning about insecurity is located only at the second page near the 
bottom of "Relationship to other Python modules" chapter. For me the proper 
place for it is the first page of documentation.

--
assignee: d...@python
components: Documentation
messages: 108847
nosy: d...@python, techtonik
priority: normal
severity: normal
status: open
title: pickle security note should be more prominent
versions: Python 2.6, Python 2.7, Python 3.2

___
Python tracker 

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



[issue9105] pickle security note should be more prominent

2010-06-28 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

See also issue8855.

I believe Anatoly refers to 

http://docs.python.org/py3k/library/pickle.html

I agree, the warning can be moved up so that it is visible on the first page in 
typical rendering.

Note that there is also

http://docs.python.org/py3k/tutorial/inputoutput.html#the-pickle-module

which contains no warning at all.

--
keywords: +easy
nosy: +belopolsky
stage:  -> needs patch
type:  -> feature request

___
Python tracker 

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



[issue9097] os.chdir(path) to return current dir

2010-06-28 Thread R. David Murray

R. David Murray  added the comment:

In addition, os functions tend to be thin wrappers around system functions, and 
the system chdir does not return the cwd.  Thus we'd be adding code to chdir 
that would be executed every time it was called even though it would only be 
used occasionally.  Given that it only saves one line of python code in those 
same restricted cases, this does not seem like a sensible addition.

You can, of course, write your own function that does this.

The same is true of the idea of a chdir context manager: you can trivially 
write your own if you don't care about the issues Brian raised.  If you do care 
then we'd have to figure out how to handle those issues.  And how to handle 
them is different on different OSes (and I'm not just talking about windows vs 
posix, either; what happens when you delete the cwd differs on the different 
unix flavors).

--
nosy: +r.david.murray

___
Python tracker 

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



[issue9106] remove numbers from 3-.. level entries in docs toc

2010-06-28 Thread anatoly techtonik

New submission from anatoly techtonik :

It seems that left side ToC menu will be more clear without numeric prefixes 
from chapter on 3-.. nesting levels. How about to remove them?

For example - the ToC menu now starting from root level:

15.6. logging — Logging facility for Python
* 15.6.1. Logging tutorial
  o 15.6.1.1. Simple examples
  o 15.6.1.2. Loggers
  o 15.6.1.3. Handlers
  o 15.6.1.4. Formatters
  o 15.6.1.5. Configuring Logging
  o 15.6.1.6. Configuring Logging for a Library
* 15.6.2. Logging Levels
* 15.6.3. Useful Handlers
...

will look like:

15.6. logging — Logging facility for Python
* 1. Logging tutorial
  o 1.1. Simple examples
  o 1.2. Loggers
  o 1.3. Handlers
  o 1.4. Formatters
  o 1.5. Configuring Logging
  o 1.6. Configuring Logging for a Library
* 2. Logging Levels
* 3. Useful Handlers
...

--
assignee: d...@python
components: Documentation
messages: 108850
nosy: d...@python, techtonik
priority: normal
severity: normal
status: open
title: remove numbers from 3-.. level entries in docs toc
versions: Python 2.6, Python 2.7, Python 3.2

___
Python tracker 

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



[issue9105] pickle security note should be more prominent

2010-06-28 Thread anatoly techtonik

anatoly techtonik  added the comment:

Also http://docs.python.org/library/pickle.html

http://docs.python.org/library/logging.html#sending-and-receiving-logging-events-across-a-network
and
http://mail.python.org/pipermail/python-dev/2010-June/101179.html

The link to Nadia blog is also very helpful for investigation of pickle 
problems http://nadiana.com/python-pickle-insecure

--

___
Python tracker 

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



[issue9045] 2.7rc1: 64-bit OSX installer is not built with 64-bit tkinter

2010-06-28 Thread Sridhar Ratnakumar

Sridhar Ratnakumar  added the comment:

On 2010-06-27, at 5:48 AM, Ronald Oussoren wrote:

> Even when building using an SDK you can use frameworks in /Library/Frameworks 
> because $SDKROOT/Library/Frameworks is a symlink to the real 
> /Library/Frameworks.

When building on 10.6, we are relying on Apple's Tcl/Tk 8.5 in 
/System/Library/Frameworks 

But 10.5 SDK only has Tcl/Tk 8.4 (i386+ppc) on a 10.6 machine:
$ ls -l 
/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/Tcl.framework/Versions/
total 8
drwxr-xr-x  3 root  wheel  170 19 Jan 18:21 8.4
lrwxr-xr-x  1 root  wheel3 19 Jan 18:19 Current -> 8.4

For Python 2.7, do you think it is possible to use the (64-bit) Tcl/Tk 8.5 from 
/System/Library/Framework when building with 10.5 SDK on a 10.6 machine?

-srid

--

___
Python tracker 

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



[issue5180] 3.1 cannot unpickle 2.7-created pickle

2010-06-28 Thread Alexander Belopolsky

Changes by Alexander Belopolsky :


Removed file: http://bugs.python.org/file17781/issue5180.diff

___
Python tracker 

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



[issue5180] 3.1 cannot unpickle 2.7-created pickle

2010-06-28 Thread Alexander Belopolsky

Changes by Alexander Belopolsky :


Removed file: http://bugs.python.org/file17788/issue5180-fix.diff

___
Python tracker 

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



[issue5180] 3.1 cannot unpickle 2.7-created pickle

2010-06-28 Thread Alexander Belopolsky

Changes by Alexander Belopolsky :


--
stage: unit test needed -> patch review

___
Python tracker 

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



[issue4963] mimetypes.guess_extension result changes after mimetypes.init()

2010-06-28 Thread S Arrowsmith

S Arrowsmith  added the comment:

I've dug into it -- again -- and my original analysis still holds. Getting 
consistent guess_extension() results across an explicit init() call depends on 
dict.items() returning keys in the same order on two different dictionaries 
(the original, hard-coded types_map and the one created by the first, implicit 
init() call).

Why should this be different on Debian to other Linuxes, even given same data 
as a "working" distribution? Is there something in the implementation details 
of dict.items() which is that distribution dependent?

(A "fix", BTW, is to insert a call to _default_mime_types() either in init() or 
in MimeTypes.__init__ before it calls init().)

--

___
Python tracker 

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



[issue9104] test_exceptions does not test pickling with pickle.py

2010-06-28 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

In the new patch, issue9104.diff, I factored out import machinery into 
test.support.import_module_implementations and added it to a a couple of other 
test modules.  I did not attempt to improve all pickle tests.

The availability of import_module_implementations raises an interesting 
question of what to do in cases like heapq where one can potentially test 4 
combinations of heapq/_heapq with pickle/_pickle.  Given that currently 
pickling of heapq objects is either not supported or not tested, we don't need 
to worry about it, but as parallel optimized/pure python module implementations 
proliferate, we may face exponential explosion of potential test cases.

--
Added file: http://bugs.python.org/file17793/issue9104.diff

___
Python tracker 

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



[issue9107] PyModule_Create not working properly

2010-06-28 Thread Krauzi

New submission from Krauzi :

Hi guys i have a big problem with my code:
PyModule_Create doesnt add any methods to the module (all methods are correctly 
added to the PyMethodDef structure respective the PyModuleDef).
With python 2.6.5 everything works well (Py_InitModule used instead of 
PyModule_Create [+ PyImport_AddModule]).
I looked into the source but everything seems correct there.

The code worked neither Visual Studio 2010 nor on 2008.

--
components: None
messages: 108855
nosy: Krauzi
priority: normal
severity: normal
status: open
title: PyModule_Create not working properly
versions: Python 3.1

___
Python tracker 

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



[issue9104] test_exceptions does not test pickling with pickle.py

2010-06-28 Thread Alexander Belopolsky

Changes by Alexander Belopolsky :


Removed file: http://bugs.python.org/file17793/issue9104.diff

___
Python tracker 

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



[issue9104] test_exceptions does not test pickling with pickle.py

2010-06-28 Thread Alexander Belopolsky

Changes by Alexander Belopolsky :


Added file: http://bugs.python.org/file17794/issue9104.diff

___
Python tracker 

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



[issue2986] difflib.SequenceMatcher not matching long sequences

2010-06-28 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

The discussion on #152807 references two other closed tracker issues:
#1678339 Test case that currently fails
#1678345 Patch to change behavior - rejected because crippled behavior is 
supposedly intentional and removing the change would slow things down.

The patch simply removes the internal heuristic. I think a better patch would 
be to make it optional, with a tunable popularity threshold.

I say 'supposedly intentional' because the code comments only justify the 
popularity hack for code line comparison and give no indication of awareness 
that it disables SequenceMatcher for general purpose use, and in particular, 
for non-toy finite character set comparisons of the type (ascii) used in all 
the examples.

--

___
Python tracker 

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



[issue3430] httplib.HTTPResponse documentations inconsistent

2010-06-28 Thread ThomasH

ThomasH  added the comment:

Still applies. Neither the 2.7 documentation has changed (judging from the 
current online dev docs), nor the implementation (judging from current svn). So 
my first two lists are still valid. I cannot comment on the third, as I don't 
have a 2.7 installation at hand, or will have any time soon.

--
status: pending -> open

___
Python tracker 

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



[issue9094] Make python-m pickletools do something useful

2010-06-28 Thread Alexandre Vassalotti

Alexandre Vassalotti  added the comment:

Good idea! 

You can remove the doctest behavior. I don't think it is useful. But if you 
remove it, make sure you add an usage message when no argument is given.

--

___
Python tracker 

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



[issue9045] 2.7rc1: 64-bit OSX installer is not built with 64-bit tkinter

2010-06-28 Thread Sridhar Ratnakumar

Sridhar Ratnakumar  added the comment:

I tried patching setup.py to force linking to Apple's Tcl/Tk:

--- python/setup.py.original2010-06-28 11:40:26.0 -0700
+++ python/setup.py 2010-06-28 11:45:39.0 -0700
@@ -1682,6 +1682,15 @@
 for F in framework_dirs:
 # both Tcl.framework and Tk.framework should be present
 
+# When building for 64-bit (presumably on 10.6, with 10.5 SDK),
+# skip the SDK Tcl/Tk and instead use the one on /System/Library
+# which is Apple's Tcl/Tk 8.5 with 64-bit.
+if PT_CONFIG_mac_64bit:
+F = '/System/Library/Frameworks/' # force Apple's one
+for fw in 'Tcl', 'Tk':
+if not exists(join(F, fw + '.framework')):
+raise IOError('No %s found in %s' % (fw, F))
+break
 
 for fw in 'Tcl', 'Tk':
 if is_macosx_sdk_path(F):


But unfortunately, even though we use 8.5 header files ... the link line uses 
`-isysroot`, thereby linking to 8.4:

gcc -arch i386 -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.5.sdk/ -isysroot 
/Developer/SDKs/MacOSX10.5.sdk/ -bundle -undefined dynamic_lookup -arch i386 
-arch x86_64 -isysroot /Developer/SDKs/MacOSX10.5.sdk/ -isysroot 
/Developer/SDKs/MacOSX10.5.sdk/ 
build/temp.macosx-10.5-intel-2.7/Users/sridharr/as/apy/trunk/build/pyhg_trunk-macosx-hgtip27/python/Modules/_tkinter.o
 
build/temp.macosx-10.5-intel-2.7/Users/sridharr/as/apy/trunk/build/pyhg_trunk-macosx-hgtip27/python/Modules/tkappinit.o
 -L/Library/Frameworks/Python.framework/Versions/2.7/lib -o 
build/lib.macosx-10.5-intel-2.7/_tkinter.so -framework Tcl -framework Tk
ld: warning: in 
/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks//Tk.framework/Tk, 
missing required architecture x86_64 in file
*** WARNING: renaming "_tkinter" since importing it failed: 
dlopen(build/lib.macosx-10.5-intel-2.7/_tkinter.so, 2): Symbol not found: 
_Tk_GetNumMainWindows

--

___
Python tracker 

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



[issue9104] test_exceptions does not test pickling with pickle.py

2010-06-28 Thread Alexandre Vassalotti

Alexandre Vassalotti  added the comment:

The code for import_module_implementations seems a bit fragile. Prefixing the 
module name with an underscore might not always yield the name of the optimized 
implementation.  An explicit dictionary to map the Python and C implementations 
may be a better approach.

Otherwise, the code looks good. Feel free to commit it.

--

___
Python tracker 

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



[issue3430] httplib.HTTPResponse documentations inconsistent

2010-06-28 Thread Senthil Kumaran

Senthil Kumaran  added the comment:

Yes, I know httplib documentation needs improvement. There is a great deal of 
documentation in the module itself. A lot can be .rst'ifed.

--
assignee: georg.brandl -> orsenthil
nosy: +orsenthil
resolution:  -> accepted
stage:  -> needs patch
versions: +Python 2.6, Python 2.7, Python 3.1, Python 3.2 -Python 2.5

___
Python tracker 

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



[issue655802] cPickle not always same as pickle

2010-06-28 Thread Alexandre Vassalotti

Alexandre Vassalotti  added the comment:

It's a documentation enhancement request. The updated documentation in Python 3 
for pickle added most of the requested details.

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

___
Python tracker 

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



[issue9098] MSYS build fails with `S_IXGRP' undeclared

2010-06-28 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

Martin (Ellison): What people are trying to say is that likely, nobody will be 
working on this, and likely so for the next few years. So unless you volunteer 
to provide a patch, I recommend to close the issue as "won't fix". Unassigning 
myself.

--
assignee: loewis -> 

___
Python tracker 

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



[issue1536] pickle's documentation is severely outdated

2010-06-28 Thread Alexandre Vassalotti

Alexandre Vassalotti  added the comment:

The new documentation for pickle in Python 3 fixes this.

I still believe we should outline the differences between pickle.py and 
cPickle. But at this point, it's unlikely I will put the time to do it. Feel 
free to open a new issue if you want this to be done.

--
resolution:  -> fixed
status: open -> closed
versions:  -Python 2.6, Python 3.0

___
Python tracker 

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



[issue3428] httplib.HTTPMessage undocumented

2010-06-28 Thread ThomasH

ThomasH  added the comment:

> Actually urllib.urlopen.info method return a mimetools.Message instance

But the urllib.rst documentation is still flawed:

"The :meth:`info` method returns an instance of the class 
:class:`httplib.HTTPMessage`"

(http://svn.python.org/view/python/trunk/Doc/library/urllib.rst?revision=81775&view=markup)

--

___
Python tracker 

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



[issue5180] 3.1 cannot unpickle 2.7-created pickle

2010-06-28 Thread Alexandre Vassalotti

Alexandre Vassalotti  added the comment:

Thank you for the nice investigative work! 

I will try my best to review this patch by next week.

--

___
Python tracker 

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



[issue6589] smtpd.SMTPServer can cause asyncore.loop to enter infinite event loop

2010-06-28 Thread Casey McGinty

Casey McGinty  added the comment:

This is how it gets in an "invalid state". Not sure why you can't look at the 
code and see the mistake.

"There is no code in the
SMTPServere.__init__ method that catches the exception raised, caused by
the failed bind attempt. After the exception is caught, the first thread
continues to run, but asyncore is in an invalid state because it still
has the registration of the second SMTPServer instance that never completed."

As far as running in a thread. I have a program that needs must start and stop 
the SMTPServer dynamically. I did this by putting SMTPServer in a thread. Maybe 
there is another way to do it, but if you are not going to support this, then 
it should be documented.

--

___
Python tracker 

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



[issue9097] os.chdir(path) to return current dir

2010-06-28 Thread Eric Smith

Eric Smith  added the comment:

-1 on this functionality being in os, for the same reasons David mentions.

I find both of these behaviors useful and I have small utility functions of my 
own that do the same (and ignore any errors). I'm not so sure they need to be 
in stdlib, though. As mentioned, you need to either handle the errors, or do 
what I do and just fail if any of these conditions arise.

--
nosy: +eric.smith

___
Python tracker 

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



[issue9107] PyModule_Create not working properly

2010-06-28 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

The issue tracker is not here to get help.
Please ask your question on the comp.lang.python newgroup, or the python-list 
mailing list.

There, I think you will have to show part of your code; there will certainly be 
several people willing to help you.

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

___
Python tracker 

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



[issue3385] cPickle to pickle conversion in py3k missing methods

2010-06-28 Thread Alexandre Vassalotti

Alexandre Vassalotti  added the comment:

> Do I understand correctly that the issue is that python
> Pickler class has dispatch attribute but C Pickler does
> not?

Yes.

> The add_dispatch_check-0.patch patch does not seem
> to add class attribute, it adds an instance attribute
> instead.

I know. That's why I said it was a preliminary patch. :-) Also, see msg71159 
about the class vs instance attribute issue.

There's a lot of code out there that do crazy things with pickle's dispatch 
dictionary. For now, it is best if we leave the method names alone. If people 
wants to keep doing their funky stuff with pickle, then we can point them to 
pickle._Pickler and pickle._Unpickler, which will always point to the Python 
implementations.

That said, I do not believe it's a good idea to add the dispatch attribute to 
_pickle anymore. But, I acknowledge there is a need for overriding the pickling 
mechanism for specific types. We should find a clean way to support this.

I am closing this issue as "won't fix".

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

___
Python tracker 

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



[issue9106] remove numbers from 3-.. level entries in docs toc

2010-06-28 Thread Ezio Melotti

Changes by Ezio Melotti :


--
nosy: +ezio.melotti
stage:  -> needs patch
type:  -> behavior

___
Python tracker 

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



[issue8943] Bug in InteractiveConsole

2010-06-28 Thread Alexandre Vassalotti

Alexandre Vassalotti  added the comment:

One easy fix for this would be to make InteractiveConsole use the string 
"__main__" instead of "__console__". But other than that, I don't think we can 
fix this within pickle.

--

___
Python tracker 

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



[issue9108] list object variable assign with multiplication sign

2010-06-28 Thread muzuiget

New submission from muzuiget :

platform: ubuntu 10.04 amd64, python 2.6.5 r265:79063

run below code 

a = [{}, {}, {}]
b = [{}] + [{}] + [{}]
c = [{}] * 3
print a, len(a), type(a)
print b, len(b), type(b)
print c, len(c), type(c)
a[1]["test"] = 1234
b[1]["test"] = 1234
c[1]["test"] = 1234
print a
print b
print c

the output is 

[{}, {}, {}] 3 
[{}, {}, {}] 3 
[{}, {}, {}] 3 
[{}, {'test': 1234}, {}]
[{}, {'test': 1234}, {}]
[{'test': 1234}, {'test': 1234}, {'test': 1234}]

each dict key in variable c seen to assign with the same value.

--
components: None
messages: 108872
nosy: muzuiget
priority: normal
severity: normal
status: open
title: list object variable assign with multiplication sign
type: compile error
versions: Python 2.6

___
Python tracker 

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



[issue9108] list object variable assign with multiplication sign

2010-06-28 Thread Ezio Melotti

Ezio Melotti  added the comment:

That's because with [{}] * 3 you get a list with 3 copies of the same object, 
so all the elements in c refer to the same dict:
>>> a = [{}, {}, {}]
>>> b = [{}] + [{}] + [{}]
>>> c = [{}] * 3
>>> map(id, a)
[12850496, 12850784, 12850928]
>>> map(id, b)
[12851648, 12851072, 12851792]
>>> map(id, c)
[12852080, 12852080, 12852080]

--
nosy: +ezio.melotti
resolution:  -> invalid
stage:  -> committed/rejected
status: open -> closed

___
Python tracker 

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



[issue9109] absolute import cleanups for Python 3

2010-06-28 Thread Neil Schemenauer

New submission from Neil Schemenauer :

It looks like there is a bunch of legacy relative import cruft kicking around 
in Python 3.  The first thing I noticed is that __import__.__doc__ claims that 
level=-1 is the default (i.e. use the Python 2 behavior).  A little testing 
shows that the docs don't lie and __import__ in Python 3 defaults trying a 
relative import first.

What is the status of implicit relative imports in Python 3?  Can the level=-1 
code be removed?

--
components: Interpreter Core
messages: 108874
nosy: nas
priority: normal
severity: normal
status: open
title: absolute import cleanups for Python 3
type: behavior
versions: Python 3.3

___
Python tracker 

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



[issue9109] absolute import cleanups for Python 3

2010-06-28 Thread Neil Schemenauer

Changes by Neil Schemenauer :


--
assignee:  -> brett.cannon
nosy: +brett.cannon -nas

___
Python tracker 

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



[issue9109] absolute import cleanups for Python 3

2010-06-28 Thread Eric Smith

Changes by Eric Smith :


--
nosy: +eric.smith

___
Python tracker 

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



[issue9109] absolute import cleanups for Python 3

2010-06-28 Thread Brett Cannon

Brett Cannon  added the comment:

Having level=-1 doesn't even work in Python 3 like it did in Python 2 (it seems 
to just act as if level is 0), so yes the -1 code can be removed. Probably need 
all values less than 0 to get rounded up to 0 for backwards-compatibility with 
Python 2.x code which calls __import__ directly.

--
versions: +Python 3.2 -Python 3.3

___
Python tracker 

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



[issue9109] absolute import cleanups for Python 3

2010-06-28 Thread Brett Cannon

Changes by Brett Cannon :


--
stage:  -> unit test needed

___
Python tracker 

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



[issue9109] absolute import cleanups for Python 3

2010-06-28 Thread Brett Cannon

Changes by Brett Cannon :


--
assignee: brett.cannon -> 

___
Python tracker 

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



[issue4151] Separate build dir broken

2010-06-28 Thread Neil Schemenauer

Neil Schemenauer  added the comment:

I believe the latest problem reported has been fixed by SVN rev 80649.

--
assignee:  -> nascheme
nosy:  -nas
stage:  -> committed/rejected

___
Python tracker 

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



[issue9110] contextlib.ContextDecorator

2010-06-28 Thread Michael Foord

New submission from Michael Foord :

Patch to add a ContextDecorator class to contextlib. This allows context 
managers that inherit from ContextDecorator (including using it as a mixin) to 
be used as decorators as well as context managers.

Context managers inheriting from ContextDecorator still have to implement 
__enter__ and __exit__ as normal. As the decorator behaviour is implemented 
using a with statement __exit__ retains its optional exception handling even 
when used as a decorator.

In addition contextlib.GeneratorContextManager, used to implement 
contextlib.contextmanager, inherits from ContextDecorator. Context managers 
created with contextlib.contextmanager can therefore be used as decorators too.

--
assignee: michael.foord
components: Library (Lib)
files: contextdecorator.patch
keywords: patch
messages: 108877
nosy: michael.foord, ncoghlan
priority: normal
severity: normal
stage: patch review
status: open
title: contextlib.ContextDecorator
type: behavior
versions: Python 3.2
Added file: http://bugs.python.org/file17795/contextdecorator.patch

___
Python tracker 

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



[issue9094] Make python-m pickletools do something useful

2010-06-28 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Well, assuming you want to make it useful, I'd make that behaviour depend on a 
command-line option, such that other actions can be added later.

--
nosy: +pitrou

___
Python tracker 

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



[issue9110] contextlib.ContextDecorator

2010-06-28 Thread Michael Foord

Changes by Michael Foord :


Added file: http://bugs.python.org/file17796/docs.patch

___
Python tracker 

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



[issue5180] 3.1 cannot unpickle 2.7-created pickle

2010-06-28 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> My patch attempts to emulate 2.x PyInstance_NewRaw with a call to
> tp_alloc.

This is certainly the wrong thing to do. You could at least try 
PyBaseObject_Type.tp_new (see object_new() in typeobject.c), but even this is 
not necessarily right (for example if the class is derived from an extension 
type defining its own tp_new).

So, IMO, the right thing to do would be to choose the first base type that 
isn't a Python-defined class and use its tp_new:

staticbase = subtype;
while (staticbase && (staticbase->tp_flags & Py_TPFLAGS_HEAPTYPE))
staticbase = staticbase->tp_base;

(these two lines are from tp_new_wrapper() in typeobject.c)

That way you choose the right constructor function, yet don't call the 
Python-defined __new__ function. That's the only reasonable way of doing it I 
can imagine. It also follows the following behaviour:

>>> class C(int):
...   def __new__(cls, *a):
... print "__new__", a
... return int.__new__(cls, *a)
... 
>>> C(5)
__new__ (5,)
5
>>> s = pickle.dumps(C(5))
__new__ (5,)
>>> x = pickle.loads(s)
>>> x
5

As you can see, int.__new__ has been called on unpickling but not C.__new__ (no 
print).

--

___
Python tracker 

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



[issue5180] 3.1 cannot unpickle 2.7-created pickle

2010-06-28 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

(and to follow on my example, I'd point that the unpickled instance is still an 
instance of the right class:

>>> type(x)


)

--

___
Python tracker 

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



[issue9104] test_exceptions does not test pickling with pickle.py

2010-06-28 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> An explicit dictionary to map the Python and C implementations may be a 
> better approach.

+1.

--

___
Python tracker 

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



[issue9045] 2.7rc1: 64-bit OSX installer is not built with 64-bit tkinter

2010-06-28 Thread Sridhar Ratnakumar

Sridhar Ratnakumar  added the comment:

Here's one resolution:

1. Edit setup.py to make INCLUDE/LIB paths for OpenSSL use the SDKROOT (for 
10.5+ compat):
[...]
search_for_ssl_incs_in = ["/Developer/SDKs/MacOSX10.5.sdk/usr/include/" if 
ON_SNOW_LEOPARD else "/usr/include"]
search_for_ssl_libs_in = ["/Developer/SDKs/MacOSX10.5.sdk/usr/lib/" if 
ON_SNOW_LEOPARD else "/usr/lib"]

2. Force the 10.5 SDK to use Apple's Tcl/Tk 8.5 (10.5 users must install 
ActiveTcl, and then launch Python as "arch -i386 python2.7" if they want to use 
tkinter):

$ sudo ln -s /System/Library/Frameworks/Tcl.framework 
/Developer/SDKs/MacOSX10.5.sdk/Library/Frameworks/

$ sudo ln -s /System/Library/Frameworks/Tk.framework 
/Developer/SDKs/MacOSX10.5.sdk/Library/Frameworks/

3. Build with 10.5 SDK

$ export MACOSX_DEPLOYMENT_TARGET=10.5
$ ./configure --enable-framework 
--enable-universalsdk=/Developer/SDKs/MacOSX10.5.sdk/ 
--with-universal-archs=intel
$ make

And the result is a Python that works on 10.5+ and gives you 64-bit Tkinter for 
10.6 users.

This is how I am intending to build ActivePython 2.7 this weekend.

--

___
Python tracker 

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



[issue9111] cmd.do_help documentation should mention docstrings

2010-06-28 Thread Miki Tebeka

New submission from Miki Tebeka :

cmd.Cmd looks for help either by searching for help_XXX method or by the
docstring of do_XXX. The latter is not mentioned in the docs.

--
components: Library (Lib)
messages: 108883
nosy: tebeka
priority: normal
severity: normal
status: open
title: cmd.do_help documentation should mention docstrings
versions: Python 2.5, Python 2.6, Python 2.7

___
Python tracker 

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



[issue9094] Make python-m pickletools do something useful

2010-06-28 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

> Well, assuming you want to make it useful, I'd make that
> behaviour depend on a command-line option, ..

OK, Antoine, you asked for it. :-)

issue9094.diff

--
Added file: http://bugs.python.org/file17797/issue9094.diff

___
Python tracker 

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



[issue5180] 3.1 cannot unpickle 2.7-created pickle

2010-06-28 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

On Mon, Jun 28, 2010 at 7:32 PM, Antoine Pitrou  wrote:
>> My patch attempts to emulate 2.x PyInstance_NewRaw with a call to
>> tp_alloc.
>
> This is certainly the wrong thing to do. You could at least try
> PyBaseObject_Type.tp_new (see object_new() in typeobject.c), but
> even this is not necessarily right (for example if the
> class is derived from an extension type defining its own tp_new).

Well, this is not so obviously wrong as you make it sound.  If you look closer 
at object_new(), you will see that in sane situations it reduces to 
type->tp_alloc(type, 0) call.  Remember, this is called in very special 
circumstances: when unpickling old style class instances from a 2.x generated 
pickle.  No arguments are available for tp_new call, so excess_args check does 
not apply.  The other check is for an ABC, but the situation where an old-style 
class becomes an ABC in 2.x to 3.x transition is hardly sane.  If such sanity 
check is necessary, I would rather check the flag explicitly in _pickle.c 
rather than having to generate dummy args and kwds to satisfy tp_new signature.

>
> So, IMO, the right thing to do would be to choose the first base
> type that isn't a Python-defined class and use its tp_new:
>
>    staticbase = subtype;
>    while (staticbase && (staticbase->tp_flags & Py_TPFLAGS_HEAPTYPE))
>        staticbase = staticbase->tp_base;
>
> (these two lines are from tp_new_wrapper() in typeobject.c)
>

This looks like overengineering to me.  I think 3.x should simply refuse to 
unpickle old style class instances into anything that is not subclassed in 
python directly from object.  It would be helpful at this point if you could 
provide a test case where tp_alloc logic does not work.  Regardless of what 
algorithm we ultimately choose, I would like to include such test in regrtest.

PS: Note that in my patch I've eliminated one control path that was calling 
instantiate(..) erroneously, but I have not reviewed the code carefully enough 
to eliminate the possibility that instantiate(..) would be called to 
instantiate new-style class instances.

PPS: What is you opinion on the pickle.py trick of monkey patching __class__ on 
an instance of an empty class?  Do you think this can be fooled?

--

___
Python tracker 

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



[issue9106] remove numbers from 3-.. level entries in docs toc

2010-06-28 Thread R. David Murray

R. David Murray  added the comment:

-1

--
nosy: +r.david.murray

___
Python tracker 

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



[issue2236] Distutils' mkpath implementation ignoring the "mode" parameter

2010-06-28 Thread Greg Ward

Greg Ward  added the comment:

> Is it too late for 2.7?

I have no idea.

It does look as though someone has written unit tests for distutils, so the 
patch needs a test change too.  Henrique?

--
stage:  -> unit test needed

___
Python tracker 

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



[issue6589] smtpd.SMTPServer can cause asyncore.loop to enter infinite event loop

2010-06-28 Thread R. David Murray

R. David Murray  added the comment:

If you can provide a short example that reproduces the problem it will be much 
more likely to get fixed.

--
nosy: +r.david.murray
stage:  -> unit test needed
type:  -> behavior

___
Python tracker 

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



[issue1581183] pickle protocol 2 failure on int subclass

2010-06-28 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

I reproduced the problem in py3k (both protocol 2 and 3).  See 
issue1581183-test-py3k.py attached.

--
nosy: +alexandre.vassalotti, belopolsky
versions: +Python 3.2
Added file: http://bugs.python.org/file17798/issue1581183-test-py3k.py

___
Python tracker 

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



[issue960821] Add an updating load function in pickle

2010-06-28 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

This functionality already exists.  

"""
If a string is returned [from __reduce__() method], the string should be 
interpreted as the name of a global variable. It should be the object’s local 
name relative to its module; the pickle module searches the module namespace to 
determine the object’s module. This behaviour is typically useful for 
singletons.
""" -- http://docs.python.org/dev/py3k/library/pickle.html

--
assignee:  -> belopolsky
nosy: +belopolsky
resolution:  -> invalid
status: open -> pending

___
Python tracker 

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



[issue9106] remove numbers from 3-.. level entries in docs toc

2010-06-28 Thread anatoly techtonik

anatoly techtonik  added the comment:

> R. David Murray  added the comment:
>
> -1

Why? Do you like wrapped menu entries three lines long?

--

___
Python tracker 

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



[issue5212] Incorrect note about md5 in hmac module documentation

2010-06-28 Thread .:. brainsik

.:. brainsik  added the comment:

Since the note is incorrect, it seems like it should be removed. What "results 
it is based on" are you referring to and what complaints are you concerned 
about?

--

___
Python tracker 

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



[issue5212] Incorrect note about md5 in hmac module documentation

2010-06-28 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

The supposed 'known weaknesses'. I have no particular opinion.
Anyway, we have your recommendation: remove the note.
I will let others defend it.

--

___
Python tracker 

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