[issue6071] no longer possible to hash arrays

2009-09-21 Thread Jan Hosang

Jan Hosang  added the comment:

I tried to implement the new buffer API, but as soon as I add 
bf_getbuffer/bf_releasebuffer to PyBufferProcs writing an array to a file 
breaks:
  f.write(a)
  TypeError: must be contiguous buffer, not array.array

I searched through the file functions, but couldn't find the point where 
this happens. Has anybody a suggestion? Does file.write() use the old 
buffers? Doesn't it use reprfunc?

--
nosy: +chuck

___
Python tracker 

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



[issue6864] IDLE 2.6.1 locks up on Mac OS 10.6

2009-09-21 Thread Ned Deily

Ned Deily  added the comment:

I also can verify that the problem is not reproducible using a current 
trunk (2.7) and the 10.6 Apple Tk 8.5.7.  Further testing of this issue 
with both Apple Tk 8.4.x and ActiveState Tk 8.4.19 on 10.4, 10.5, and 
10.6 has been hang-free.

It looks like there were a number of fixes to _tkinter.c and friends 
checked in by Guilherme early in 2009 that were not backported to 2.6 
and some of them have to do with thread locking.  Whether or not the 
fixes should have been backported is not an issue at this point. However 
I think it makes little sense to attempt much further work on this 
problem using the current 2.6 base without looking at backporting first.

So, with regard to the 2.6.3 release, I concur with Ronald's plan to 
continue to link only with Tk 8.4 for the OS X installer and I suggest 
there be a disclaimer somewhere about building with Tk 8.5 on OS X for 
2.6.3.

--
nosy: +gpolo

___
Python tracker 

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



[issue5120] Disabling test_ttk_guionly on mac

2009-09-21 Thread Ned Deily

Ned Deily  added the comment:

I noticed this while investigating Issue6834. Is this still an open issue 
for OS X?  Could it explain the symptoms in 6834?

--
nosy: +ned.deily, ronaldoussoren

___
Python tracker 

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



[issue5120] Disabling test_ttk_guionly on mac

2009-09-21 Thread Ned Deily

Ned Deily  added the comment:

Sorry, that should be Issue6864.

--

___
Python tracker 

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



[issue1766304] improve xrange.__contains__

2009-09-21 Thread Mark Dickinson

Mark Dickinson  added the comment:

Robert,

The patch looks good: thank you.

Please use C89-style comments (/* ... */).

I'd like to see a few more tests covering the various combinations of
start less-than/equal-to/greater-than stop, step positive/negative, tested 
value within/without/at endpoints of the range interval, etc.

--

___
Python tracker 

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



[issue1766304] improve xrange.__contains__

2009-09-21 Thread Mark Dickinson

Mark Dickinson  added the comment:

Also, it would be good to add a test or two for non-integers, e.g. to make 
explicit that the following behaviour hasn't changed:

>>> class C:
... def __int__(self):  return 3
... def __index__(self): return 5
... def __eq__(self, other): return other == 4
... 
>>> C() in range(0, 10, 2)
True

--
assignee:  -> mark.dickinson

___
Python tracker 

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



[issue3366] Add gamma function, error functions and other C99 math.h functions to math module

2009-09-21 Thread Mark Dickinson

Mark Dickinson  added the comment:

New patch for gamma , with some tweaks:

 - return exact values for integral arguments: gamma(1) through gamma(23)
 - apply a cheap correction to improve accuracy of exp and pow
   computations
 - use a different form of the reflection formula:

 gamma(x) = -pi/sinpi(x)/x/gamma(x)

   (the usual reflection formula has accuracy problems for
x close to a power of 2;  e.g., x in (-64,-63) or x
in (-128, -127))

 - avoid duplication formula for large negative arguments
 - add a few extra tests

On my machine, testing with approx. 10**7 random samples, this version 
achieves an accuracy of <= 10 ulps across the domain (comparing with 
correctly-rounded results generated by MPFR).  Limiting the test to 
arguments in the range (-256.0, 1/256.0] + [1/256.0, 256.0) (with each 
float in that range equally likely), the error in ulps from 10**6 samples 
has mean -0.104 and standard deviation 1.230.

I plan to check this in in a week or two.  Feedback welcome!  It would be 
especially useful to know whether this patch compiles correctly on 
Windows.

--
keywords: +needs review
stage:  -> commit review
Added file: http://bugs.python.org/file14940/gamma4.patch

___
Python tracker 

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



[issue6956] Test creation in unittest.TestProgram should be done in one place

2009-09-21 Thread Michael Foord

New submission from Michael Foord :

Requested by Fernando Perez on the Testing in Python mailing list.

Test creation in TestProgram is done in both parseArgs and createTests.
It would be better if it was only done in createTests so that
controlling test creation only required the overloading of a single method.


> in TestProgram.parseArgs we have:
> 
> if len(args) == 0 and self.defaultTest is None:
> self.test =
self.testLoader.loadTestsFromModule(self.module)
> return
> 
> and then later:
> 
> def createTests(self):
> self.test = self.testLoader.loadTestsFromNames(self.testNames,
>self.module)
> 
> So basically if you want to control how tests are created, you can't
just override createTests, because parseArgs also does test creation
> (but only sometimes, depending on certain conditions).

> I think that parseArgs should perhaps only parse args, and createTests
should only create tests, but I'm weird like that :)  For the case
> above, it could set a flag that createTests can then later use to
decide what to do, but parseArgs shouldn't be doing test creation IMO.

--
assignee: michael.foord
components: Library (Lib)
messages: 92929
nosy: michael.foord
severity: normal
stage: needs patch
status: open
title: Test creation in unittest.TestProgram should be done in one place
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



[issue6957] Extension modules fail to build on OS X 10.6 using python.org 2.x/3.x

2009-09-21 Thread Ned Deily

New submission from Ned Deily :

Potential 2.6.3 release blocker

On OS X 10.6 (Snow Leopard), if you attempt to install a package with a 
extension module using a Python from a python.org OS X installer (say, 
2.6.x or 3.1.x), the c compilation steps will likely fail in one of two 
ways:

1. Recent python.org installers are built using the OS X 10.4 SDK so 
that one installer image will work on 10.4, 10.5 and now 10.6 (in 
theory, 10.3.x as well).  Building of extension modules also require gcc 
and the SDKs, which are included as part of Apple's Xcode tools.  
However, with 10.6 Xcode, the 10.4 SDK is not installed by default so 
the extension module build will fail due to missing include files. Once 
the problem is known, it can be solved easily by installing the SDK from 
the release DVD that comes with the system or upgrade.

2. Even with the 10.4 SDK installed on 10.6, the compilation fails with:

/Developer/SDKs/MacOSX10.4u.sdk/usr/include/stdarg.h:4:25: error: 
stdarg.h: No such file or directory

This can be especially baffling to those unfamiliar with nested include 
files because the base file stdarg.h does exist in that directory.

The root cause here is that Snow Leopard now uses gcc-4.2 by default but 
the 10.4 SDK does not include headers for 4.2. The solution is to force 
use of gcc-4.0, the default on 10.4 and 10.5 and included in 10.6, by 
defining the CC environment variable:
 
  $ export CC=/usr/bin/gcc-4.0
  $ python setup.py install 
  or
  $ easy_install xxx

Even for experienced developers, these can be non-trivial problems to 
resolve although the solutions, once known, are easy to implement.  
Unfortunately, all types of python users can run into these issues 
simply by trying to install and use a package that includes an extension 
module.  There are a growing number of hits on the web from people 
trying to install popular packages such as MySQLdb, PIL, and lxml using 
a python.org Python on 10.6.  Note this isn't a problem for users of the 
Apple-supplied Pythons (2.6 and 2.5) on 10.6 since they do not use the 
10.4 SDK.

There are two separate issues here I think:
1. What, if anything, to do for users of installers already out in the 
field?
2. What to do to mitigate the problems for yet-to-be released installers 
(e.g. 2.6.3)?

Documenting and publicizing the problems somehow may be the only viable 
option for 1.  For 2, there is the possibility of some additional 
actions, perhaps a warning in the installer readme or some such.  It 
probably would make sense to contact the maintainers of such packages so 
that they can add something to their web pages and documentation.

--
assignee: ronaldoussoren
components: Extension Modules, Macintosh
messages: 92930
nosy: ned.deily, ronaldoussoren
severity: normal
status: open
title: Extension modules fail to build on OS X 10.6 using python.org 2.x/3.x
versions: Python 2.6, Python 3.1

___
Python tracker 

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



[issue6952] deprecated conversion from string constant to char *

2009-09-21 Thread Trundle

Trundle  added the comment:

See also issue #1699259.

--
nosy: +Trundle

___
Python tracker 

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



[issue6957] Extension modules fail to build on OS X 10.6 using python.org 2.x/3.x

2009-09-21 Thread Ned Deily

Changes by Ned Deily :


--
nosy: +barry

___
Python tracker 

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



[issue6958] Add Python command line flags to configure logging

2009-09-21 Thread Thomas Heller

New submission from Thomas Heller :

I want the Python executable to have command line flags which allow
simple configuration of the logging module.  Use cases are to run
applications/scripts (which use libraries that use logging calls) with
different logging output without having to edit (ugly) logging config files.

The attached patch demonstrates the idea; it allows to run 'python -l
 ...' and passes  to a new function
logging._parse_python_options().

--
components: Interpreter Core, Library (Lib)
files: logging.patch
keywords: patch
messages: 92932
nosy: theller
severity: normal
status: open
title: Add Python command line flags to configure logging
type: feature request
Added file: http://bugs.python.org/file14941/logging.patch

___
Python tracker 

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



[issue6952] deprecated conversion from string constant to char *

2009-09-21 Thread Sebastian Ramacher

Changes by Sebastian Ramacher :


--
nosy: +sebastinas

___
Python tracker 

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



[issue5764] 2.6.2 Python Manuals CHM file seems broken

2009-09-21 Thread Ding Xuan

Ding Xuan  added the comment:

thanks very much for your kindly notification :)

On Mon, Sep 21, 2009 at 3:44 AM, Georg Brandl wrote:

>
> Georg Brandl  added the comment:
>
> 2.6.3 will be out soon with a valid chm again.
>
> --
> resolution:  -> later
> status: open -> closed
>
> ___
> Python tracker 
> 
> ___
>

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

___
Python tracker 

___thanks very much for your kindly notification :)On Mon, Sep 21, 2009 at 3:44 AM, Georg Brandl rep...@bugs.python.org> 
wrote:

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

2.6.3 will be out soon with a valid chm again.

--
resolution:  -> later
status: open -> closed

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



[issue1766304] improve xrange.__contains__

2009-09-21 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

As a small style note, I would prefer if the patch assigned in
conditionals less and split them out to the line before. I see that
rangeobject.c has a mixed style with regards to this, so the clearer one
should win! :)

--
nosy: +benjamin.peterson

___
Python tracker 

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



[issue6958] Add Python command line flags to configure logging

2009-09-21 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



[issue6958] Add Python command line flags to configure logging

2009-09-21 Thread R. David Murray

Changes by R. David Murray :


--
nosy: +vsajip
priority:  -> normal
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



[issue6958] Add Python command line flags to configure logging

2009-09-21 Thread Doug Hellmann

Changes by Doug Hellmann :


--
nosy: +doughellmann

___
Python tracker 

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



[issue3366] Add gamma function, error functions and other C99 math.h functions to math module

2009-09-21 Thread Daniel Stutzbach

Daniel Stutzbach  added the comment:

I'll test your patch on Windows.  Are you working against the trunk or
the py3k branch?

--

___
Python tracker 

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



[issue3366] Add gamma function, error functions and other C99 math.h functions to math module

2009-09-21 Thread Mark Dickinson

Mark Dickinson  added the comment:

Thanks!  The patch is against the trunk.  (It doesn't quite apply cleanly 
to py3k, but the changes needed to make it do so should be minimal.)

Hmm. Rereading my previous comment, I seem to have a blindness for 
negative signs:

gamma(x) = -pi/sinpi(x)/x/gamma(x)

should have been

gamma(-x) = -pi/sinpi(x)/x/gamma(x)

and

(-256.0, 1/256.0] + [1/256.0, 256.0)

should have been

(-256.0, -1/256.0] + [1/256.0, 256.0)

--

___
Python tracker 

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



[issue6954] DISTUTILS_DEBUG causes stack trace, really simple fix

2009-09-21 Thread Tarek Ziadé

Tarek Ziadé  added the comment:

Mmm, the problem is deeper for the second stack trace: 

distutils.fancy_getopt.longopt_xlate was changed from a translation
mapping into a lambda in py3, that's why you have it.

I'm fixing back this problem too.

--
versions: +Python 3.2

___
Python tracker 

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



[issue6952] deprecated conversion from string constant to char *

2009-09-21 Thread Barry Alan Scott

Barry Alan Scott  added the comment:

I'd guess that this change can first be made against 2.7 and 3.2
so that API's do not change.

Where do I find the source code to generate the patch against
for 2.7 and 3.2?

--

___
Python tracker 

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



[issue6954] DISTUTILS_DEBUG causes stack trace, really simple fix

2009-09-21 Thread Tarek Ziadé

Changes by Tarek Ziadé :


--
versions: +Python 2.7

___
Python tracker 

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



[issue3366] Add gamma function, error functions and other C99 math.h functions to math module

2009-09-21 Thread Daniel Stutzbach

Daniel Stutzbach  added the comment:

I'm only setup to test the official Windows build setup under PCbuild. 
I'm not testing the legacy build setups under PC/VC6, PC/VS7.1, or PC/VS8.0.

The patch against the trunk failed for PC/VC6/pythoncore.dsp.  I don't
need that to build, though.

Your patch built fine, with one warning about a loss of precision on the
following line in sinpi():

n = round(2.0*y);

I recommend explicitly casting the result of round() to int, to get rid
of the warning and because explicit is better than implicit. :)

I ran the following tests, all of which passed:

PCbuild/python.exe Lib/test/regrtest.py -v test_math

I appreciate your work on this patch.  Let me know if there's anything
else I can do.

--

___
Python tracker 

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



[issue6952] deprecated conversion from string constant to char *

2009-09-21 Thread R. David Murray

R. David Murray  added the comment:

Take a look at http://www.python.org/dev, specifically the 'How to Get
Started' article (which points you to the developer's FAQ, which
explains how to do an anonymous checkout of the source).

--
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



[issue6954] DISTUTILS_DEBUG causes stack trace, really simple fix

2009-09-21 Thread Tarek Ziadé

Tarek Ziadé  added the comment:

Everything is covered now, and the mentioned bug is fixed in 
trunk (r74994), py3k (r74999) and release31 (75000).

Thanks !

--
status: open -> closed

___
Python tracker 

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



[issue6952] deprecated conversion from string constant to char *

2009-09-21 Thread R. David Murray

R. David Murray  added the comment:

I'm setting the targets to 2.7/3.2 per the discussion in issue #1699259.
 Perhaps the question of whether or not it is "really" an API change
could be revisited, but if so that would probably have to go through
python-dev.

--
priority:  -> normal
versions: +Python 2.7, Python 3.2 -Python 2.6, Python 3.1

___
Python tracker 

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



[issue1699259] replacing char* with const char* in sysmodule.c/.h

2009-09-21 Thread R. David Murray

R. David Murray  added the comment:

See also issue 6952, which seems to be a broader request of the same
nature.  Moving the 3.1 target to 3.2, since 3.1 is out.

--
nosy: +r.david.murray
versions: +Python 3.2 -Python 3.1

___
Python tracker 

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



[issue3366] Add gamma function, error functions and other C99 math.h functions to math module

2009-09-21 Thread Mark Dickinson

Mark Dickinson  added the comment:

Many thanks, Daniel.

> The patch against the trunk failed for PC/VC6/pythoncore.dsp.  I don't
> need that to build, though.

I've no idea why that would happen.  A line-ending issue, perhaps?  If 
it doesn't stop me committing the change, then perhaps it's not a 
problem.

> Your patch built fine, with one warning about a loss of precision on
> the following line in sinpi():
>
>n = round(2.0*y);
>
>I recommend explicitly casting the result of round() to int, to get
>rid of the warning and because explicit is better than implicit. :)

Done.  Thanks!

--

___
Python tracker 

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



[issue3451] Asymptotically faster divmod and str(long)

2009-09-21 Thread steve21

Changes by steve21 :


--
nosy: +steve21

___
Python tracker 

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



[issue6958] Add Python command line flags to configure logging

2009-09-21 Thread Vinay Sajip

Vinay Sajip  added the comment:

I get the idea. The Python part of the patch demonstrates what you're
getting at, though it can't be used as is - for example the
getattr(logging, a, a) could lead to problems. However a more
intelligent parser (which looked for specific keywords recognised by
basicConfig(), and got the correct values accordingly) wouldn't be much
more complicated. (I'll look at enhancing this part.)

As for the changes to main.c - I am a C/C++ developer but have not made
any changes to Python C code so far - it would be good if a more
experienced committer reviews this part (not sure who - can someone
please reassign/add to nosy list)? Thanks.

--

___
Python tracker 

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



[issue6958] Add Python command line flags to configure logging

2009-09-21 Thread Thomas Heller

Thomas Heller  added the comment:

> I get the idea. The Python part of the patch demonstrates what you're
> getting at, though it can't be used as is - for example the
> getattr(logging, a, a) could lead to problems. However a more
> intelligent parser (which looked for specific keywords recognised by
> basicConfig(), and got the correct values accordingly) wouldn't be much
> more complicated. (I'll look at enhancing this part.)
> 
> As for the changes to main.c - I am a C/C++ developer but have not made
> any changes to Python C code so far - it would be good if a more
> experienced committer reviews this part (not sure who - can someone
> please reassign/add to nosy list)? Thanks.

Both parts of the patch are only thought to demonstrate the idea.
You said you'll attack the Python part - good.

For the C part, the most prominemt things that are missing are these:

- free(logopt) should be called at the end of the 'if (logopts != NULL) {' 
block.

- error handling should be improved.  Errors in this block should probably exit 
Python.

--

___
Python tracker 

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



[issue6958] Add Python command line flags to configure logging

2009-09-21 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

If you want to add flags to the main executable, it deserves a
discussion on python-dev IMO.
It could be obtained through an environment variable, e.g.
PYLOGGING_CONFIG; which has the nice side-effect of working for
executable scripts too.

--
nosy: +pitrou

___
Python tracker 

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



[issue3366] Add gamma function, error functions and other C99 math.h functions to math module

2009-09-21 Thread Mark Dickinson

Mark Dickinson  added the comment:

gamma5.patch.  very minor changes from the last patch:

 - add (int) cast suggested by Daniel Stutzbach
 - Misc/NEWS entry
 - ..versionadded in docs
 - minor corrections to some comments

--
Added file: http://bugs.python.org/file14943/gamma5.patch

___
Python tracker 

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



[issue6958] Add Python command line flags to configure logging

2009-09-21 Thread Eric Smith

Eric Smith  added the comment:

The C code looks basically okay to me. I'd probably use strdup() instead
of the malloc/strlen/strcpy calls. And as Thomas said, the cleanup needs
a little bit of work.

--

___
Python tracker 

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



[issue6958] Add Python command line flags to configure logging

2009-09-21 Thread R. David Murray

R. David Murray  added the comment:

Also possibly relevant was the recent python-dev discussion about
replicating (some of) the command line argument parsing in python so
that it can be used by things other than the 'python' command:

http://mail.python.org/pipermail/python-dev/2009-August/091484.html

--
nosy: +ncoghlan, r.david.murray

___
Python tracker 

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



[issue6236] os.popen causes illegal seek on AIX in Python 3.1rc

2009-09-21 Thread egreen

egreen  added the comment:

The problem is that the fileio struct in Modules/_io/fileio.c defines
the 2-bit seekable field as int.

>From the C99 standard, §6.7.2: for bit-fields, it is
implementation-defined whether the specifier int designates the same
type as signed int or the same type as unsigned int.

Contrary to gcc, both xlc and suncc default to unsigned.

Adding 'signed' solves the problem (and also issue #6348).

Patch attached.

--
nosy: +egreen
Added file: http://bugs.python.org/file14944/fileio-seekable.patch

___
Python tracker 

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



[issue6958] Add Python command line flags to configure logging

2009-09-21 Thread Georg Brandl

Georg Brandl  added the comment:

Also, don't forget to update the "python -h" help text.

--
nosy: +georg.brandl

___
Python tracker 

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



[issue6959] OS X 10.6 / Snow Leopard

2009-09-21 Thread cscscs

Changes by cscscs :


--
nosy: cscscs
severity: normal
status: open
title: OS X 10.6 / Snow Leopard
type: compile error

___
Python tracker 

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



[issue6958] Add Python command line flags to configure logging

2009-09-21 Thread Michael Foord

Michael Foord  added the comment:

Why does this need to be built into the interpreter? The script / app
should have logging config support.

--
nosy: +michael.foord

___
Python tracker 

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



[issue6959] OS X 10.6 / Snow Leopard: building 2.6 maintenance release fails for some modules (architecture issue)

2009-09-21 Thread Ned Deily

Ned Deily  added the comment:

By default on 10.6, gcc builds in 64-bit mode. Nav is one of the 
deprecated "classic" Macintosh platform modules and has been removed in 
Python 3.  It and many other of the deprecated Mac modules use Carbon 
interfaces that are only available in 32-bit on OS X.  If you don't plan 
to use Nav and other Carbon Mac modules, you can ignore the build errors 
about Nav (although it would be nice to make it fail a bit more 
cleanly), otherwise force the build to be 32-bit only.  Also, OS X does 
not provide a GNU readline library; if you want to use it with your 
Python, you'll need to install a local copy (for example, via MacPorts 
or building your own); otherwise you can ignore that error as while.  In 
other words, other than those missing libraries, the python you built 
should work.

--
assignee:  -> ronaldoussoren
components: +Macintosh
nosy: +ned.deily, ronaldoussoren

___
Python tracker 

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



[issue6958] Add Python command line flags to configure logging

2009-09-21 Thread Thomas Heller

Thomas Heller  added the comment:

> Why does this need to be built into the interpreter? The script / app
> should have logging config support.

It does not need to, but it would be nice.
I think the '-l' flag should be similar to the -W flag.
Or consider for example using unittest.main() as script/app.

--

___
Python tracker 

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



[issue6958] Add Python command line flags to configure logging

2009-09-21 Thread Vinay Sajip

Vinay Sajip  added the comment:

If we do include interpreter support, there should be an option to
invoke a configuration file, too:

-l config=path

Mutually exclusive with all the other options. So, you can either use it
to invoke basicConfig or to invoke an arbitrary configuration in a file.

Opinions?

--

___
Python tracker 

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



[issue6958] Add Python command line flags to configure logging

2009-09-21 Thread Doug Hellmann

Doug Hellmann  added the comment:

I think I'm with Michael on this one.  I'd rather add logging
configuration to any stdlib modules that support being run directly and
want to support logging.

--

___
Python tracker 

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



[issue6958] Add Python command line flags to configure logging

2009-09-21 Thread R. David Murray

R. David Murray  added the comment:

I don't think this is about logging in stdlib modules that are run
directly. I think this is about a library that contains logging calls
(eg: multiprocessing), and is used in j-random-application, and while
prototyping/debugging the application you want to access that logging
information without having to write a logging infrastructure into your
app first.  Or you want to access it while debugging someone _else_'s
application...

--

___
Python tracker 

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



[issue6958] Add Python command line flags to configure logging

2009-09-21 Thread Jean-Paul Calderone

Jean-Paul Calderone  added the comment:

How about putting this into the logging module instead?  Instead of
"python   ", making it
"python -m logging   

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



[issue6348] solaris/aix: Py_Initialize: can't initialize sys standard streams

2009-09-21 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
resolution:  -> duplicate
status: open -> closed
superseder:  -> os.popen causes illegal seek on AIX in Python 3.1rc

___
Python tracker 

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



[issue6236] os.popen causes illegal seek on AIX in Python 3.1rc

2009-09-21 Thread Sridhar Ratnakumar

Changes by Sridhar Ratnakumar :


--
nosy: +srid

___
Python tracker 

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



[issue6236] os.popen causes illegal seek on AIX in Python 3.1rc

2009-09-21 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
resolution:  -> accepted

___
Python tracker 

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



[issue6958] Add Python command line flags to configure logging

2009-09-21 Thread Doug Hellmann

Doug Hellmann  added the comment:

How do these "global" settings (either via the interpreter or a wrapper
in the logging module) change what an app might do on its own?  IOW, if
my app is already written to configure logging, and someone invokes it
with these other settings, which settings are used?

--

___
Python tracker 

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



[issue6960] test_telnetlib gives spurious output

2009-09-21 Thread Antoine Pitrou

New submission from Antoine Pitrou :

I just got the following traceback:

Exception in thread Thread-538:
Traceback (most recent call last):
  File "/home/antoine/py3k/__svn__/Lib/threading.py", line 509, in
_bootstrap_inner
self.run()
  File "/home/antoine/py3k/__svn__/Lib/threading.py", line 462, in run
self._target(*self._args, **self._kwargs)
  File "/home/antoine/py3k/__svn__/Lib/test/test_telnetlib.py", line 25,
in server
conn, addr = serv.accept()
  File "/home/antoine/py3k/__svn__/Lib/socket.py", line 120, in accept
fd, addr = self._accept()
socket.error: [Errno 4] Interrupted system call


Interestingly, it happens *after* test_telnetlib returned successfully.

--
components: Tests
messages: 92962
nosy: jackdied, pitrou
priority: normal
severity: normal
status: open
title: test_telnetlib gives spurious output
type: behavior
versions: Python 3.2

___
Python tracker 

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



[issue6961] test_distutils failure

2009-09-21 Thread Antoine Pitrou

New submission from Antoine Pitrou :

I get the following (deterministic) failure on the py3k branch:

test_distutils
0 blocks
find:
`/home/antoine/tmp/tmpX6PtRb/foo/build/bdist.linux-x86_64/rpm/BUILDROOT/foo-0.1-1.x86_64/usr/lib/debug':
Aucun fichier ou dossier de ce type
0 blocks
find:
`/home/antoine/tmp/tmpNJkuVH/foo/build/bdist.linux-x86_64/rpm/BUILDROOT/foo-0.1-1.x86_64/usr/lib/debug':
Aucun fichier ou dossier de ce type
test test_distutils failed -- Traceback (most recent call last):
  File "/home/antoine/py3k/__svn__/Lib/distutils/tests/test_util.py",
line 145, in test_get_platform
self.assertEquals(get_platform(), 'macosx-10.4-universal')
AssertionError: 'macosx-10.4-intel' != 'macosx-10.4-universal'

1 test failed:
test_distutils

--
assignee: tarek
components: Distutils, Tests
messages: 92963
nosy: pitrou, tarek
priority: normal
severity: normal
stage: needs patch
status: open
title: test_distutils failure
type: behavior
versions: Python 3.2

___
Python tracker 

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



[issue6236] os.popen causes illegal seek on AIX in Python 3.1rc

2009-09-21 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Thanks for the patch! Committed in r75007, r75008, r75009, r75010.
If there's any problem, please reopen.

--
resolution: accepted -> fixed
status: open -> closed
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



[issue6961] test_distutils failure

2009-09-21 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

It also fails on release31-maint, but not on trunk.

--
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



[issue6962] traceback.format_exception_only does not return SyntaxError carot correctly

2009-09-21 Thread thewtex

New submission from thewtex :

On Python 2.6.2, and possibly other versions, in the traceback module,
format_exception_only does not behave correctly when printout out a
SyntaxError.  An extra newline is inserted before the carot.  E.g.

 38 exceptionType, exceptionValue, exceptionTraceback =
sys.exc_info()
 39 sys.stderr.write("Exception:\n")
 40 ex = traceback.format_exception_only(exceptionType,
exceptionValue)
 41 sys.stderr.write(repr(ex))
 42 for line in ex:
 43 sys.stderr.write(line) 

yields, e.g.
Exception:
['  File "/home/matt/apps/posac/source/posac/posac_main.py", line 12\n',
'def run()\n', '\n^\n', 'SyntaxError: invalid syntax\n']
 File "/home/matt/apps/posac/source/posac/posac_main.py", line 12
def run()

^
SyntaxError: invalid syntax

When it should be:
Exception:
['  File "/home/matt/apps/posac/source/posac/posac_main.py", line 12\n',
'def run()\n', ' ^\n', 'SyntaxError: invalid syntax\n']
 File "/home/matt/apps/posac/source/posac/posac_main.py", line 12
def run()
 ^
SyntaxError: invalid syntax


Attached is a patch.  This patch has been tested on gentoo linux.

--
messages: 92966
nosy: thewtex
severity: normal
status: open
title: traceback.format_exception_only does not return SyntaxError carot 
correctly
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



[issue1766304] improve xrange.__contains__

2009-09-21 Thread Robert Lehmann

Robert Lehmann  added the comment:

Thanks for your feedback. I added a few tests and changed the bits you
criticized.

--
Added file: http://bugs.python.org/file14945/range.patch

___
Python tracker 

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



[issue6877] enable compilation of readline module on Mac OS X 10.5 and 10.6

2009-09-21 Thread Brett Cannon

Brett Cannon  added the comment:

Is this open or closed? Wondering as I just updated my checkout and I am 
now segfaulting at the command-line whenever I import something under 
readline 6.0 which was working fine.


>>> import tokenize

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x
0x0001003effa6 in call_readline (sys_stdin=0x7fff70a230c0, 
sys_stdout=0x7fff70a23158, prompt=0x1005da194 ">>> ") at readline.c:1029
1029line = history_get(state->length 
- 1)->line;
(gdb) bt
#0  0x0001003effa6 in call_readline (sys_stdin=0x7fff70a230c0, 
sys_stdout=0x7fff70a23158, prompt=0x1005da194 ">>> ") at readline.c:1029
#1  0x000144d8 in PyOS_Readline (sys_stdin=0x7fff70a230c0, 
sys_stdout=0x7fff70a23158, prompt=0x1005da194 ">>> ") at 
myreadline.c:208
#2  0x00016ce0 in tok_nextc (tok=0x100890c10) at tokenizer.c:781
#3  0x00015464 in tok_get (tok=0x100890c10, 
p_start=0x7fff5fbfe9e8, p_end=0x7fff5fbfe9e0) at tokenizer.c:1128
#4  0x000153a4 in PyTokenizer_Get (tok=0x100890c10, 
p_start=0x7fff5fbfe9e8, p_end=0x7fff5fbfe9e0) at tokenizer.c:1568
#5  0x0001388b in parsetok (tok=0x100890c10, g=0x100251f68, 
start=256, err_ret=0x7fff5fbfeb10, flags=0x7fff5fbfeb0c) at 
parsetok.c:159
#6  0x00013fe8 in PyParser_ParseFileFlagsEx (fp=0x7fff70a230c0, 
filename=0x1001fba28 "", g=0x100251f68, start=256, 
ps1=0x1005da194 ">>> ", ps2=0x1005da2b4 "... ", err_ret=0x7fff5fbfeb10, 
flags=0x7fff5fbfeb0c) at parsetok.c:106
#7  0x000100193b76 in PyParser_ASTFromFile (fp=0x7fff70a230c0, 
filename=0x1001fba28 "", start=256, ps1=0x1005da194 ">>> ", 
ps2=0x1005da2b4 "... ", flags=0x7fff5fbfeea0, errcode=0x7fff5fbfebec, 
arena=0x1004427d0) at pythonrun.c:1461
#8  0x0001001937c9 in PyRun_InteractiveOneFlags (fp=0x7fff70a230c0, 
filename=0x1001fba28 "", flags=0x7fff5fbfeea0) at pythonrun.c:823
#9  0x000100193091 in PyRun_InteractiveLoopFlags (fp=0x7fff70a230c0, 
filename=0x1001fba28 "", flags=0x7fff5fbfeea0) at pythonrun.c:763
#10 0x000100192db8 in PyRun_AnyFileExFlags (fp=0x7fff70a230c0, 
filename=0x1001fba28 "", closeit=0, flags=0x7fff5fbfeea0) at 
pythonrun.c:732
#11 0x0001001af808 in Py_Main (argc=1, argv=0x7fff5fbfef40) at 
main.c:603
#12 0x00011325 in main (argc=1, argv=0x7fff5fbfef40) at 
python.c:23

--
nosy: +brett.cannon

___
Python tracker 

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



[issue6823] time.strftime does unnecessary range check

2009-09-21 Thread Brett Cannon

Brett Cannon  added the comment:

time.strftime() now normalizes tm_isdst.

2.7: r75011
3.2: r75012

This could probably be backported to 2.6/3.1, but since this is purely a 
convenience thing and it is a (very) minor change in semantics I am not 
going to bother.

Thanks, Robert, for the initial patch.

--
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



[issue6845] Restart support in binary upload for ftplib

2009-09-21 Thread Alejandro Santos

Changes by Alejandro Santos :


--
nosy: +alejolp

___
Python tracker 

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



[issue6845] Restart support in binary upload for ftplib

2009-09-21 Thread Facundo Batista

Facundo Batista  added the comment:

I like this. I'd love to see a test of this, though.

Pablo, do you think you could came up with a test? Thanks!

--

___
Python tracker 

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



[issue6105] json.dumps doesn't respect OrderedDict's iteration order

2009-09-21 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
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



[issue6963] Add worker process lifetime to multiprocessing.Pool - patch included

2009-09-21 Thread Charles Cazabon

New submission from Charles Cazabon :

Worker processes with multiprocessing.Pool live for the duration of the
Pool.  If the tasks they run happen to leak memory (from a C extension
module, or from creating cycles of unreachable objects, etc) or open
files or other resources, there's no easy way to clean them up.

Similarly, if one task passed to the pool allocates a large amount of
memory, but further tasks are small, that additional memory isn't
returned to the system because the process involved hasn't exited.

A common approach to this problem (as used by Apache, mod_wsgi, and
various other software) is to allow worker processes to exit (and be
replaced with fresh processes) after completing a specified amount of
work.  The attached patch (against Python 2.6.2, but applies to various
other versions with some fuzz) implements this as optional new behaviour
in multiprocessing.Pool().  An additional optional argument is specified
for the maximum number of tasks a worker process performs before it
exits and is replaced with a fresh worker process.

--
components: Library (Lib)
files: worker-lifetime-python2.6.2.patch
keywords: patch
messages: 92971
nosy: charlesc
severity: normal
status: open
title: Add worker process lifetime to multiprocessing.Pool - patch included
type: feature request
versions: Python 2.7, Python 3.1
Added file: http://bugs.python.org/file14946/worker-lifetime-python2.6.2.patch

___
Python tracker 

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



[issue6963] Add worker process lifetime to multiprocessing.Pool - patch included

2009-09-21 Thread Charles Cazabon

Changes by Charles Cazabon :


Removed file: http://bugs.python.org/file14946/worker-lifetime-python2.6.2.patch

___
Python tracker 

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



[issue6963] Add worker process lifetime to multiprocessing.Pool - patch included

2009-09-21 Thread Charles Cazabon

Changes by Charles Cazabon :


Added file: http://bugs.python.org/file14947/worker-lifetime-python2.6.2.patch

___
Python tracker 

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



[issue6963] Add worker process lifetime to multiprocessing.Pool - patch included

2009-09-21 Thread Benjamin Peterson

Changes by Benjamin Peterson :


--
assignee:  -> jnoller
nosy: +jnoller

___
Python tracker 

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



[issue6877] enable compilation of readline module on Mac OS X 10.5 and 10.6

2009-09-21 Thread Ronald Oussoren

Ronald Oussoren  added the comment:

This should have been closed, although readline shouldn't crash either.

Brett: What version of OSX do you use? Readline works fine for me on OSX 
10.6 without GNU readline.

BTW. The crashlog indicates you are no longer using GNU readline, but 
use system readline instead (that is the libedit emulation layer). 

This is one thing we completely failed to look at: how to determine 
which one to use? We currently use the first readline we find, which 
will we the system one on OSX 10.5 or later. 

It may be better to either add a configure flag to explicitly select 
which one is preferential, or use the GNU version when it is found.

--

___
Python tracker 

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



[issue6957] Extension modules fail to build on OS X 10.6 using python.org 2.x/3.x

2009-09-21 Thread Ronald Oussoren

Ronald Oussoren  added the comment:

It should be possible to tweak distutils to do the right thing for 
upcoming releases, distutils already contains some special code to allow 
building extensions for a univeral build on 10.3.9 (where the compiler 
doesn't support universal builds at all) and we could extend that for 
the compiler version on SL.

Implementation sketch:
* Record the compiler version during build (using configure)
* Store the compiler version as a variable in Makefile.pre.in
* Teach distutils to read that variable and adjust the compiler 
  path ($CC,$LD,...)

This bit would only be active on OSX.

--

___
Python tracker 

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