[issue9951] introduce bytes.hex method

2010-10-02 Thread Nick Coghlan

Changes by Nick Coghlan ncogh...@gmail.com:


--
nosy: +ncoghlan

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



[issue9951] introduce bytes.hex method

2010-10-02 Thread Nick Coghlan

Nick Coghlan ncogh...@gmail.com added the comment:

Patch generally looks good, but the type of retbuf is incorrect (should be 
Py_UNICODE* rather than wchar_t*).

--

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



[issue6612] 'import site' fails when called from an unlinked directory

2010-10-02 Thread Amaury Forgeot d'Arc

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

A unit test is needed. Not to check the code, but to ensure that we don't break 
it in the future.

--
nosy: +amaury.forgeotdarc

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



[issue1767933] Badly formed XML using etree and utf-16

2010-10-02 Thread Amaury Forgeot d'Arc

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

Python 3.1 improves the situation, the file looks more like utf-16, except that 
the BOM (\xff\xfe) is repeated all the time, probably on every internal call 
to file.write().

Here is a test script that should work on both 2.7 and 3.1.

from io import BytesIO
from xml.etree.ElementTree import ElementTree
content = ?xml version='1.0' encoding='UTF-16'?html/html
input = BytesIO(content.encode('utf-16'))
tree = ElementTree()
tree.parse(input)
# Write content
output = BytesIO()
tree.write(output, encoding=utf-16)
assert output.getvalue().decode('utf-16') == content

--
stage: unit test needed - needs patch

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



[issue10013] fix `./libpython2.6.so: undefined re ference to `_PyParser_Grammar´` in parallel builds

2010-10-02 Thread Paul Menzel

New submission from Paul Menzel paulepan...@users.sourceforge.net:

Compiling Python in parallel sometimes fails as reported in [1] and [2].

./libpython2.6.so: undefined reference to `_PyParser_Grammar´

Fedora applies a patch by dmalcolm dmalc...@fedoraproject.org which fixes 
this issue [3].

diff -up Python-2.7/Makefile.pre.in.fix-parallel-make 
Python-2.7/Makefile.pre.in
--- Python-2.7/Makefile.pre.in.fix-parallel-make2010-07-22 
15:01:39.567996932 -0400
+++ Python-2.7/Makefile.pre.in  2010-07-22 15:47:02.437998509 -0400
@@ -207,6 +207,7 @@ SIGNAL_OBJS=@SIGNAL_OBJS@
 
 ##
 # Grammar
+GRAMMAR_STAMP= $(srcdir)/grammar-stamp
 GRAMMAR_H= $(srcdir)/Include/graminit.h
 GRAMMAR_C= $(srcdir)/Python/graminit.c
 GRAMMAR_INPUT= $(srcdir)/Grammar/Grammar
@@ -530,10 +531,24 @@ Modules/getpath.o: $(srcdir)/Modules/get
 Modules/python.o: $(srcdir)/Modules/python.c
$(MAINCC) -c $(PY_CFLAGS) -o $@ $(srcdir)/Modules/python.c
 
+# GNU make interprets rules with two dependents as two copies of the 
rule.
+# 
+# In a parallel build this can lead to pgen being run twice, once for each 
of
+# GRAMMAR_H and GRAMMAR_C, leading to race conditions in which the compiler
+# reads a partially-overwritten copy of one of these files, leading to 
syntax
+# errors (or linker errors if the fragment happens to be syntactically 
valid C)
+#
+# See 
http://www.gnu.org/software/hello/manual/automake/Multiple-Outputs.html
+# for more information
+#
+# Introduce .grammar-stamp as a contrived single output from PGEN to 
avoid
+# this:
+$(GRAMMAR_H) $(GRAMMAR_C): $(GRAMMAR_STAMP)
 
-$(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT)
+$(GRAMMAR_STAMP): $(PGEN) $(GRAMMAR_INPUT)
-...@$(INSTALL) -d Include
-$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
+   touch $(GRAMMAR_STAMP)
 
 $(PGEN):   $(PGENOBJS)
$(CC) $(OPT) $(LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN)

Could you please apply it. Could this also be applied to 2.6.x?


[1] http://doc.services.openoffice.org/wiki/RedTinderboxStatusInEIS
[2] http://www.openoffice.org/issues/show_bug.cgi?id=114866
[3] 
http://pkgs.fedoraproject.org/gitweb/?p=python.git;a=commit;h=b95f6cc2ca6a009f97436c6aa16cfd70547353d9

--
components: Build
messages: 117865
nosy: PaulePanter
priority: normal
severity: normal
status: open
title: fix `./libpython2.6.so: undefined reference to `_PyParser_Grammar´` in 
parallel builds
type: compile error
versions: Python 2.6

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



[issue8670] c_types.c_wchar should not assume that sizeof(wchar_t) == sizeof(Py_UNICODE)

2010-10-02 Thread STINNER Victor

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

r85172 changes PyUnicode_AsWideCharString() (don't count the trailing nul 
character in the output size) and add unit tests.

r85173 patches unicode_aswidechar() to supports non-BMP characters for all 
known wchar_t/Py_UNICODE size combinaisons (2/2, 2/4 and 4/2).

I noticed that PyUnicode_AsWideChar() and PyUnicode_AsWideCharString() accept 
embeded nul characters. I don't know if it is a bug or an expected behaviour. 
Anyway, there is now a test for this case.

--

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



[issue10013] fix `./libpython2.6.so: undefined re ference to `_PyParser_Grammar´` in parallel builds

2010-10-02 Thread Martin v . Löwis

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

2.6 is closed for bug fixes, so this cannot be applied anymore.

Notice that py3k has this fixed in r84068; I'll backport the fix to 2.7.

--
nosy: +loewis

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



[issue8670] c_types.c_wchar should not assume that sizeof(wchar_t) == sizeof(Py_UNICODE)

2010-10-02 Thread STINNER Victor

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

r85174+r85177: ctypes.c_wchar supports non-BMP characters with 32 bits wchar_t 
= fix this issue

(I commited also an unwanted change on _testcapi to fix r85172 in r85174: 
r85175 reverts this change, and r85176 fixes the _testcapi bug again)

--
resolution:  - fixed
status: open - closed

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



[issue8670] c_types.c_wchar should not assume that sizeof(wchar_t) == sizeof(Py_UNICODE)

2010-10-02 Thread STINNER Victor

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

 r85173 patches unicode_aswidechar() to supports non-BMP characters 
 for all known wchar_t/Py_UNICODE size combinaisons (2/2, 2/4 and 4/2).

Oh, and 4/4 ;-)

--

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



[issue10013] fix `./libpython2.6.so: undefined re ference to `_PyParser_Grammar´` in parallel builds

2010-10-02 Thread R. David Murray

Changes by R. David Murray rdmur...@bitdance.com:


--
nosy: +dmalcolm

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



[issue10014] sys.path[0] is incorrect if PYTHONFSENCODING is used

2010-10-02 Thread STINNER Victor

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

In the following example, sys.path[0] should be 
'/home/SHARE/SVN/py3k\udcc3\udca9' (my locale and filesystem encodings are 
utf-8):

$ cd /home/SHARE/SVN/py3ké
$ echo import sys; print(sys.path[0])  x.py
$ ./python x.py
/home/SHARE/SVN/py3ké
$ PYTHONFSENCODING=ascii ./python x.py
/home/SHARE/SVN/py3ké

The problem is that PySys_SetArgvEx() inserts argv[0] at sys.path[0], but 
argv[0] is decoded using the locale encoding (by _Py_char2wchar() in main()), 
whereas paths of sys.path are supposed to be encodable (and decoded) by 
sys.getfilesystemencoding().

argv array should be decoded using the filesystem encoding (see issue #9992) or 
argv[0] should be redecoded (encode to the locale encoding, and decode from the 
filesystem encoding, see issue #9630).

--
components: Unicode
messages: 117870
nosy: haypo
priority: normal
severity: normal
status: open
title: sys.path[0] is incorrect if PYTHONFSENCODING is used
versions: Python 3.2

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



[issue9992] Command line arguments are not correctly decodedif locale and fileystem encodings aredifferent

2010-10-02 Thread STINNER Victor

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

See also #10014: sys.path[0] is decoded from the locale encoding instead of the 
fileystem encoding.

--

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



[issue9533] metaclass can't derive from ABC

2010-10-02 Thread Antoine Pitrou

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


--
nosy: +benjamin.peterson

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



[issue8670] c_types.c_wchar should not assume that sizeof(wchar_t) == sizeof(Py_UNICODE)

2010-10-02 Thread Daniel Stutzbach

Daniel Stutzbach dan...@stutzbachenterprises.com added the comment:

Thanks for working on this!

Since this was a bugfix, it should be merged back into 2.7, yes?

--
stage: unit test needed - committed/rejected

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



[issue6706] asyncore's accept() is broken

2010-10-02 Thread Giampaolo Rodola'

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

Patch in attachment adds a handled_accepted() method to dispatcher class as 
recommended by Antoine.

--
Added file: http://bugs.python.org/file19104/accept.patch

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



[issue10011] `except` doesn't use `isinstance`

2010-10-02 Thread Ram Rachum

Ram Rachum cool...@cool-rr.com added the comment:

Also, how important is the performance of exception checking *after* an 
exception was raised? I mean, wouldn't it matter only for programs that raise 
and catch hundreds of exceptions a second?

--

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



[issue10015] Creating a multiproccess.pool.ThreadPool from a child thread blows up.

2010-10-02 Thread Michael Olson

New submission from Michael Olson ol...@irinim.net:

Using Python 2.7 x32 on Windows XP

Attempting to create a multiprocessing.pool.ThreadPool
in a child thread created using threading.Thread, an
AttributeError is thrown. A ThreadPool created in the 
main thread can be passed to the child thread and used.


Exact text of exception
---
  File D:\Dev\Python27\lib\multiprocessing\dummy\__init__.py, line 47, in star
t
self._parent._children[self] = None
AttributeError: 'Thread' object has no attribute '_children'


Demonstration Code
---
import unittest
from threading import Thread
from multiprocessing.pool import ThreadPool


def f(x):
return x*x


def create_and_run(cb, pool = None):
if not pool:
pool = ThreadPool(2)
r = pool.map_async(f, range(10))
cb(r.get())


class TestThreadPool(unittest.TestCase):
def setUp(self):
self.expected = [f(x) for x in range(10)]

def callback(self, data):
self.data = data

def test_creating_pool_in_mainthread(self):
Test multiprocessing.pool.ThreadPool from main thread
self.data = None
create_and_run(self.callback)
self.assertEqual(self.data, self.expected)

def test_creating_pool_in_subthread(self):
Test multiprocessing.pool.ThreadPool from a child thread.
self.data = None
t = Thread(target=create_and_run, args=[self.callback])
t.start()
t.join()
self.assertEqual(self.data, self.expected)

def test_creating_pool_in_subthread_workaround(self):
Test running a ThreadPool created in main thread, used in child.
self.data = None
pool = ThreadPool(2)
t = Thread(target=create_and_run, args=[self.callback, pool])
t.start()
t.join()
self.assertEqual(self.data, self.expected)


if __name__ =='__main__':
suite = unittest.TestLoader().loadTestsFromTestCase(TestThreadPool)
unittest.TextTestRunner(verbosity=2).run(suite)

--
components: Library (Lib)
files: potential_issue_demo.py
messages: 117875
nosy: Michael.Olson
priority: normal
severity: normal
status: open
title: Creating a multiproccess.pool.ThreadPool from a child thread blows up.
type: crash
versions: Python 2.7
Added file: http://bugs.python.org/file19105/potential_issue_demo.py

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



[issue9807] deriving configuration information for different builds with the same prefix

2010-10-02 Thread Arfrever Frehtes Taifersar Arahesis

Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com:


--
nosy: +Arfrever

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



[issue5117] os.path.relpath problem with root directory

2010-10-02 Thread Hirokazu Yamamoto

Hirokazu Yamamoto ocean-c...@m2.ccsnet.ne.jp added the comment:

In py3k, ntpath is almost fixed. but posixpath is not fixed yet.
ntpath has another problem about case sensitivity. I'll attach
the patch to fix ntpath's case issue and posixpath.

In Py27, ntpath has whole issue still there.

--
Added file: http://bugs.python.org/file19106/py3k_fix_relpath.patch

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



[issue5117] os.path.relpath problem with root directory

2010-10-02 Thread Hirokazu Yamamoto

Hirokazu Yamamoto ocean-c...@m2.ccsnet.ne.jp added the comment:

I'll create the patch for it.

--
versions:  -Python 2.6

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



[issue10016] shutil.copyfile -- allow sparse copying

2010-10-02 Thread Tom Potts

New submission from Tom Potts karake...@gmail.com:

Copying a sparse file under Linux using shutil.copyfile will not result in a 
sparse file at the end of the process.  I'm submitting a patch that will remedy 
this.

Note that I am only concerned with Linux at the moment -- as far as I know this 
patch will not mess things up on other platforms, but this will need to be 
tested.  It depends on the behaviour of os.truncate() when the pointer is past 
the end of the file, which according to the docs is platform dependant.

Tom

P.S. This is my first time submitting an issue -- if there's anything I need to 
do and haven't, please let me know.

--
components: Library (Lib)
files: shutil-2.6.patch
keywords: patch
messages: 117878
nosy: karaken12
priority: normal
severity: normal
status: open
title: shutil.copyfile -- allow sparse copying
type: feature request
versions: Python 2.6, Python 2.7, Python 3.2
Added file: http://bugs.python.org/file19107/shutil-2.6.patch

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



[issue10016] shutil.copyfile -- allow sparse copying

2010-10-02 Thread Tom Potts

Tom Potts karake...@gmail.com added the comment:

(see opening message)

--
Added file: http://bugs.python.org/file19108/shutil-2.7.patch

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



[issue10016] shutil.copyfile -- allow sparse copying

2010-10-02 Thread Tom Potts

Changes by Tom Potts karake...@gmail.com:


Added file: http://bugs.python.org/file19109/shutil-3.2.1.patch

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



[issue9533] metaclass can't derive from ABC

2010-10-02 Thread R. David Murray

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

Does the fix for issue 10006 affect this?  (I imagine that question is why 
Antoine made Benjamin nosy on this issue).

--
nosy: +r.david.murray

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



[issue10015] Creating a multiproccess.pool.ThreadPool from a child thread blows up.

2010-10-02 Thread R. David Murray

Changes by R. David Murray rdmur...@bitdance.com:


--
nosy: +asksol, jnoller
type: crash - behavior

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



[issue10016] shutil.copyfile -- allow sparse copying

2010-10-02 Thread R. David Murray

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

You are right that this needs to be tested on other platforms.  In order to so 
test it (and in any case!), the patch will need unit tests.  It also needs doc 
updates.

In general patch itself looks good to me, modulo the concern you raise about 
truncate.  You could move the '\0'*buflen constant outside the loop.  Also, the 
py3k IO module doesn't define constants for 'seek', the docs just refer to the 
integers, so it might be best not to use the os constants even though they are 
equivalent (the new io module is not a wrapper around os functions the way the 
old file implementation was).

FYI, patches should (currently, pending the hg migration) be against the py3k 
trunk, and whoever commits it would backport it if appropriate.  In this case, 
however, it is a new feature and so can only go into py3k trunk.

--
nosy: +r.david.murray, tarek
versions:  -Python 2.6, Python 2.7

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



[issue8670] c_types.c_wchar should not assume that sizeof(wchar_t) == sizeof(Py_UNICODE)

2010-10-02 Thread STINNER Victor

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

 Since this was a bugfix, it should be merged back into 2.7, yes?

Mmmh, the fix requires to change PyUnicode_AsWideChar() function (support 
non-BMP characters and surrogate pairs) (and maybe also to create 
PyUnicode_AsWideCharString()). I don't really want to change such important 
function in a stable branch (Python2).

Is it really important to support non-BMP characters for ctypes.c_wchar in 
Python2? I would like to say: if you want better unicode support, use Python 3. 
And Python 3.2 if it's possible :-)

--

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



[issue8670] c_types.c_wchar should not assume that sizeof(wchar_t) == sizeof(Py_UNICODE)

2010-10-02 Thread Daniel Stutzbach

Daniel Stutzbach dan...@stutzbachenterprises.com added the comment:

Since I noticed the bug through source code inspection and no one has reported 
it occurring in practice, that sounds reasonable to me.

--
versions:  -Python 2.7

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



[issue1050268] rfc822.parseaddr is broken, breaks sendmail call in smtplib

2010-10-02 Thread R. David Murray

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

Fix committed to py3k in r85179, 3.1 in r85170, and 2.7 in r85181.  I modified 
the unit tests, deleting the ones that were redundant because they were just 
two different python spellings of the same input string, and adding a comment 
about the third test case's quoting pattern.

--
resolution:  - fixed
stage: unit test needed - committed/rejected
status: open - closed

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



[issue7511] msvc9compiler.py: ValueError: [u'path']

2010-10-02 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' g.rod...@gmail.com:


--
nosy: +giampaolo.rodola

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



[issue10006] non-Pythonic fate of __abstractmethods__

2010-10-02 Thread Benjamin Peterson

Benjamin Peterson benja...@python.org added the comment:

2010/10/1 Yaroslav Halchenko rep...@bugs.python.org:

 Yaroslav Halchenko yarikop...@gmail.com added the comment:

 yikes... surprising resolution -- I expected that fix would either makes 
 __abstractmethods__ accessible in derived types or becomes absent from 
 output of dir() -- but none of those has happened.  Now we ended up with a 
 consistent non-Pythonic fate of __abstractmethods__ listed in output of dir() 
 but not accessible.  is that a feature?

type has no __abstractmethods__, so it should raise an AttributeError.
Note descriptors are allowed to raise AttributeError even if they're
in dir().

--

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



[issue8792] Support Apache extensions to XML-RPC in xmlrpclib

2010-10-02 Thread Amaury Forgeot d'Arc

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

It's easy enough to subclass the Transport type and add custom types to the 
dispatcher object, see the script below.
Attila, Bhargav, is this solution acceptable to you?


from xmlrpclib import Transport, ServerProxy

class MyTransport(Transport):
def getparser(self):
parser, unmarshaller = Transport.getparser(self)

# Get the class attribute, clone it
dispatch = unmarshaller.dispatch.copy()
# and store it on the instance
unmarshaller.dispatch = dispatch

# Now we can add custom types
dispatch[ex:i8] = dispatch[int]

return parser, unmarshaller

uri = http://time.xmlrpc.com/RPC2;
server = ServerProxy(uri, transport=MyTransport(use_datetime=True))
print server.currentTime.getCurrentTime()

--
nosy: +amaury.forgeotdarc

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



[issue9369] const char* for PyObject_CallMethod and PyObject_CallFunction

2010-10-02 Thread Amaury Forgeot d'Arc

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

Martin, what do you think about this kind of changes? Are there possible 
regressions or incompatibilities?

--
nosy: +amaury.forgeotdarc, loewis

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



[issue9369] const char* for PyObject_CallMethod and PyObject_CallFunction

2010-10-02 Thread Martin v . Löwis

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

AFAICT, they are compatible, so +1.

The typical proposition of an incompatible change either proposes to use const 
char* as the return type, or has multi-level pointers that are proposed to be 
constified.

--

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



[issue9369] const char* for PyObject_CallMethod and PyObject_CallFunction

2010-10-02 Thread Amaury Forgeot d'Arc

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

Thanks for the confirmation!

--
resolution:  - accepted

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



[issue10015] Creating a multiproccess.pool.ThreadPool from a child thread blows up.

2010-10-02 Thread Jesse Noller

Jesse Noller jnol...@gmail.com added the comment:

I can not, for the life of me, remember why ThreadPool is there, except as a 
fallback. It's also not part of the documented interface as well. Additionally, 
in Python 3 we now have futures.

--

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



[issue9533] metaclass can't derive from ABC

2010-10-02 Thread Benjamin Peterson

Benjamin Peterson benja...@python.org added the comment:

You can now create metaclass abcs. However, having __abstractmethods__ does not 
prevent instance creation. This is a problem with a builtins, though.

--
resolution:  - fixed
status: open - closed

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



[issue10011] `except` doesn't use `isinstance`

2010-10-02 Thread Benjamin Peterson

Benjamin Peterson benja...@python.org added the comment:

It matters when exceptions are expected or are a normal part of control flow. 
For example StopIteration.

--
nosy: +benjamin.peterson

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



[issue4661] email.parser: impossible to read messages encoded in a different encoding

2010-10-02 Thread R. David Murray

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

Version 4 of patch, now including doc updates.

The patch set is now complete.

--
Added file: http://bugs.python.org/file19110/email_parse_bytes4.diff

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



[issue5117] os.path.relpath problem with root directory

2010-10-02 Thread Hirokazu Yamamoto

Hirokazu Yamamoto ocean-c...@m2.ccsnet.ne.jp added the comment:

Well, I said msg80877 past, and I think so too, but
os.path module of python2.x seems not to support UNC
correctly, and I'm not sure if the behavior change is
allowed here.

Probably UNC support is new feature, so I'll attach
the patch to solve only this problem as is.

--
Added file: http://bugs.python.org/file19111/py27_fix_relpath.patch

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



[issue1710703] zipfile.ZipFile behavior inconsistent.

2010-10-02 Thread Alan McIntyre

Changes by Alan McIntyre alan.mcint...@gmail.com:


Removed file: http://bugs.python.org/file9144/empty-zipfile.diff

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



[issue10017] pprint.pprint raises TypeError on dictionaries with user-defined types as keys

2010-10-02 Thread Arnaud Delobelle

New submission from Arnaud Delobelle arno...@googlemail.com:

The pprint function in the python 3.1 pprint module fails when
printing a dictionary containing more than one item and with one item
being a user-defined type.  It seems pprint tries to sort the keys but
fails, (maybe because calling __lt__ on a user-defined type doesn't
bind its first argument to 'self'?  Looking into pprint.py would
probably yield the answer).

This seems related to issue 3976 but it was fixed in r76389 and
r76390.  My example below fails in r79147.  I'm not in a position to check more 
recent revisions right now.

In Python 2.6, the following works fine:

Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56) 
[GCC 4.4.3] on linux2
Type help, copyright, credits or license for more information.
 from pprint import pprint
 class A(object): pass
... 
 pprint({A:1, 1:2})
{1: 2, class __main__.A at 0xb77dc47c: 1}


But in Python 3.1, it fails with the error below:

Python 3.1.2 (r312:79147, Apr 15 2010, 12:35:07) 
[GCC 4.4.3] on linux2
Type help, copyright, credits or license for more information.
 from pprint import pprint
 class A: pass
... 
 pprint({A:1, 1:2})
Traceback (most recent call last):
  File stdin, line 1, in module
  File /usr/lib/python3.1/pprint.py, line 55, in pprint
printer.pprint(object)
  File /usr/lib/python3.1/pprint.py, line 132, in pprint
self._format(object, self._stream, 0, 0, {}, 0)
  File /usr/lib/python3.1/pprint.py, line 155, in _format
rep = self._repr(object, context, level - 1)
  File /usr/lib/python3.1/pprint.py, line 242, in _repr
self._depth, level)
  File /usr/lib/python3.1/pprint.py, line 254, in format
return _safe_repr(object, context, maxlevels, level)
  File /usr/lib/python3.1/pprint.py, line 296, in _safe_repr
items = sorted(object.items(), key=_safe_tuple)
  File /usr/lib/python3.1/pprint.py, line 89, in __lt__
rv = self.obj.__lt__(other.obj)
TypeError: expected 1 arguments, got 0

--
components: Library (Lib)
messages: 117895
nosy: arno
priority: normal
severity: normal
status: open
title: pprint.pprint raises TypeError on dictionaries with user-defined types 
as keys
versions: Python 3.1

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



[issue1710703] zipfile.ZipFile behavior inconsistent.

2010-10-02 Thread Alan McIntyre

Alan McIntyre alan.mcint...@gmail.com added the comment:

My apologies if Georg was waiting on me to say, Yes. :-)

I've attached an updated patch that has the NEWS/doc changes Antoine mentioned. 
 I also just checked that the tests still pass on Linux against the current 
trunk, and that the docs still build properly.

--
Added file: http://bugs.python.org/file19112/zipfile_empty3.diff

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



[issue1710703] zipfile.ZipFile behavior inconsistent.

2010-10-02 Thread Alan McIntyre

Changes by Alan McIntyre alan.mcint...@gmail.com:


Removed file: http://bugs.python.org/file18534/zipfile_empty2.diff

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



[issue4661] email.parser: impossible to read messages encoded in a different encoding

2010-10-02 Thread R. David Murray

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

Rietveld issue, with a small doc addition compared to pach4:

http://codereview.appspot.com/2362041

--

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



[issue9647] os.confstr() does not handle value changing length between calls

2010-10-02 Thread David Watson

David Watson bai...@users.sourceforge.net added the comment:

 If I understood correctly, you don't want the value to be truncated if the 
 variable grows between the two calls to confstr(). Which behaviour would you 
 expect? A Python exception?

A return size larger than the buffer is *supposed* to indicate
that the current value is larger than the supplied buffer, so I
would just expect it to reallocate the buffer, call confstr()
again and return the new value, unless it was known that such a
situation indicated an actual problem.

In other words, I would not expect it to do anything special.  I
didn't write the original patch the way I did in order to fix
this (potential) bug - it just seemed like the most natural way
to write the code.

--

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



[issue6792] Distutils-based installer does not detect 64bit versions of Python

2010-10-02 Thread dontbugme

dontbugme pythonbugsbugme...@spamavert.com added the comment:

you can add  InstallPath key with the corresponding value at 
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Python\PythonCore\2.6\]
if you want disutils installer to detect your python
That makes him detect and install the librarys or scripts to the right 
directory, but doens't make your library 64bit compatible if it isn't
(means if the library doesn't work on 64 bit i neither will whith this work 
around) Only possibility of fixing that problem is installing 32bit python

--
nosy: +dontbugme
versions: +Python 2.6

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



[issue4661] email.parser: impossible to read messages encoded in a different encoding

2010-10-02 Thread R. David Murray

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

Upload svn patch, so that Martin's new rietveld support will (hopefully) create 
an automatic review link.

--
Added file: http://bugs.python.org/file19113/email_parse_bytes5.diff

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



[issue6792] Distutils-based installer does not detect 64bit versions of Python

2010-10-02 Thread Martin v . Löwis

Changes by Martin v. Löwis mar...@v.loewis.de:


--
versions:  -Python 2.6

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



[issue10017] pprint.pprint raises TypeError on dictionaries with user-defined types as keys

2010-10-02 Thread R. David Murray

Changes by R. David Murray rdmur...@bitdance.com:


--
nosy: +rhettinger

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



[issue9369] const char* for PyObject_CallMethod and PyObject_CallFunction

2010-10-02 Thread Andreas Stührk

Changes by Andreas Stührk andy-pyt...@hammerhartes.de:


--
nosy: +Trundle

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



[issue1210680] Split email headers near a space

2010-10-02 Thread R. David Murray

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

Since no test case has been provided I am closing this issue.

--
status: open - closed

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



[issue6792] Distutils-based installer does not detect 64bit versions of Python

2010-10-02 Thread Jeremy Kloth

Changes by Jeremy Kloth jeremy.kl...@gmail.com:


--
nosy: +jkloth

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



[issue9800] Fast path for small int-indexing of lists and tuples

2010-10-02 Thread Daniel Stutzbach

Daniel Stutzbach dan...@stutzbachenterprises.com added the comment:

For what it's worth, a similar fast path existed in Python 2 for lists (but not 
tuples).  It was removed for Python 3.  I'm not sure why it was removed, but it 
may have been part of removing the PyInt type.

--
nosy: +stutzbach

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



[issue1078919] email.Header (via add_header) encodes non-ASCII content incorrectly

2010-10-02 Thread R. David Murray

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

I don't believe either the example that other mailers reject or the one that 
they accept are in fact RFC compliant.  Encoded words are not supposed to occur 
in (structured) MIME headers.  The behavior observed is a consequence of all 
headers, whether structured or unstructured, being treated as if they were 
unstructured by Header.

(There's a different problem in Python3 with this example, but I'll deal with 
that in a separate issue.)

What we have here is primarily a documentation bug.  The way to generate the 
correct (RFC compliant) header is as follows:

 m.add_header('Content-Disposition', 'attachment',
... filename=('iso-8859-1', '', 'Fußballer_sind_klug.ppt'))
 str(m)
'Content-Disposition: attachment; 
filename*=iso-8859-1\'\'Fu%DFballer_sind_klug.ppt\n\n'

I will add the explanation and this example to the docs.  In addition, in 3.2 I 
will disallow non-ASCII parameter values unless they are specified in a three 
element tuple as in the example above.  That will still leave some other places 
where structured headers are inappropriately encoded by Header (eg: addresses 
with non-ASCII names), but dealing with that is a somewhat deeper problem.

--
title: Email.Header encodes non-ASCII content incorrectly - email.Header (via 
add_header) encodes non-ASCII content incorrectly
type: feature request - behavior

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



[issue9873] urllib.parse: Allow bytes in some APIs that use string literals internally

2010-10-02 Thread Nick Coghlan

Nick Coghlan ncogh...@gmail.com added the comment:

As per RDM's email to python-dev, a better way to create the pseudo_str values 
would be by decoding as ascii with a surrogate escape error handler rather than 
by decoding as latin-1.

--

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



[issue1078919] email.Header (via add_header) encodes non-ASCII content incorrectly

2010-10-02 Thread R. David Murray

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

Here is a patch.

--
keywords: +patch
stage: unit test needed - patch review
Added file: http://bugs.python.org/file19114/add_header.patch

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



[issue6302] email.header.decode_header data types are inconsistent and incorrectly documented

2010-10-02 Thread R. David Murray

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

Here is a patch that makes the output consistently (bytes, string) pairs.  This 
is definitely a potential backward compatibility issue, but in general code 
which compensates for the old behavior should work fine with the new behavior, 
since it was always possible to get a (bytes, None) tuple back as a result, so 
most code should be handling that case correctly already.

IMO this change is nevertheless worthwhile; especially since if the patch in 
issue 4661 is accepted decode_header can be enhanced so that it will provide a 
way to obtain the bytes version of a header containing (RFC invalid) non-ASCII 
bytes.

Note that this breaks one of the tests in nttplib, so backward compatibility 
really is an issue, unfortunately.  I think nttplib's use case can be satisfied 
via the issue 4661 patch coupled with the decode_header bytes-recovery 
enhancement.

--
dependencies: +email.parser: impossible to read messages encoded in a different 
encoding
keywords: +patch
nosy: +pitrou
Added file: http://bugs.python.org/file19115/decode_header.patch

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



[issue6302] email.header.decode_header data types are inconsistent and incorrectly documented

2010-10-02 Thread R. David Murray

Changes by R. David Murray rdmur...@bitdance.com:


--
versions:  -Python 3.1

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



[issue10018] IDLE not loading in xp pro due to tcl issue

2010-10-02 Thread Grant Andrew

New submission from Grant Andrew gveg...@gmail.com:

I'm attempting to use Python for the first time and am running into issues 
before I'm out the door.  I started with 3.2 and have worked backward 
installing older versions in hopes that IDLE would load on my xp pro laptop.  

After reading several threads here, I ran C:\C:\python27\python 
C:\python27\Lib\idlelib\idle.py at a command prompt and received the following 
output:

C:\C:\python27\python C:\python27\Lib\idlelib\idle.py
Traceback (most recent call last):
  File C:\python27\Lib\idlelib\idle.py, line 11, in module
idlelib.PyShell.main()
  File C:\python27\Lib\idlelib\PyShell.py, line 1389, in main
root = Tk(className=Idle)
  File C:\python27\lib\lib-tk\Tkinter.py, line 1685, in __init__
self.tk = _tkinter.create(screenName, baseName, className, interactive, want
objects, useTk, sync, use)
_tkinter.TclError: Can't find a usable init.tcl in the following directories:
{C:\IBMTOOLS\Python22\tcl\tcl8.4} C:/IBMTOOLS/Python22/tcl/tcl8.5 C:/python2
7/lib/tcl8.5 C:/lib/tcl8.5 C:/lib/tcl8.5 C:/library C:/library C:/tcl8.5.2/libra
ry C:/tcl8.5.2/library

C:/IBMTOOLS/Python22/tcl/tcl8.4/init.tcl: version conflict for package Tcl: ha
ve 8.5.2, need exactly 8.4
version conflict for package Tcl: have 8.5.2, need exactly 8.4
while executing
package require -exact Tcl 8.4
(file C:/IBMTOOLS/Python22/tcl/tcl8.4/init.tcl line 19)
invoked from within
source C:/IBMTOOLS/Python22/tcl/tcl8.4/init.tcl
(uplevel body line 1)
invoked from within
uplevel #0 [list source $tclfile]


This probably means that Tcl wasn't installed properly.

After searching threads here and a general google search on TCL I couldn't turn 
up a link that helped with this issue.  The closest tcl version available is 
8.4.19 which isn't exact, so I'm hesitant to install this and blow something 
else up.

Help is appreciated!

Grant

--
components: IDLE
messages: 117907
nosy: Grant.Andrew
priority: normal
severity: normal
status: open
title: IDLE not loading in xp pro due to tcl issue
type: crash
versions: Python 2.5, Python 2.6, Python 2.7

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