[issue5673] Add timeout option to subprocess.Popen

2010-01-28 Thread Antoine Pitrou

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


--
nosy: +astrand
stage: test needed - patch review

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



[issue7798] document pydoc methods

2010-01-28 Thread anatoly techtonik

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

pydoc contains some useful methods like pager() that could be reused in many 
python application, and it would be handy to have a documentation for them in 
Python manual http://docs.python.org/library/pydoc

--
assignee: georg.brandl
components: Documentation
messages: 98463
nosy: georg.brandl, techtonik
severity: normal
status: open
title: document pydoc methods
type: feature request
versions: Python 2.6

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



[issue5673] Add timeout option to subprocess.Popen

2010-01-28 Thread Antoine Pitrou

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

Some comments:

- why do you say Thread.join() uses a busy loop? is it because it uses 
Condition.wait()? If so, this will be solved in py3k by issue7316 (which you 
are welcome to review). Otherwise, I think there should be an upper bound on 
the sleeping granularity (say 2 seconds).

- the if 'timeout' in kwargs dance is a bit complicated. Why not simply 
kwargs.pop('timeout', None)?

- if it times out, communicate() should raise a specific exception. Bonus 
points if the exception holds the partial output as attributes (that's what we 
do for non-blocking IO in py3k), but if it's too difficult we can leave that 
out. I don't think returning None would be very good.

- for consistency, other methods should probably raise the same exception. I 
think we can leave out the more complex scenarios such as timing out but still 
processing the beginning of the output.

- I agree that further input from python-dev or python-ideas would be nice

--
nosy: +pitrou

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



[issue5362] Add configure option to disable Py3k warnings

2010-01-28 Thread Antoine Pitrou

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

Given the very small benefits, I don't think there's any point in making this a 
configuration variable. A hardcoded flag would be sufficient, and expert users 
would be able to recompile their Python (as with the FAST_LOOPS flag).

--

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



[issue5362] Add configure option to disable Py3k warnings

2010-01-28 Thread Marc-Andre Lemburg

Marc-Andre Lemburg m...@egenix.com added the comment:

I'm with Antoine on this one.

Also, instead of removing the flag completely which will cause problems with 
extensions relying on it, I'd suggest to just disable the PyErr_WarnPy3k(msg, 
stacklevel) macro and turn it into a no-op if a compile time variable 
DISABLE_PY3K_WARNINGS (or similar) is defined (which should be undefined per 
default).

--
nosy: +lemburg

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



[issue7797] base64 module docs should indicate that encode methods return bytes, not strings

2010-01-28 Thread Florent Xicluna

Changes by Florent Xicluna la...@yahoo.fr:


--
nosy: +flox
priority:  - normal

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



[issue7591] test_distutils: test_get_platform fails on 3.1

2010-01-28 Thread Florent Xicluna

Florent Xicluna la...@yahoo.fr added the comment:

Fixed with r77586

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

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



[issue7732] imp.find_module crashes Python if there exists a directory named __init__.py

2010-01-28 Thread Florent Xicluna

Changes by Florent Xicluna la...@yahoo.fr:


--
stage: needs patch - patch review

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



[issue767645] incorrect os.path.supports_unicode_filenames

2010-01-28 Thread Florent Xicluna

Changes by Florent Xicluna la...@yahoo.fr:


--
components: +Tests
stage:  - patch review
versions: +Python 2.7, Python 3.1, Python 3.2

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



[issue7753] newgil backport

2010-01-28 Thread Antoine Pitrou

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

 It appears to be better to use clock_gettime(CLOCK_MONOTONIC)
 where available and only use gettimeofday() as fallback solution
 together with times(), ftime() and time().

Ok, I've tried and it's less good than expected. Using CLOCK_MONOTONIC
absolutely kills efficiency. CLOCK_REALTIME is ok but it has no obvious
benefits (microsecond resolution as given by gettimeofday() is probably
sufficient).

The explanation AFAICT is that pthread_cond_timedwait() waits for
absolute clock values as given by CLOCK_REALTIME.
CLOCK_MONOTONIC gives other values (the man page says: represents
monotonic time since some unspecified starting point). These values are
probably in the past as seen from pthread_cond_timedwait(), which
implies a busy loop of waiting for the GIL to be released, inside of
being suspended gracefully until the timeout.

I can still produce a patch with only CLOCK_REALTIME but I'm not sure
it's worth the code complication.

--

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



[issue7799] unittest returning standard_tests from load_tests in module fails

2010-01-28 Thread R. David Murray

New submission from R. David Murray rdmur...@bitdance.com:

Working from the example in the docs, I wrote a test suite like this:

def load_tests(loader, standard_tests, pattern):
for case in email.test.emailtestdb.populated_test_cases(globals()):
standard_tests.addTests(loader.loadFromTestCase(case))
return standard_test

This resulted in the exception:

Traceback (most recent call last):
  File /home/rdmurray/python/bzr/email6-local/Lib/test/regrtest.py, line 857, 
in runtest_inner
indirect_test()
  File /home/rdmurray/python/bzr/email6-local/Lib/test/test_email.py, line 
10, in test_main
tests = unittest.defaultTestLoader.discover(testdir, top_level_dir=libdir)
  File /home/rdmurray/python/bzr/email6-local/Lib/unittest/loader.py, line 
179, in discover
return self.suiteClass(tests)
  File /home/rdmurray/python/bzr/email6-local/Lib/unittest/suite.py, line 18, 
in __init__
self.addTests(tests)
  File /home/rdmurray/python/bzr/email6-local/Lib/unittest/suite.py, line 54, 
in addTests
self.addTest(test)
  File /home/rdmurray/python/bzr/email6-local/Lib/unittest/suite.py, line 43, 
in addTest
raise TypeError({} is not callable.format(test))
TypeError: [unittest.suite.TestSuite tests=[], unittest.suite.TestSuite 
tests=[], unittest.suite.TestSuite tests=[]] is not callable

(Well, that's after I enhanced the normal error message, which just says that 
'test must be a callable')

I see that loadTestsFromModule wraps what is passes as standard_tests in 
self.suiteClass before returning it, whereas it returns whatever load_tests 
returns directly.  Perhaps the wrapping needs to be done in both cases, or 
perhaps standard_tests should be wrapped before being passed to the module's 
load_tests?

My load_tests is a function in a test module, not a package __init__.

--
components: Library (Lib)
keywords: easy
messages: 98469
nosy: r.david.murray
priority: normal
severity: normal
stage: test needed
status: open
title: unittest returning standard_tests from load_tests in module fails
versions: Python 2.7, Python 3.2

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



[issue7799] unittest returning standard_tests from load_tests in module fails

2010-01-28 Thread Michael Foord

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

Yes. The standard tests should be wrapped in a suite before being passed into 
load_tests. That's a bug - thanks for catching it.

--
assignee:  - michael.foord
nosy: +michael.foord

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



[issue7610] Cannot use both read and readline method in same ZipExtFile object

2010-01-28 Thread Nir Aides

Nir Aides n...@winpdb.org added the comment:

I actually meant how would you simulate zlib's absence on a system in which it 
is present?

--

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



[issue7732] imp.find_module crashes Python if there exists a directory named __init__.py

2010-01-28 Thread Amaury Forgeot d'Arc

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

This is slightly incorrect: if PyFile_FromFile fails for another reason 
(PyString_FromString(name) runs out of memory), the fp is not closed and the 
caller is right to call fclose().

IMO PyFile_FromFile() should be changed to consistently leave the fp opened 
when NULL is returned. But then, many usages of this function are incorrect, 
e.g in posixmodule.c :-(

--
nosy: +amaury.forgeotdarc

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



[issue7610] Cannot use both read and readline method in same ZipExtFile object

2010-01-28 Thread Ezio Melotti

Ezio Melotti ezio.melo...@gmail.com added the comment:

The easiest way is to setting zlib to None or not import it at all.
Are you suggesting that test_zipfile should be always run with and without zlib 
to check that everything (except the things that require zlib of course) works 
in both the cases?
My concern was about that part that handles unconsumed data only, because I 
didn't see any test in the patch that specifically check it. If there are 
already tests that checks it, then it's fine, even if it's not possible to test 
that part without zlib.

--

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



[issue7732] imp.find_module crashes Python if there exists a directory named __init__.py

2010-01-28 Thread Florent Xicluna

Changes by Florent Xicluna la...@yahoo.fr:


Removed file: http://bugs.python.org/file15937/issue7732_find_module.diff

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



[issue7732] imp.find_module crashes Python if there exists a directory named __init__.py

2010-01-28 Thread Florent Xicluna

Florent Xicluna la...@yahoo.fr added the comment:

 if PyFile_FromFile fails for another reason (PyString_FromString(name)
 runs out of memory), the fp is not closed and the caller is right to
 call fclose().

As far as I understand, the fp is never left open, when PyFile_FromFile returns 
NULL. So there's no reason to call fclose on it.

However I found a reference leak in the case you describe 
(PyString_FromString(name) == NULL).

It is fixed with this last update.

--
Added file: http://bugs.python.org/file16029/issue7732_find_module_v2.diff

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



[issue7732] imp.find_module crashes Python if there exists a directory named __init__.py

2010-01-28 Thread Trundle

Trundle andy-pyt...@hammerhartes.de added the comment:

Note that the fp gets set with `fill_file_fields()` and that is called after 
the error return of `PyString_FromString()`. Hence, the fp is left open if 
`PyString_FromString()` returns NULL.

--

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



[issue7732] imp.find_module crashes Python if there exists a directory named __init__.py

2010-01-28 Thread Florent Xicluna

Florent Xicluna la...@yahoo.fr added the comment:

AFAICT, in this case, if PyString_FromString gives NULL, then (o_name == NULL) 
and the function returns without calling fill_file_fields.
Hence, the fp is not opened.

Do you suggest something else?

--

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



[issue7732] imp.find_module crashes Python if there exists a directory named __init__.py

2010-01-28 Thread Trundle

Trundle andy-pyt...@hammerhartes.de added the comment:

`fill_file_fields()` does not open the fp, the caller of `PyFile_FromFile()` 
opens the fp.

I don't have a better idea, that's why I don't have provided a patch.

--

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



[issue7610] Cannot use both read and readline method in same ZipExtFile object

2010-01-28 Thread Ezio Melotti

Ezio Melotti ezio.melo...@gmail.com added the comment:

Apparently that part of code is already tested in other tests that use deflated 
mode, so I'll close this again. Thanks for the info.

--
stage: test needed - committed/rejected
status: open - closed

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



[issue7798] document pydoc methods

2010-01-28 Thread Brian Curtin

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


--
priority:  - normal
stage:  - needs patch
versions: +Python 2.7, Python 3.1, Python 3.2

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



[issue6939] shadows around the io truncate() semantics

2010-01-28 Thread Pascal Chambon

Pascal Chambon chambon.pas...@gmail.com added the comment:

Hello

Here is the patch for the python trunk, regarding truncate() behaviour.
I've tested it on windows and linux, against IO test suites (with -uall), in 
debug and normal mode.

I've also updated some docstrings, and added tests for untested potential 
errors around buffered read+write streams, when truncating.

--
Added file: http://bugs.python.org/file16030/PY27_truncate.patch

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



[issue7753] newgil backport

2010-01-28 Thread Marc-Andre Lemburg

Marc-Andre Lemburg m...@egenix.com added the comment:

Antoine Pitrou wrote:
 
 Antoine Pitrou pit...@free.fr added the comment:
 
 It appears to be better to use clock_gettime(CLOCK_MONOTONIC)
 where available and only use gettimeofday() as fallback solution
 together with times(), ftime() and time().
 
 Ok, I've tried and it's less good than expected. Using CLOCK_MONOTONIC
 absolutely kills efficiency. CLOCK_REALTIME is ok but it has no obvious
 benefits (microsecond resolution as given by gettimeofday() is probably
 sufficient).
 
 The explanation AFAICT is that pthread_cond_timedwait() waits for
 absolute clock values as given by CLOCK_REALTIME.
 CLOCK_MONOTONIC gives other values (the man page says: represents
 monotonic time since some unspecified starting point). These values are
 probably in the past as seen from pthread_cond_timedwait(), which
 implies a busy loop of waiting for the GIL to be released, inside of
 being suspended gracefully until the timeout.

The CLOCK_MONOTONIC timer only guarantees that you
get an accurate time count. It doesn't maintain any relationship
to the wall clock time. For the case in question you don't need
the wall clock time, though. It's more important not have the
clock go backwards or be subject to jitter.

pthreads will default to use the real time clock. In order
to have them use the monotonic timer, you have to setup
a condition variable attribute: See the man-page for
pthread_condattr_setclock().

 I can still produce a patch with only CLOCK_REALTIME but I'm not sure
 it's worth the code complication.

Even if you don't use CLOCK_MONOTONIC you should still prefer
clock_gettime() over gettimeofday() simply because it's faster.
The resolution of both will likely be the same, unless the
hardware provides a more accurate timer than kernel ticks.

The code won't get more complicated if you refactor the time
querying logic into a separate function (which the compiler can then
inline as necessary).

--

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



[issue7753] newgil backport

2010-01-28 Thread Ross Cohen

Ross Cohen rco...@snurgle.org added the comment:

I am confused by this line of reasoning. Is it ok to ignore the
deprecation process in py3k but not in 2.x? Is it only ok if a core
developer does it?

If the point of 2.7 is to make it easier for apps and packages to be
ported to py3k, then what would be the point of these platforms moving
to 2.7 in the first place? It seems perfectly reasonable not to support
platforms which are never going to care the release. If the platforms
are broken for 2.7, you'll get that much more warning before 3.2 is
released so it can be fixed.

Ross

On Wed, 27 Jan 2010 14:30:20 +
Marc-Andre Lemburg rep...@bugs.python.org wrote:

 Antoine Pitrou wrote:
  More seriously, all the APIs in question (and most of their supporting
  systems: IRIX etc.) seem practically dead. I don't want to rehash that
  discussion here, but you can post on python-dev if you want.
 
 No need... I'm tired of trying to get Python devs on track with
 respect to the PEP 11 process, deprecations, etc.
 
  You could just as well remove them right now: if the GIL doesn't
  work on OS/2, then having support for it in the _thread module
  isn't really worth much, is it ?
  
  Andrew told me he believed it possible to port the new GIL to OS/2. So
  perhaps he'll do that before 3.2 is out.
 
  With just NT and POSIX thread support, I think backporting the
  new GIL implementation to 2.7 is not possible - we'd have to go
  through a standard PEP 11 deprecation process and there are not
  enough 2.x releases left for that. It could only be backported
  as optional feature, to be enabled by a configure option.
  
  Right. That's what I think too.
 
 I'll close the issue then.

--

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



[issue3871] cross and native build of python for mingw32 with distutils

2010-01-28 Thread Robin Schoonover

Changes by Robin Schoonover e...@cornhooves.org:


--
nosy: +rschoon

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



[issue7753] newgil backport

2010-01-28 Thread Antoine Pitrou

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

 pthreads will default to use the real time clock. In order
 to have them use the monotonic timer, you have to setup
 a condition variable attribute: See the man-page for
 pthread_condattr_setclock().

I'll look at that, but I'm not thrilled at the propect of complicating
the code paths so much. There may be systems where CLOCK_MONOTONIC is
unavailable, others where pthread_condattr_setclock() is unsupported,
etc.

 The code won't get more complicated if you refactor the time
 querying logic into a separate function (which the compiler can then
 inline as necessary).

It does get more complicated, since there are several paths
(clock_gettime() and then a fallback on gettimeofday()).
I'm not talking about complexity in the executable but about maintenance
complexity.

--

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



[issue7800] Attributes of type list are static

2010-01-28 Thread Chris Carter

New submission from Chris Carter jesdisci...@gmail.com:

The test case at the end of this message seems to indicate that the list is 
being initialized only once for all wrapper instances.  I've tried to find 
anything about static members in Python and came up empty.  I also found no 
relevant existing bugs.

Expected output:
0 [0]
1 [1]
2 [2]
3 [3]

Actual output:
0 [0]
1 [0, 1]
2 [0, 1, 2]
3 [0, 1, 2, 3]

Test case:
i = 0
class Lister:

list = []
string = 
def __init__(self):
global i
self.list.append(i)
self.string += str(i)
i += 1
def __str__(self):
return %s %s % (self.string, self.list)

print Lister()
print Lister()
print Lister()
print Lister()

--
components: Interpreter Core
messages: 98483
nosy: Chris.Carter
severity: normal
status: open
title: Attributes of type list are static
versions: Python 2.6

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



[issue7800] Attributes of type list are static

2010-01-28 Thread Michael Foord

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

The list in your example is a *class attribute* not an instance attribute, so 
yes it is only initialised once. You can still access it through the instance 
(self) because of Python member lookup rules.

If you want one list per instance then initialise it in __init__ instead of 
making it a class attribute.

In short, Python is not Java.

--
nosy: +michael.foord
resolution:  - invalid
status: open - closed

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



[issue7643] What is a Unicode line break character?

2010-01-28 Thread Chris Carter

Chris Carter jesdisci...@gmail.com added the comment:

Then I must ask, why did the string attribute behave differently?  I added it 
to allow for that, and the behavior seems inconsistent.

--
nosy: +Chris.Carter

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



[issue7643] What is a Unicode line break character?

2010-01-28 Thread Chris Carter

Chris Carter jesdisci...@gmail.com added the comment:

My bad, wrong bug.

--

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



[issue7800] Attributes of type list are static

2010-01-28 Thread Chris Carter

Chris Carter jesdisci...@gmail.com added the comment:

Then I must ask, why did the string attribute behave differently?  I added it 
to allow for that, and the behavior seems inconsistent.

--

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



[issue7801] xmlrpc.client binary object examples needs to use binary mode

2010-01-28 Thread Michael Newman

New submission from Michael Newman michael.b.new...@gmail.com:

In Section 20.23.3 Binary Objects of:
http://docs.python.org/3.1/library/xmlrpc.client.html

The server AND client examples fail because the read and write methods are not 
set to binary mode.

Example of what the client portion shows if you use the examples as is with 
Python 3.1.1 (r311:74483) on win32:

C:\Python31\python.exe example3_binary_obj_client.py
Traceback (most recent call last):
  File example3_binary_obj_client.py, line 10, in module
handle.write(proxy.python_logo().data)
  File C:\python31\lib\xmlrpc\client.py, line 1029, in __call__
return self.__send(self.__name, args)
  File C:\python31\lib\xmlrpc\client.py, line 1271, in __request
verbose=self.__verbose
  File C:\python31\lib\xmlrpc\client.py, line 1070, in request
return self.parse_response(resp)
  File C:\python31\lib\xmlrpc\client.py, line 1169, in parse_response
return u.close()
  File C:\python31\lib\xmlrpc\client.py, line 673, in close
raise Fault(**self._stack[0])
xmlrpc.client.Fault: Fault 1: class 'UnicodeDecodeError':'charmap' codec 
can't decode byte 0x81 in position 297: character maps to undefined

To fix it, the server example should have:

handle = open(python_logo.jpg, rb)

and the client example should have:

handle = open(fetched_python_logo.jpg, wb)

--
assignee: georg.brandl
components: Documentation
messages: 98488
nosy: georg.brandl, mnewman
severity: normal
status: open
title: xmlrpc.client binary object examples needs to use binary mode
versions: Python 3.1

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



[issue7800] Attributes of type list are static

2010-01-28 Thread Michael Foord

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

Because strings are immutable. Your list access (self.list.append) mutates the 
existing list in place.

Because strings are immutable you += is exactly equivalent to the following 
code:

self.string = self.string + str(i)

The first lookup of self.string actually looks up the class attribute (because 
on a fresh instance there is no instance attribute). The class attribute is an 
empty string. You then create a new string by adding the empty string to str(i) 
and assign an *instance* attribute to str(i).

Because you haven't mutated the class attribute (strings are immutable) the 
next time round with a new instance the whole process repeats and the first 
lookup of self.string still finds the class attribute which is still an empty 
string.

With your example code try the following:

print Lister.string
print Lister()
print Lister.string

You will see that the class attribute is unchanged in between instantiations. 
The += on immutable objects probably doesn't quite behave how you expect.

--

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



[issue4331] Can't use _functools.partial() created function as method

2010-01-28 Thread Alexander Belopolsky

Alexander Belopolsky alexander.belopol...@gmail.com added the comment:

Christophe,

It looks like your patch goes out of its way to avoid creating nested partials. 
 This is a worthwhile goal and I think it should be done in partial_new so that 
partial(partial(f, x), y) returns partial(f, x, y).

If fact, I was surprised to learn that current partial implementation does not 
behave this way:

 partial(partial(f, 1), 2).func
functools.partial object at 0x100435af8

Does anyone know the reason for the current behavior?  It is possible that I am 
missing some subtlety related to keyword arguments.

--
nosy: +Alexander.Belopolsky

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



[issue7092] Test suite emits many DeprecationWarnings when -3 is enabled

2010-01-28 Thread Amaury Forgeot d'Arc

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

Here is my review of issue7092_syntax_imports_v3.diff:

- test_itertools.py: please replace
  [tuple([arg[i] if i  len(arg) else None for arg in args])
   for i in range(max(map(len, args)))]
  by something more readable (nested for loops for example)

- test_mailbox.py: why doesn't test_support.import_module('rfc822')
  specify deprecated=True? maybe the module can be imported normally...

- test_pyclbr.py:   replace self.assertTrue(key in obj) with assertIn()
- test_wsgiref.py:  replace self.assertTrue(key in h.environ)

- test_queue.py: test could be identical to the one in py3k.

--
nosy: +amaury.forgeotdarc

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



[issue7437] OS X 2.6.4 installer fails on 10.3 with two corrupted file names, ignored on 10.4

2010-01-28 Thread TJ Sullivan

TJ Sullivan tjsu...@gmail.com added the comment:

I would be happy to test the new package for you. I am running 10.3.9 and Had 
attempted to install 2.6.4 recently without realizing it, so my terminal 
version is 2.6.4 but idle and back at 2.5. email me if you want me to test it 
for you.

--
nosy: +tjsulli

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



[issue4944] os.fsync() doesn't work as expect in Windows

2010-01-28 Thread Brian Curtin

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


--
nosy: +brian.curtin
priority:  - normal
stage:  - test needed

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



[issue7802] socket.gaierror before ProtocolError for xmlrpc.client

2010-01-28 Thread Michael Newman

New submission from Michael Newman michael.b.new...@gmail.com:

Following the example in Section 20.23.5. ProtocolError Objects of:
http://docs.python.org/3.1/library/xmlrpc.client.html
It implies that an invalid URL will give raise an xmlrpc.client.ProtocolError. 
Instead I'm getting a socket.gaierror instead. (I also tried using the google 
address to show tat ProtocolError is working correctly if a real URL is used, 
but doesn't offer XML-RPC services.) This similarly is happening for xmlrpclib 
on Python 2.6.

Is this a bug or documentation mistake?

Python 3.1.1 (r311:74483, Aug 17 2009, 17:02:12) [MSC v.1500 32 bit (Intel)] on 
win32
Type help, copyright, credits or license for more information.
 import xmlrpc.client
 proxy = xmlrpc.client.ServerProxy(http://invalidaddress/;)
 proxy.some_method()
Traceback (most recent call last):
  File stdin, line 1, in module
  File C:\python31\lib\xmlrpc\client.py, line 1029, in __call__
return self.__send(self.__name, args)
  File C:\python31\lib\xmlrpc\client.py, line 1271, in __request
verbose=self.__verbose
  File C:\python31\lib\xmlrpc\client.py, line 1058, in request
http_conn = self.send_request(host, handler, request_body, verbose)
  File C:\python31\lib\xmlrpc\client.py, line 1144, in send_request
connection.request(POST, handler, request_body, headers)
  File C:\python31\lib\http\client.py, line 918, in request
self._send_request(method, url, body, headers)
  File C:\python31\lib\http\client.py, line 956, in _send_request
self.endheaders(body)
  File C:\python31\lib\http\client.py, line 914, in endheaders
self._send_output(message_body)
  File C:\python31\lib\http\client.py, line 768, in _send_output
self.send(msg)
  File C:\python31\lib\http\client.py, line 716, in send
self.connect()
  File C:\python31\lib\http\client.py, line 698, in connect
self.timeout)
  File C:\python31\lib\socket.py, line 292, in create_connection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
socket.gaierror: [Errno 11001] getaddrinfo failed
 proxy = xmlrpc.client.ServerProxy(http://www.google.com/;)
 proxy.some_method()
Traceback (most recent call last):
  File stdin, line 1, in module
  File C:\python31\lib\xmlrpc\client.py, line 1029, in __call__
return self.__send(self.__name, args)
  File C:\python31\lib\xmlrpc\client.py, line 1271, in __request
verbose=self.__verbose
  File C:\python31\lib\xmlrpc\client.py, line 1065, in request
dict(resp.getheaders())
xmlrpc.client.ProtocolError: ProtocolError for www.google.com/: 405 Method Not 
Allowed


Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit (Intel)] on 
win32
Type help, copyright, credits or license for more information.
 import xmlrpclib
 proxy = xmlrpclib.ServerProxy(http://invalidaddress/;)
 proxy.some_method()
Traceback (most recent call last):
  File stdin, line 1, in module
  File C:\python26\lib\xmlrpclib.py, line 1199, in __call__
return self.__send(self.__name, args)
  File C:\python26\lib\xmlrpclib.py, line 1489, in __request
verbose=self.__verbose
  File C:\python26\lib\xmlrpclib.py, line 1235, in request
self.send_content(h, request_body)
  File C:\python26\lib\xmlrpclib.py, line 1349, in send_content
connection.endheaders()
  File C:\python26\lib\httplib.py, line 892, in endheaders
self._send_output()
  File C:\python26\lib\httplib.py, line 764, in _send_output
self.send(msg)
  File C:\python26\lib\httplib.py, line 723, in send
self.connect()
  File C:\python26\lib\httplib.py, line 704, in connect
self.timeout)
  File C:\python26\lib\socket.py, line 500, in create_connection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
socket.gaierror: [Errno 11001] getaddrinfo failed
 proxy = xmlrpclib.ServerProxy(http://www.google.com/;)
 proxy.some_method()
Traceback (most recent call last):
  File stdin, line 1, in module
  File C:\python26\lib\xmlrpclib.py, line 1199, in __call__
return self.__send(self.__name, args)
  File C:\python26\lib\xmlrpclib.py, line 1489, in __request
verbose=self.__verbose
  File C:\python26\lib\xmlrpclib.py, line 1243, in request
headers
xmlrpclib.ProtocolError: ProtocolError for www.google.com/: 405 Method Not 
Allowed

I also checked Python 3.1 on Linux:

Python 3.1.1 (r311:74480, Oct 18 2009, 19:21:53) [GCC 4.3.3] on linux2
Type help, copyright, credits or license for more information.
 import xmlrpc.client
 proxy = xmlrpc.client.ServerProxy(http://invalidaddress/;)
 proxy.some_method()
Traceback (most recent call last):
  File stdin, line 1, in module
  File /usr/local/lib/python3.1/xmlrpc/client.py, line 1029, in __call__
return self.__send(self.__name, args)
  File /usr/local/lib/python3.1/xmlrpc/client.py, line 1271, in __request
verbose=self.__verbose
  File /usr/local/lib/python3.1/xmlrpc/client.py, line 1058, in request
http_conn = self.send_request(host, handler, request_body, verbose)
  File /usr/local/lib/python3.1/xmlrpc/client.py, 

[issue7092] Test suite emits many DeprecationWarnings when -3 is enabled

2010-01-28 Thread Ezio Melotti

Ezio Melotti ezio.melo...@gmail.com added the comment:

Here's mine about issue7092_check_warnings_v3.diff:

1) test_callable should keep testing callable() and the warnings should be 
caught;
2) in test_bsddb3 the problems should be correct in the module if possible and 
worth it (the module is deprecated);
3) next to the several '# Silence py3k warnings' it would be nice to have a 
note about what warning you are exactly silencing;
4) def test_deprecated_builtin_map - test_deprecated_builtin_map_with_None, 
otherwise it seems that map is deprecated;
5) in test[_deep]_copy I'm not entirely sure that the tests are equivalent 
using in (and if they are you should use assertIn);
6) in test_socket I would keep callable, also shouldn't the raise in the next 
line raise a warning as well?;
7)  the self.assertEqual(`u2`, `d2`) in test_userdict could just use repr() 
instead;
8) a few tests in test_weakref should use assert[Not]In instead of assertTrue(x 
[not] in y).

--

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



[issue7802] socket.gaierror before ProtocolError for xmlrpc.client

2010-01-28 Thread Ezio Melotti

Ezio Melotti ezio.melo...@gmail.com added the comment:

FWIW it had the same behavior already on Python 2.4.

--
nosy: +ezio.melotti, loewis
priority:  - normal
stage:  - test needed

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



[issue1481] test_uuid is warning about unreliable functions

2010-01-28 Thread Brian Curtin

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

These tests have been disabled for a little over two years now. I've run the 
previously disabled tests on Windows, Mac OSX, and Linux numerous times and 
haven't seen any instability or failures (not that it proves much). 

I wasn't around at the time to know what specific platforms caused the 
instability and don't see any evidence, but can we re-enable them to see if and 
where they cause problems today? The attached patch re-enables the disabled 
tests, and brings the if-statement skipping up to speed with skip decorators.

--
keywords: +needs review, patch
nosy: +brian.curtin
stage:  - patch review
versions: +Python 2.7, Python 3.1, Python 3.2 -Python 3.0
Added file: http://bugs.python.org/file16031/issue1481.diff

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



[issue7801] xmlrpc.client binary object examples needs to use binary mode

2010-01-28 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
nosy: +loewis
priority:  - normal
stage:  - needs patch
type:  - behavior
versions: +Python 3.2

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



[issue7633] decimal.py: type conversion in context methods

2010-01-28 Thread Juan José Conti

Juan José Conti jjco...@gmail.com added the comment:

1) Agree. Extra checks removed.
2) My mistake. Fixed.
3) Fexed.
4) Methods documentation fixed. Also added examples.
5) Fixed
6) Allow ints in the following unary methods (all except the ones excluded by 
skrah in cdecimal):
- abs
- canonical
- copy_abs
- copy_decimal
- copy_negate
- exp
- is_finite
- is_infinite
- is_nan
- is_normal
- is_qnan
- is_signed
- is_snan
- is_subnormal
- is_zero
- ln
- log10
- logb
- minus
- next_minus
- next_plus
- sqrt
- to_*_string
- to_integral_*

(also documented them properly as in 4)

copy_sing fixed and documented to have the same behaibour.

Ans a change in Doc/library/decimal.rst to reflec the new behaibour.

--
Added file: http://bugs.python.org/file16032/issue7633_jjconti3.patch

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



[issue6490] os.popen documentation in 2.6 is probably wrong

2010-01-28 Thread Ezio Melotti

Ezio Melotti ezio.melo...@gmail.com added the comment:

The function is still marked as deprecated in the 2.x doc and undocumented in 
3.x (the function is there, but the description points somewhere else).

--
nosy: +ezio.melotti
priority:  - normal
stage:  - needs patch

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



[issue7800] Attributes of type list are static

2010-01-28 Thread Chris Carter

Chris Carter jesdisci...@gmail.com added the comment:

Ha, fun with language features.  Thanks for the detailed explanation. :)

--

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



[issue1926] NNTPS support in nntplib

2010-01-28 Thread Brian Curtin

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


--
stage:  - test needed
versions: +Python 2.7, Python 3.2 -Python 2.6

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



[issue2052] Allow changing difflib._file_template character encoding.

2010-01-28 Thread Brian Curtin

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


--
stage:  - test needed
versions: +Python 2.6 -Python 2.5

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



[issue1927] raw_input behavior incorrect if readline not enabled

2010-01-28 Thread Brian Curtin

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


--
stage:  - test needed
versions:  -Python 2.5

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