[issue6435] logging: cache the traceback text on formatter, instead of record

2009-07-09 Thread Vinay Sajip

Vinay Sajip vinay_sa...@yahoo.co.uk added the comment:

I fail to follow your logic, in the following respects:

1. The exception text cannot be cached in the formatter because a
formatter will format lots and lots of records. Formatters live for a
long time, records do not.
2. The exception text needs to be stored in the record, because in some
instances (e.g. pickling and sending over a socket) this information
will not be available at the other end in any other way.
3. The way it works now, if you have multiple formatters attached to
multiple handlers (e.g. with ISO time for log files, with no ISO time
for console output), then the traceback is only converted to text once.
4. There's nothing stopping you from overriding Formatter.format, is
there? the base version uses the cache, you can override format in your
custom formatter and ignore the cache altogether if you like.

Are you sure you've thought this through? ;-)

--
assignee:  - vsajip
resolution:  - invalid
status: open - closed

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



[issue6435] logging: cache the traceback text on formatter, instead of record

2009-07-09 Thread Sridhar Ratnakumar

Sridhar Ratnakumar sridh...@activestate.com added the comment:

On Wed, 08 Jul 2009 23:59:17 -0700, Vinay Sajip rep...@bugs.python.org  
wrote:

 1. The exception text cannot be cached in the formatter because a
 formatter will format lots and lots of records. Formatters live for a
 long time, records do not.

Ah, yes.

 Are you sure you've thought this through?

Not thoroughly .. as I missed the point 1. on formatter processing  
multiple records.

--

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



[issue6435] logging: cache the traceback text on formatter, instead of record

2009-07-09 Thread Vinay Sajip

Vinay Sajip vinay_sa...@yahoo.co.uk added the comment:

 Not thoroughly .. as I missed the point 1. on formatter processing  
 multiple records.

But what do you say to points 2, 3 and 4? Of course they may not apply
to your use case, but are they not valid points?

--

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



[issue6444] multiline exception logging via syslog handler

2009-07-09 Thread Max Arnold

New submission from Max Arnold lwa...@gmail.com:

I use syslog message routing mechanism to log high-priority messages
from my python code to separate file.  When exceptions are logged, only
first line routed to specified file, and the rest goes in /var/log/messages.

Such problem exists when SyslogHandler instantiated with /dev/log.

If logging is performed to remote host via udp socket, then exception
logged as one long string with all lines being concatenated.

Probably multiline log messages should be automatically splitted and
logged line-by-line with the same facility, severity and program name.
Also it will be good to have special formatter tag which expands as
empty string in first logged line, and as user-defined string in
remaining ones. This can simplify automated log analysis.

--
components: Library (Lib)
messages: 90307
nosy: LwarX
severity: normal
status: open
title: multiline exception logging via syslog handler
type: behavior
versions: Python 2.5

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



[issue6393] OS X: python3 from python-3.1.dmg crashes at startup

2009-07-09 Thread Mark Dickinson

Mark Dickinson dicki...@gmail.com added the comment:

 One *could* add a check in pythonrun.c to substitute some suitable
 default (UTF-8) if nl_langinfo(CODESET) returns an empty value.

While googling for the source of this problem, I found other software 
projects that take this approach.  It doesn't seem totally unreasonable.

I just wish I understood *why* nl_langinfo(CODESET) is returning  in 
these cases.  I've looked for the source at 
http://www.opensource.apple.com, but can't find it;  maybe that part of 
Darwin isn't open source.

It seems that a lot of people end up with an OS X Terminal setup such that 
LC_CTYPE is 'UTF-8' (perhaps this is a 10.4 thing---I haven't encountered 
this myself);  I don't think these people should have to deal with a 
confusing error on startup;  defaulting to UTF-8 on OS X seems like a 
reasonable compromise.

--

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



[issue6377] distutils compiler switch ignored

2009-07-09 Thread Marc-Andre Lemburg

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

Tarek Ziadé wrote:
 Tarek Ziadé ziade.ta...@gmail.com added the comment:
 
 I'll set back the compiler attribute when compiler_obj is set too, 
 so third-party code will be able to work with it as before.
 
 The current code will deprecate this usage, by displaying a deprecation
 warning:
 
 - if the compiler is set to anything else than a string.
 - if the compiler is get and happens to be a compiler instance.
 
 so we can keep compiler as its initial purpose.

Could you please elaborate a bit on the reasoning behind
deprecating using .compiler for the compiler instance ?

The code did work before, so I'm not sure why you are trying
to fix something that wasn't really broken.

With the change you:

 * make the code more complex just to be able to raise
   a warning

 * introduce an cross-version incompatibility for tools
   using build_ext: they will now have to use .compiler
   for Python 2.3-2.6 and .compiler_obj for 2.7 and up

Wouldn't it be better to either leave things are they have
been for years (without problems) or find another solution ?

--

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



[issue6393] OS X: python3 from python-3.1.dmg crashes at startup

2009-07-09 Thread Ronald Oussoren

Ronald Oussoren ronaldousso...@mac.com added the comment:

The manpage says that nl_langinfo returns an empty string when there is 
an invalid setting.

There is validity in saying that 'LANG=utf-8' is an invalid setting, the 
LANG variable is supposed to a locale name, which would be a language 
setting (possibly combined with a codeset definition). utf-8 is not a 
language.

I wouldn't mind falling back to utf-8 as the default codeset when 
nl_langinfo returns an empty string because utf-8 is the default 
character set on OSX, and furthermore defaulting to some value is way 
better than crashing.

I do wonder how the user ended up with LANG=utf-8 in the first place.

--

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



[issue6435] logging: cache the traceback text on formatter, instead of record

2009-07-09 Thread Sridhar Ratnakumar

Sridhar Ratnakumar sridh...@activestate.com added the comment:

 2. The exception text needs to be stored in the record, because in some
 instances (e.g. pickling and sending over a socket) this information
 will not be available at the other end in any other way.

Caching in the record object is thus the way to go. But the cache needs to  
be invalidated when `exc_info` is changed .. as in set to None when it was  
a traceback object. I'd change the following:

 if record.exc_text:
 if s[-1:] != \n:

to:

 if record.exc_info and record.exc_text:
 if s[-1:] != \n:

(or, move the body of this IF to the preceding IF)

 3. The way it works now, if you have multiple formatters attached to
 multiple handlers (e.g. with ISO time for log files, with no ISO time
 for console output), then the traceback is only converted to text once.

Yes, that is the benefit of caching I see.

 4. There's nothing stopping you from overriding Formatter.format, is
 there? the base version uses the cache, you can override format in your
 custom formatter and ignore the cache altogether if you like.

I can, but I'd rather not duplicate that code. From the recipe I linked  
above:

 def format(self, record):
 # attach 'error:' prefix to error/critical messages
 s = logging.Formatter.format(self, record)
 if record.levelno = logging.ERROR:
 return 'error: {0}'.format(s)
 else:
 return s

Here, I simply call the base class's `format` method.

And do you know of a better way to suppress traceback output (in the  
custom handler during `log.exception`) than the hack used in the recipe?

 elif record.levelno = logging.ERROR:
 if record.exc_info and self.verbosity_level  1:
 # supress full traceback with verbosity_level = 0
 with new_record_exc_info(record, None):
 self.__emit(record, sys.stderr)
 else:
 self.__emit(record, sys.stderr)

.. http://code.activestate.com/recipes/576836/

--

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



[issue6393] OS X: python3 from python-3.1.dmg crashes at startup

2009-07-09 Thread Mark Dickinson

Mark Dickinson dicki...@gmail.com added the comment:

 There is validity in saying that 'LANG=utf-8' is an invalid setting

Agreed.  But that doesn't really explain why e.g. LANG=en_US also 
produces , while LANG=invalid produces US-ASCII.

 I do wonder how the user ended up with LANG=utf-8 in the first place.

Me too.  As far as I can gather, it's a result of setting the Terminal 
preferences (particularly the character encoding and 'Set LANG 
environment variable on startup' checkbox) in some particular way, on 
some versions of OS X, for users in some countries, at some particular 
phases of the moon, etc...

--

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



[issue6377] distutils compiler switch ignored

2009-07-09 Thread Tarek Ziadé

Tarek Ziadé ziade.ta...@gmail.com added the comment:

The build_ext command cannot be run twice, because the first time, the
compiler option may be set to unix for example, or left to None, and
then is transformed into a compiler object. That's the bug.

If you call it again, it'll break because the new_compiler() function
will receive self.compiler, which is supposed to be a string not a
compiler object.

compiler is described as the compiler type in the options list of
build_ext and should receive a string value.

So what's broken is the fact that third-party code is using compiler 
as a compiler object attribute for years, because the command was
creating the compiler object on the compiler option, rather than using
its own attribute for that. And from an architectural point of view, if
you have to tweak the compiler options by tweaking them direclty, it
means that the build_ext command did a bad job with in the options
it provides.

For the cross-version incompatibility you are mentioning, it means that
your code is working with compiler as a string option, then continue
to work with it as a compiler object right after the command is run.
But either way, there will be an incompatibility starting at 3.3 because
we are going from the state compiler is a string and also a compiler
object, depending on when you use it to compiler is a only string option

This is an inconsistent behavior I am fixing here. While the code may be
more complex with the descriptor, this will eventually go away in 3.3
(and 2.8 if it exists).

What is the other solution you where thinking about ? adding a
compiler_type option and keep the compiler option woud introduce more
incompatibilities since compiler is used to configure build_ext by
many code out there, while tweaking the compiler object itself is an
advanced usage done by less people, which may do the same thing in an
easy way by using another attribute.

--

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



[issue6393] OS X: python3 from python-3.1.dmg crashes at startup

2009-07-09 Thread Ronald Oussoren

Ronald Oussoren ronaldousso...@mac.com added the comment:

The attached patch (issue6393-fix.patch) seems to fix the issue.

Could you please test and have a look at the patch? It basicly tests if 
the output of nl_langinfo(CODESET) is the empty string and defaults to 
'UTF-8' in that case (but only on OSX).

I intent to apply this patch unless someone objects to that.

--
keywords: +needs review, patch
Added file: http://bugs.python.org/file14476/issue6393-fix.patch

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



[issue6377] distutils compiler switch ignored

2009-07-09 Thread Marc-Andre Lemburg

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

Tarek Ziadé wrote:
 Tarek Ziadé ziade.ta...@gmail.com added the comment:
 
 The build_ext command cannot be run twice, because the first time, the
 compiler option may be set to unix for example, or left to None, and
 then is transformed into a compiler object. That's the bug.
 
 If you call it again, it'll break because the new_compiler() function
 will receive self.compiler, which is supposed to be a string not a
 compiler object.

You never run a command twice unless you explicitly reinitialize it
(which then resets .compiler to None and then fetches the command line
option again), so the above is not a problem.

 compiler is described as the compiler type in the options list of
 build_ext and should receive a string value.
 
 So what's broken is the fact that third-party code is using compiler 
 as a compiler object attribute for years, because the command was
 creating the compiler object on the compiler option, rather than using
 its own attribute for that. And from an architectural point of view, if
 you have to tweak the compiler options by tweaking them direclty, it
 means that the build_ext command did a bad job with in the options
 it provides.

I agree that it's not exactly ideal to have an attribute first
be a string and then an object.

 For the cross-version incompatibility you are mentioning, it means that
 your code is working with compiler as a string option, then continue
 to work with it as a compiler object right after the command is run.

Not quite: extensions of build_ext will likely customize the
way the extension objects are built, ie. override .build_extensions()
which is called after .compiler has been set to the compiler instance.

So they always work with the compiler instance. And they don't really care
about the option at all, since all that information is available from
looking at the compiler object.

 But either way, there will be an incompatibility starting at 3.3 because
 we are going from the state compiler is a string and also a compiler
 object, depending on when you use it to compiler is a only string option
 
 This is an inconsistent behavior I am fixing here. While the code may be
 more complex with the descriptor, this will eventually go away in 3.3
 (and 2.8 if it exists).
 
 What is the other solution you where thinking about ? adding a
 compiler_type option and keep the compiler option woud introduce more
 incompatibilities since compiler is used to configure build_ext by
 many code out there, while tweaking the compiler object itself is an
 advanced usage done by less people, which may do the same thing in an
 easy way by using another attribute.

First of all, you only use a single compiler for building an
Python package, so using the global build compiler option will do
just fine (and is also required if you have other commands
rely on this information as well, such as the config command,
the build_clib command or other custom commands).

The compiler option on the build_ext and config commands
are not really needed. Their .finalize_options() methods could
easily pull in the build option value and place it into
an .compiler_type attribute which then gets used as basis for
creating the .compiler instance, or even better refactor the
various commands to use a central method on the build
command object to create a compiler object and avoid all
the copypaste code for this.

Furthermore, the .finalize_options() methods could detect whether
a per-command option as used and deprecate this use instead,
redirecting to the build command option.

Please note that it's common practice in distutils to have
the compiler instance in an .compiler attribute, so either
you change it in all cases or not at all.

The fact that the options on some of those commands is
named --compiler as well, is rather unfortunate.

Regarding wide-spread use of the compiler command line option:
I am only aware of the cygwin/mingw32 case where you'd really
need it. In all other cases I know, the default choice based
on the compiler with which Python itself was compiled will
work fine.

--

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



[issue6377] distutils compiler switch ignored

2009-07-09 Thread Marc-Andre Lemburg

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

FWIW: I've changed our mxSetup code to use a method for accessing
the compiler instance.

Perhaps that's the better way to go for standard distutils commands
as well ?! E.g. .get_compiler_object()

--

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



[issue6443] _winreg.QueryValueEx confused on double null terminated strings

2009-07-09 Thread Amaury Forgeot d'Arc

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

The double null is supposed to mark the end of the whole sequence; the
content you show under PendingFileRenameOperations is a invalid
REG_MULTI_SZ value to me.
How does regedit display it?

--
nosy: +amaury.forgeotdarc

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



[issue5870] subprocess.DEVNULL

2009-07-09 Thread OG7

Changes by OG7 ony...@users.sourceforge.net:


--
nosy: +OG7

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



[issue6445] Add check parameter to subprocess.Popen.communicate

2009-07-09 Thread OG7

New submission from OG7 ony...@users.sourceforge.net:

communicate is often used in one-liners, but becomes a four-liner if you
want to check the process exit status. Adding a check parameter would
make it more convenient to get things right and write non-buggy code.

The CalledProcessError requires a cmd argument, which means also adding
a cmd member to Popen objects.

--
messages: 90318
nosy: OG7
severity: normal
status: open
title: Add check parameter to subprocess.Popen.communicate

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



[issue6443] _winreg.QueryValueEx confused on double null terminated strings

2009-07-09 Thread Amaury Forgeot d'Arc

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

It seems that regedit itself cannot handle these values, see how users
have to edit data in binary mode to enter empty strings:
http://www.pcreview.co.uk/forums/thread-1715654.php

Here is a script that shows the problem: the value is returned truncated
before the empty string.

from _winreg import *
test_key_name = SOFTWARE\\Python Registry Test Key - Delete Me
hkey = CreateKey(HKEY_CURRENT_USER, test_key_name)
SetValueEx(hkey, Multi, 0, REG_MULTI_SZ,
   ['test', 'with', '', 'an', 'empty', 'line'])
print QueryValueEx(hkey, Multi)

--
stage:  - needs patch

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



[issue6393] OS X: python3 from python-3.1.dmg crashes at startup

2009-07-09 Thread Mark Dickinson

Mark Dickinson dicki...@gmail.com added the comment:

Thanks, Ronald!  The patch fixes the problem for me.
(I directly patched the locale.py file installed from
the Python dmg, since I still haven't figured out how
to build a python executable that exhibits this
problem.)

The patch doesn't look quite right, though: in the else clause,
it looks as though you're testing 'result' before it exists.
Shouldn't the 'result = nl_langinfo(CODESET)' line come
before the 'if not result and ' line?

On the subject of Terminal and LANG, LC_CTYPE settings, I found an 
interesting link:

http://pastie.textmate.org/111807

Indeed, after setting my region to 'South Africa' in Preferences - 
International - Formats, a newly opened Terminal window gives me:

newton:~ dickinsm$ locale
LANG=
LC_COLLATE=C
LC_CTYPE=UTF-8
LC_MESSAGES=C
LC_MONETARY=C
LC_NUMERIC=C
LC_TIME=C
LC_ALL=

And then python3 crashes on startup as above.  This is on a newborn (3-
week old) MacBook Pro that's been barely changed from default settings 
(and no transfer of files and settings from an old Mac, either).

--

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



[issue6435] logging: cache the traceback text on formatter, instead of record

2009-07-09 Thread Vinay Sajip

Vinay Sajip vinay_sa...@yahoo.co.uk added the comment:

 But the cache needs to be invalidated when `exc_info` is changed -
 as in set to None when it was a traceback object.

When does the exc_info change for a record? AFAIK it's set when you 
create a LogRecord, and that's it.

To be honest, I'm not sure why you need that specific recipe. Notice 
the comment made by a user against the recipe. But if you are set on 
doing it like this, then suppose I configure as follows:

Create a StreamHandler(sys.stderr) and a StreamHandler(sys.stdout).
Create a Formatter and attach it to the output handler.
Create a Formatter with the format string used above but with 
an error: prefix, and attach it to the error handler.
Add a Filter to each handler. This can be a single Filter class which 
either passes everything above a threshold or everything below a 
threshold. This will only have a few lines of code. Attach two such 
instances, suitably configured, to the appropriate handlers.
Attach both handlers to the root logger (or some other logger).

How will this differ in its effect from your recipe?

--

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



[issue6333] logging: ValueError: I/O operation on closed file

2009-07-09 Thread Vinay Sajip

Vinay Sajip vinay_sa...@yahoo.co.uk added the comment:

 Shouldn't the logging module be reliable in such cases?

It tries to be, but it's neither omnipotent nor omniscient. It doesn't 
expect streams which it's using to be closed out from under it.

See my comments about your ConsoleHandler recipe(s) on issue6345. Sorry 
if it seems I'm trying to rain on your parade - I'm just calling it as 
I see it.

--
resolution:  - invalid
status: open - closed

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



[issue6393] OS X: python3 from python-3.1.dmg crashes at startup

2009-07-09 Thread Ronald Oussoren

Ronald Oussoren ronaldousso...@mac.com added the comment:

Good catch, the code in the else is indeed in the wrong order.

--

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



[issue6333] logging: ValueError: I/O operation on closed file

2009-07-09 Thread holger krekel

holger krekel holger.kre...@gmail.com added the comment:

I think the issue is unrelated to py.test - it just presents a use case
as it wants to run 1000's of tests and capture stdout/stderr per each
test function, cannot guess about a test's logging-usage yet wants to
minimize memory/resource usage and close any temporary files it opens.  

Anyway, a standalone minimal example involving the issue is this:

import logging
import StringIO
stream = StringIO.StringIO()
logging.basicConfig(stream=stream)
stream.close() # to free memory/release resources

At exit logging's shutdown() will try to flush/close resulting in an
exception.  Is it a problem to have the logging module be a bit more
defensive and only try a flush/close if the stream isn't already closed?

--
nosy: +hpk

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



[issue6446] import_spam() in extending python can fail without setting the error.

2009-07-09 Thread Julian Andres Klode

New submission from Julian Andres Klode j...@jak-linux.org:

The given example function initspam fails if an 

Based on some experience with my own code, I have found out that the
function import_spam() fails when the module is not importable. In this
case, it returns 0, although it should return -1 when an error occurs.

This causes a standalone program to crash if it has a main() function like:

Py_Initialize();
if (import_spam()  0) {
Py_Finalize();
return 1;
}
Py_Finalize();

The function should return -1, so we can know there is an error and are
able to handle it.

--
assignee: georg.brandl
components: Documentation
messages: 90325
nosy: georg.brandl, jak
severity: normal
status: open
title: import_spam() in extending python can fail without setting the error.
type: crash
versions: Python 2.6

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



[issue6414] struct module : processor endianness descriptions misleading

2009-07-09 Thread Alexey Shamrin

Alexey Shamrin sham...@gmail.com added the comment:

Good suggestions, Mark! We should do both, I think. I didn't know about
sys.byteorder before your message ;-) Thanks for education!

How about this:

Native byte order is big-endian or little-endian, depending on the host 
system. For example, Intel x86 and AMD64 (x86-64) are little-endian;
Motorola 68000 and PowerPC G5 are big-endian; some are even bi-endian
(switchable endianess) - ARM and DEC Alpha. Use sys.byteorder to check
the endianess of your system.

Sorry for any spelling and styling mistakes...

--
nosy: +ash

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



[issue6414] struct module : processor endianness descriptions misleading

2009-07-09 Thread Alexey Shamrin

Alexey Shamrin sham...@gmail.com added the comment:

Little style:

Native byte order is big-endian or little-endian, depending on the host 
system. For example, Intel x86 and AMD64 (x86-64) are little-endian;
Motorola 68000 and PowerPC G5 are big-endian; ARM and DEC Alpha feature
switchable endianness (bi-endian). Use sys.byteorder to check the
endianess of your system.

--

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



[issue6333] logging: ValueError: I/O operation on closed file

2009-07-09 Thread Vinay Sajip

Vinay Sajip vinay_sa...@yahoo.co.uk added the comment:

 Is it a problem to have the logging module be a bit more defensive and
 only try a flush/close if the stream isn't already closed?

Not particularly, but it would be better if the following approach were
taken:

import logging
import StringIO
stream = StringIO.StringIO()
h = logging.StreamHandler(stream)
r = logging.getLogger()
r.addHandler(h)
#Do your testing work
r.removeHandler(h)
h.close() # closes underlying stream, also removes logging refs to h

It should be understood that if a stream is passed to a StreamHandler,
the ownership of that stream is passed as well, so closing the handler
rather than the underlying stream is the right thing to do. ISTM this is
good practice in general and not exclusive to logging.

--

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



[issue5753] CVE-2008-5983 python: untrusted python modules search path

2009-07-09 Thread Jan Lieskovsky

Jan Lieskovsky ian...@seznam.cz added the comment:

Hello guys,

  what's the current state of this issue? The proposed patch hasn't
still been projected into upstream Python code, so wondering:
1, when and if it will be?
2, if you have found another solution / patch?

Thanks  Regards, Jan.
--
Jan iankko Lieskovsky

--

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



[issue5753] CVE-2008-5983 python: untrusted python modules search path

2009-07-09 Thread Antoine Pitrou

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

Hello,

   what's the current state of this issue? The proposed patch hasn't
 still been projected into upstream Python code, so wondering:
 1, when and if it will be?

I was hoping for more feedback before committing it. While it has been
labeled a security issue, not many people seem to actually care. Distro
maintainers doing their own patching without communicating with us
doesn't help either.

 2, if you have found another solution / patch?

If it were so this bug would have been closed.

--

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



[issue6447] PATCH: typo (English) in subprocess module

2009-07-09 Thread Yinon Ehrlich

Changes by Yinon Ehrlich yino...@users.sourceforge.net:


--
components: Library (Lib)
files: subprocess.patch
keywords: patch
nosy: Yinon
severity: normal
status: open
title: PATCH: typo (English) in subprocess module
versions: Python 2.7
Added file: http://bugs.python.org/file14477/subprocess.patch

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



[issue816059] popen2 work, fixes bugs 768649 and 761888

2009-07-09 Thread Amaury Forgeot d'Arc

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

OTOH, the test code runs fine with python 2.4.4, so what is the purpose
of this patch?

--
nosy: +amaury.forgeotdarc

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



[issue5191] Partial function application 'from the right'

2009-07-09 Thread Amaury Forgeot d'Arc

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

Closing as requested.

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

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



[issue6448] imp.find_module() -- be explicity that 'path' must be a list

2009-07-09 Thread Jordan Bettis

New submission from Jordan Bettis jord...@hafdconsulting.com:

Hi. I just spent a while fighting with imp.find_module because I was
trying to pass the path as a string, rather than a string embedded in a
list:

result = find_module('mod', '/path')

rather than

result = find_module('mod', ['/path'])

The issue is compounded by an incredibly unhelpful error message:

ImportError: No frozen submodule named /path.mod

Now the documentation *does* say that path should be a list, if you read
it carefully, so perhaps it was just my reading comprehension. But doing
a google search I found a discussion from 2006 along the same lines:

http://www.techlists.org/archives/programming/pythonlist/2006-01/msg01445.shtml

So I thought it might be good to clarify that a string will not work.
Perhaps the wording could be changed to something like this:


   Try to find the module *name* on the search path *path*.  The
   *path* argument is a list of directory names. Each directory is
   searched for files with any of the suffixes returned
   by :func:`get_suffixes` above.  Invalid names in the list are
   silently ignored (but all list items must be strings).  If
   *path* is omitted or ``None``, the list of directory names
   given by ``sys.path`` is searched, but first it searches a few
   special places: it tries to find a built-in module with the
   given name (:const:`C_BUILTIN`), then a frozen
   module (:const:`PY_FROZEN`), and on some systems some other
   places are looked in as well (on Windows, it looks in the
   registry which may point to a specific file).

I think what is confusing is the conditional about the type of 'path',
The possibilities are 'list' or 'not present' (or None) but when I read
it I think I saw the 'not present' option as being implicit, and the
conditional implying that it could be a string or a list of strings.
From the discussion above it seems like the other person had the same
trouble, so removing the conditional should be enough to make it clear
that path *must* be a list if it exists.

--
assignee: georg.brandl
components: Documentation
messages: 90333
nosy: georg.brandl, jordanb
severity: normal
status: open
title: imp.find_module() -- be explicity that 'path' must be a list
versions: Python 2.4, Python 2.5, Python 2.6, Python 2.7, Python 3.0, Python 
3.1, Python 3.2

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



[issue6414] struct module : processor endianness descriptions misleading

2009-07-09 Thread Raymond Hettinger

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


--
assignee: georg.brandl - rhettinger
nosy: +rhettinger
versions: +Python 3.2 -Python 2.5, Python 3.0

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




[issue6377] distutils compiler switch ignored

2009-07-09 Thread Nicolas Dumazet

Nicolas Dumazet nicd...@gmail.com added the comment:

It seems that the fix is still not perfect.

At the moment ( r73906 ), if you try to build trunk using Python 2.6,
you get:

 python setup.py build
running build
running build_ext
Traceback (most recent call last):
  File setup.py, line 1901, in module
main()
  File setup.py, line 1896, in main
'Lib/smtpd.py']
  File /usr/lib/python2.6/distutils/core.py, line 152, in setup
dist.run_commands()
  File /usr/lib/python2.6/distutils/dist.py, line 975, in run_commands
self.run_command(cmd)
  File /usr/lib/python2.6/distutils/dist.py, line 995, in run_command
cmd_obj.run()
  File /usr/lib/python2.6/distutils/command/build.py, line 135, in run
self.run_command(cmd_name)
  File /usr/lib/python2.6/distutils/cmd.py, line 333, in run_command
self.distribution.run_command(command)
  File /usr/lib/python2.6/distutils/dist.py, line 995, in run_command
cmd_obj.run()
  File /usr/lib/python2.6/distutils/command/build_ext.py, line 345, in run
self.build_extensions()
  File setup.py, line 103, in build_extensions
missing = self.detect_modules()
  File setup.py, line 302, in detect_modules
add_dir_to_list(self.compiler_obj.library_dirs, '/usr/local/lib')
  File /usr/lib/python2.6/distutils/cmd.py, line 112, in __getattr__
raise AttributeError, attr
AttributeError: compiler_obj

--
nosy: +nicdumz

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



[issue6416] Failed to compile selectmodule.c on windows (trunk)

2009-07-09 Thread R. David Murray

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

This constant was introduced in r73818 by Gregory, so I'm assigning this
ticket to him.  Note that the trunk Windows buildbot is also failing to
compile because of this bug.

--
assignee:  - gregory.p.smith
components: +Library (Lib) -Windows
keywords: +easy
nosy: +gregory.p.smith, r.david.murray
priority: high - critical
stage:  - needs patch
type:  - compile error

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



[issue5753] CVE-2008-5983 python: untrusted python modules search path

2009-07-09 Thread Tomas Hoger

Tomas Hoger tho...@redhat.com added the comment:

Have you considered something like this? (patch against 3.1)

--- Python/sysmodule.c.orig
+++ Python/sysmodule.c
@@ -1643,6 +1643,7 @@ PySys_SetArgv(int argc, wchar_t **argv)
 #endif /* Unix */
}
 #endif /* All others */
+   if (n  0 || argv0 == NULL || wcscmp(argv0, L-c) == 0) {
a = PyUnicode_FromWideChar(argv0, n);
if (a == NULL)
Py_FatalError(no mem for sys.path insertion);
@@ -1650,6 +1651,7 @@ PySys_SetArgv(int argc, wchar_t **argv)
Py_FatalError(sys.path.insert(0) failed);
Py_DECREF(a);
+   }
}
Py_DECREF(av);
 }

I presume main problem here is that '' may end up as first item in
sys.path in certain cases.

That is desired in some cases, namely:
- python run in interactive mode
- python -c '...'

It does not happen and is not desired in other cases:
- ./foo.py
- python foo.py
- env python foo.py

Here foo.py can be just filename or filename with relative or absolute
path.  In all these cases python seems to set argv0 to something
realpath can resolve.

Problematic case is embedded use when bogus argv0 can cause '' to be
added to sys.path, but it's usually not desired / expected (is anyone
aware of the case when that is expected?).  It can be argued whether
apps should use garbage as argv0, but example in Demo/embed/demo.c do it
as well...

Patch above attempts to skip modification of sys.path when realpath
failed (n == 0).  There are two special cases, that are treated as
special on couple of other places in PySys_SetArgv already:
- argv0 == NULL (interactive python)
- argv0 == -c (python -c)

This should fix the problem for apps embedding python and providing
garbage argv0.  It would not make a difference for apps that provide
some valid path as argv0.  I'm not aware of non-embedded python use that
will end up with different sys.path after this patch.

Ideas?  Anyone is aware of the valid usecase that can break with this?

Advantage to Ex approach is that it does not require change on the
embedding apps side, and should really impact only those setting garbage
argv0.

--
nosy: +thoger

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



[issue6416] Failed to compile selectmodule.c on windows (trunk)

2009-07-09 Thread R. David Murray

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

I found this article that might be of interest with regards to PIPE_BUF
(or rather lack thereof) on Windows:

http://cygwin.com/ml/cygwin-patches/2004-q3/msg00084.html

It doesn't look like doing the right thing in Windows where in Posix
you would use PIPE_BUF is particularly easy, but that doesn't really
impact fixing the compile error.

--

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



[issue2504] Add gettext.pgettext() and variants support

2009-07-09 Thread David Schnur

David Schnur david.sch...@dartware.com added the comment:

I came across this ticket while looking for alternatives to Python's
gettext, since I need msgctx support.  It seems a patch was supplied for
this a while back.  I have never contributed to Python, and am not
familiar with your release process, but is there anything preventing its
inclusion?  It would be very convenient to have this in a release version.

--
nosy: +DNS

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



[issue2504] Add gettext.pgettext() and variants support

2009-07-09 Thread Martin v . Löwis

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

Only my lack of time prevents inclusion.

--

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



[issue6449] Improve/update python.org/dev/

2009-07-09 Thread Ezio Melotti

New submission from Ezio Melotti ezio.melo...@gmail.com:

Reading python.org/dev/ I noticed a few things that could be
improved/updated:
1) in http://www.python.org/dev/implementations/ Unladen Swallow is missing;
2) in http://www.python.org/dev/contributing/ there's an any and any
that should probably be any and all;
3) in the same page, in the fixing bugs section, there are some
**..**, is that some ReST markup that was not supposed to be there?
4) in http://www.python.org/dev/intro/ the IRC channels are not
mentioned (#python, #python-dev, #python-docs);
5) in the same page there's an XXX that should be fixed;
6) in the following line there's a what ever that should probably be
whatever;
7) always there, a link to http://www.python.org/psf/donations/ should
be added in the second last paragraph;
8) in http://www.python.org/dev/buildbot/ there should probably be 3.2
in (what will become 3.1);
9) is http://www.python.org/dev/summary/ still alive?
10) in the last list of links in http://www.python.org/dev/ the trailing
'/' are missing, but they are present in the menu on the left;

(I'm not sure this is the right place where to report this.)

--
assignee: georg.brandl
components: Documentation
keywords: easy
messages: 90340
nosy: ezio.melotti, georg.brandl
priority: low
severity: normal
status: open
title: Improve/update python.org/dev/

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



[issue6450] normpath() sometimes maps unicode to str

2009-07-09 Thread Erik Sandberg

New submission from Erik Sandberg sandb...@virtutech.com:

On Linux, I get the following:

 import os
 os.path.normpath(u'/')
'/'

I would expect unicode to be mapped to unicode. os.path.abspath() has
the same problem, see also issue 3426.

This causes problems in my project, where a function requires its
parameters to be Unicode. Do the standard Python library functions that
operate on strings guarantee anything in general with respect to
conserving unicode? Can I make any assumption as to which codec was used
to encode the str returned from normpath?

--
components: Library (Lib)
messages: 90341
nosy: sandberg
severity: normal
status: open
title: normpath() sometimes maps unicode to str
type: behavior
versions: Python 2.6

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



[issue6449] Improve/update python.org/dev/

2009-07-09 Thread Brett Cannon

Brett Cannon br...@python.org added the comment:

Technically pydot...@python.org is the proper place to report this stuff, 
but it's not a big deal as I unofficially in charge of /dev so I will take 
care of it.

--
assignee: georg.brandl - brett.cannon
nosy: +brett.cannon

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



[issue6450] normpath() sometimes maps unicode to str

2009-07-09 Thread Ezio Melotti

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


--
components: +Unicode
nosy: +ezio.melotti
priority:  - normal
stage:  - test needed
versions: +Python 2.7

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



[issue6450] normpath() sometimes maps unicode to str

2009-07-09 Thread Martin v . Löwis

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

 Do the standard Python library functions that
 operate on strings guarantee anything in general with respect to
 conserving unicode? Can I make any assumption as to which codec was used
 to encode the str returned from normpath?

The bug tracker is not really a place to ask questions. Please ask them
on python-list or elsewhere, or read the source code of normpath.

--
nosy: +loewis

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



[issue6333] logging: ValueError: I/O operation on closed file

2009-07-09 Thread holger krekel

holger krekel holger.kre...@gmail.com added the comment:

To recap the use case: stdout is redirected during a test function run
which might trigger arbitrary usage of logging-functionality.  Not
closing the temporary file would mean that there could be as many open
files as there are test functions - or one needs to rely on garbage
collection for closing the resource - this is generally considered bad
practise.  So I consider it best practise to do resource cleanup
immediately and close the temp file.  

Note that the test tool *does not touch the logging module at all*, and
it has no way to mandate the usage of the logging module like you suggest.

--

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



[issue6333] logging: ValueError: I/O operation on closed file

2009-07-09 Thread Sridhar Ratnakumar

Sridhar Ratnakumar sridh...@activestate.com added the comment:

On Thu, 09 Jul 2009 06:48:28 -0700, Vinay Sajip rep...@bugs.python.org  
wrote:

 It should be understood that if a stream is passed to a StreamHandler,
 the ownership of that stream is passed as well, so closing the handler
 rather than the underlying stream is the right thing to do. ISTM this is
 good practice in general and not exclusive to logging.

However, sys.stdout|err can be assigned to some thing else (eg: py.test  
assigning it to an open file object) .. in which case it is legitimate to  
handle (close) such objects (handles) by who created it (py.test).

--

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



[issue6333] logging: ValueError: I/O operation on closed file

2009-07-09 Thread Sridhar Ratnakumar

Sridhar Ratnakumar sridh...@activestate.com added the comment:

 See my comments about your ConsoleHandler recipe(s) on issue6345

Correction: issue6435

--

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



[issue6435] logging: cache the traceback text on formatter, instead of record

2009-07-09 Thread Sridhar Ratnakumar

Sridhar Ratnakumar sridh...@activestate.com added the comment:

 Vinay Sajip vinay_sa...@yahoo.co.uk added the comment:

 But the cache needs to be invalidated when `exc_info` is changed -
 as in set to None when it was a traceback object.

 When does the exc_info change for a record? AFAIK it's set when you
 create a LogRecord, and that's it.

Ok.

 To be honest, I'm not sure why you need that specific recipe. Notice
 the comment made by a user against the recipe.

I've responded as well .. that will explain why I need this specific  
recipe.

 But if you are set on
 doing it like this, then suppose I configure as follows:

 Create a StreamHandler(sys.stderr) and a StreamHandler(sys.stdout).
 Create a Formatter and attach it to the output handler.
 Create a Formatter with the format string used above but with
 an error: prefix, and attach it to the error handler.
 Add a Filter to each handler. This can be a single Filter class which
 either passes everything above a threshold or everything below a
 threshold. This will only have a few lines of code. Attach two such
 instances, suitably configured, to the appropriate handlers.
 Attach both handlers to the root logger (or some other logger).

 How will this differ in its effect from your recipe?

Actually, I did not know about 'Filter' until now. I will give it a try  
sometime.

--

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



[issue6443] _winreg.QueryValueEx confused on double null terminated strings

2009-07-09 Thread Andrew Ziem

Andrew Ziem ahz...@gmail.com added the comment:

Attached screenshot shows regedit handles \x00\x00 by showing all the
invalid values (each \x00 becomes a line break).  More importantly,
Windows apparently reads all the invalid value when processing
FileRenameOperations, so my Python program must be able to read invalid
value to append new instructions.

--
Added file: http://bugs.python.org/file14478/regedit_screenshot.PNG

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



[issue6451] Additional brackets to print

2009-07-09 Thread Vasiliy

New submission from Vasiliy bazo...@megabox.ru:

from __future__ import print_function
print('Foo','Bar')
print('FooBar')

2to3 translates it to

print(('Foo','Bar'))
print('FooBar')

is it right?

--
components: 2to3 (2.x to 3.0 conversion tool)
files: test.py
messages: 90349
nosy: bazooka
severity: normal
status: open
title: Additional brackets to print
type: behavior
Added file: http://bugs.python.org/file14479/test.py

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



[issue6451] 2to3 adds additional brackets to print

2009-07-09 Thread Vasiliy

Changes by Vasiliy bazo...@megabox.ru:


--
title: Additional brackets to print - 2to3 adds additional brackets to print

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



[issue6451] 2to3 adds spare brackets to print

2009-07-09 Thread Vasiliy

Changes by Vasiliy bazo...@megabox.ru:


--
title: 2to3 adds additional brackets to print - 2to3 adds spare brackets to 
print

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



[issue6451] 2to3 adds spare brackets to print

2009-07-09 Thread R. David Murray

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

This is a duplicate of Issue6429.

--
nosy: +r.david.murray
priority:  - normal
resolution:  - duplicate
stage:  - committed/rejected
status: open - closed
superseder:  - 2to3: fix_future conflicts with fix_print

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



[issue6452] urllib2.Request() will not work with long authorization headers

2009-07-09 Thread Jamal Fanaian

New submission from Jamal Fanaian jfana...@gmail.com:

While testing this bug report in Gwibber
https://bugs.launchpad.net/gwibber/+bug/397297 I found that using
urllib2.Request() with a long authorization would cause it to error and
not authenticate. I'm not sure if it is because the header wasn't being
passed or any other issue.

The header would fail when the value part of the authorization string
was 89 characters.

I was able to resolve the issue by using urllib2.HTTPBasicAuthHandler()
and urllib2.install_opener() to install it, instead of passing the
Authorization header directly to urllib2.Request().

Please let me know if I can provide more information to test the issue.

--
components: Library (Lib)
messages: 90351
nosy: jamal
severity: normal
status: open
title: urllib2.Request() will not work with long authorization headers
type: behavior
versions: Python 2.6

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



[issue6429] 2to3: fix_future conflicts with fix_print

2009-07-09 Thread R. David Murray

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

See also issue 2412, which might or might not have a relevant patch.

--
nosy: +r.david.murray

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



[issue4506] 3.0 make test failures on Solaris 10

2009-07-09 Thread R. David Murray

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

NB: I fixed the test_posix failure on trunk/2.6/py3k/3.1 in r73908,
r73914, r73913, and r73915.

--
nosy: +r.david.murray

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4506
___
___
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-07-09 Thread nestor

nestor nestornis...@gmail.com added the comment:

Maybe make test will help troubleshoot this (BTW how do I enable verbose
mode?):

test test_ascii_formatd failed -- errors occurred; run in verbose mode
for details
test_cmath
test test_cmath failed -- Traceback (most recent call last):
  File
/datawhse/test/data/export/ptst/Python-3.1/Lib/test/test_cmath.py,
line 362, in test_specific_values
self.fail(error_message)
AssertionError: atan: atan(complex(0.0, 0.0))
Expected: complex(0.0, 0.0)
Received: complex(0.0, -0.0)
Received value insufficiently close to expected value.
test_cmd_line
test test_cmd_line failed -- errors occurred; run in verbose mode for
details
test_cmd_line_script
test test_cmd_line_script failed -- errors occurred; run in verbose mode
for details
test_code
test_distutils
Exception AttributeError: '_Stream' object has no attribute 'cmp' in
bound method _Stream.__del__ of tarfile._Stream object at 0x218c2d70
ignored
Exception AttributeError: '_Stream' object has no attribute 'cmp' in
bound method _Stream.__del__ of tarfile._Stream object at 0x21763bf0
ignored
unable to execute cc_r: No such file or directory
unable to execute cc_r: No such file or directory
unable to execute cc_r: No such file or directory
Exception AttributeError: '_Stream' object has no attribute 'cmp' in
bound method _Stream.__del__ of tarfile._Stream object at 0x21a3fc30
ignored
Exception AttributeError: '_Stream' object has no attribute 'cmp' in
bound method _Stream.__del__ of tarfile._Stream object at 0x21a3fdd0
ignored
test test_distutils failed -- errors occurred; run in verbose mode for
details
test_fileio
test test_fileio failed -- Traceback (most recent call last):
  File
/datawhse/test/data/export/ptst/Python-3.1/Lib/test/test_fileio.py,
line 262, in testAbles
self.assertEquals(f.seekable(), False)
AssertionError: True != False
test_httpservers
Fatal Python error: Py_Initialize: can't initialize sys standard streams
AttributeError: '_io.FileIO' object has no attribute 'raw'
Fatal Python error: Py_Initialize: can't initialize sys standard streams
AttributeError: '_io.FileIO' object has no attribute 'raw'
Fatal Python error: Py_Initialize: can't initialize sys standard streams
AttributeError: '_io.FileIO' object has no attribute 'raw'
Fatal Python error: Py_Initialize: can't initialize sys standard streams
AttributeError: '_io.FileIO' object has no attribute 'raw'
test test_httpservers failed -- errors occurred; run in verbose mode for
details
test_io
test test_io failed -- errors occurred; run in verbose mode for details
test_mmap
test test_mmap failed -- Traceback (most recent call last):
  File
/datawhse/test/data/export/ptst/Python-3.1/Lib/test/test_mmap.py, line
219, in test_access_parameter
m.flush()
mmap.error: [Errno 22] Invalid argument
test_multiprocessing
test test_multiprocessing failed -- errors occurred; run in verbose mode
for details

--

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



[issue6453] Improve bool TypeError message

2009-07-09 Thread Terry J. Reedy

New submission from Terry J. Reedy tjre...@udel.edu:

 cc=c()
 bool(cc)
Traceback (most recent call last):
  File pyshell#5, line 1, in module
bool(cc)
TypeError: __bool__ should return bool or int, returned int

This is slightly jarring.
Adding ' 0 or 1' after 'or int' would be nice (and trivial).
Adding str(val) at the end after type(val) would be even nicer.

--
components: Interpreter Core
keywords: easy
messages: 90355
nosy: tjreedy
severity: normal
status: open
title: Improve bool TypeError message
type: feature request
versions: Python 3.2

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



[issue6453] Improve bool TypeError message

2009-07-09 Thread R. David Murray

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

The error message is in error.  Int is not allowed in 3.x, only bool. 
This is thus superseded by issue 6428, which has already been fixed.

--
nosy: +r.david.murray
priority:  - normal
resolution:  - duplicate
stage:  - committed/rejected
status: open - closed
superseder:  - TypeError: __bool__ should return bool or int, returned int

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



[issue6323] Py3.1 pdb doesn't deal well with syntax errors

2009-07-09 Thread Vladislav

Vladislav kurto...@list.ru added the comment:

 lambda: pass
SyntaxError: invalid syntax (pyshell#0, line 1)
 lambda: pas
function lambda at 0x00F5C858
 func_1=lambda: pas
 func_1()
Traceback (most recent call last):
  File pyshell#3, line 1, in module
func_1()
  File pyshell#2, line 1, in lambda
func_1=lambda: pas
NameError: global name 'pas' is not defined
 func_1=lambda: pass
SyntaxError: invalid syntax (pyshell#4, line 1)
 

This is very funny:)

--
components: +Windows -Library (Lib)
nosy: +kurtoglu
type: behavior - crash

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



[issue3518] multiprocessing: BaseManager.from_address documented but doesn't exist

2009-07-09 Thread Casey McGinty

Casey McGinty casey.mcgi...@gmail.com added the comment:

I would like to open this ticket back up.

Python 2.6.2 docs still reference unimplemented 'from_address' method.

http://docs.python.org/library/multiprocessing.html#multiprocessing.managers.BaseManager.from_address

BaseManager.__reduce__ method also calls unimplemented 'from_address'
method. This looks like a bug since there is no docs or comments that
indicate it is as an abstract method.

--
nosy: +casey.mcgi...@gmail.com

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



[issue6323] Py3.1 pdb doesn't deal well with syntax errors

2009-07-09 Thread Andreas Kloeckner

Andreas Kloeckner inf...@tiker.net added the comment:

Vladislav: The behavior you find funny is actually correct. pass is a
statement and as such not allowed in a lambda. (only expressions are)
Your posting is unrelated to this bug report. If you're still confused,
please ask on comp.lang.python.

--
components: +Library (Lib) -Windows

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



[issue6443] _winreg.QueryValueEx confused on double null terminated strings

2009-07-09 Thread Amaury Forgeot d'Arc

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

Yes, but did you try to press OK? Regedit displays a warning that empty 
lines are not allowed, and *removes* them.

--

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



[issue5862] multiprocessing 'using a remote manager' example errors and possible 'from_address' code leftover

2009-07-09 Thread Casey McGinty

Changes by Casey McGinty casey.mcgi...@gmail.com:


--
nosy: +cmcginty

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



[issue6416] Failed to compile selectmodule.c on windows (trunk)

2009-07-09 Thread Amaury Forgeot d'Arc

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

PIPE_BUF was introduced for the subprocess module to use it... on posix 
platforms only.
r73916 (trunk) and r73917 (py3k) add the suggested #ifdef, and also fix 
test_subprocess.

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

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



[issue3518] multiprocessing: BaseManager.from_address documented but doesn't exist

2009-07-09 Thread Jesse Noller

Changes by Jesse Noller jnol...@gmail.com:


--
resolution: fixed - accepted
status: closed - open

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



[issue6333] logging: ValueError: I/O operation on closed file

2009-07-09 Thread Vinay Sajip

Changes by Vinay Sajip vinay_sa...@yahoo.co.uk:


--

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



[issue6323] Py3.1 pdb doesn't deal well with syntax errors

2009-07-09 Thread Amaury Forgeot d'Arc

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

Fixed in r73918 (py3k) and r73920 (release31-maint). Thanks for the 
report!

--
resolution:  - fixed
status: open - closed

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



[issue6333] logging: ValueError: I/O operation on closed file

2009-07-09 Thread Vinay Sajip

Vinay Sajip vinay_sa...@yahoo.co.uk added the comment:

 However, sys.stdout|err can be assigned to some thing else
 (eg: py.test assigning it to an open file object) .. in which case it 
 is legitimate to handle (close) such objects (handles) by who
 created it (py.test).

@Sridhar: I disagree. Creation is not ownership. Clearly ownership is
*initially* with the creator, but when a stream is used to initialise a
StreamHandler, ownership of the stream passes to the StreamHandler.

@Holger: I am not asking that py.test be specially modified to cater for
use of a logging module it knows nothing about. But your example showed
logging calls; I indicated what changes were needed to that sample to
interoperate with logging. So if that was a part of the test cases, then
the design of test cases which use logging (and not py.test itself, if
it doesn't invoke logging directly) needs to consider the interaction
between each test case, logging and py.test. And it is not solely the
responsibility of py.test to minimise resource usage during test runs;
part of this is also the responsibility of the test case design, which
surely is why test frameworks have the concepts of setUp and tearDown.

Your example calls logging.basicConfig passing a stream, and the stream
is then immediately closed. If the test case had involved threads which
did logging, for example, how could you guarantee that a call on the
stream (other than flush) would never happen after the call to close the
stream? Would I then have to ensure not only that flush was defensively
programmed, but write as well? It seems like a can of worms to me,
because of the propensity of this kind of approach to mask logic errors.
I'm not saying you never have to resort to defensive programming - just
that errors shouldn't pass silently where this is avoidable. The design
of StreamHandler is predicated on it owning the stream (for example, it
takes care to serialise access to the stream with locks, to allow
thread-safe operation). This would be pointless if other code could
arbitrarily operate on the stream without worrying about thread-safety.

I also pointed out numerous flaws in Sridhar's reasoning both in this
issue and in issue6435 (not py.test related) and in my view, he needs to
look more closely at the logging package and the included functionality,
and if necessary the core's regression test module, test_logging.py, to
see what sorts of issues crop up. For example, I pointed out in msg90148
that file-like objects are not guaranteed to have a closed attribute,
to which he has not responded. I would appeal for more attention to detail.

And just in case it may seem otherwise, I'll state explicitly that I am
not trying to be difficult. Similar issues have arisen during the
initial development of test_logging.py. 

I will update the documentation for StreamHandler, FileHandler etc. to
highlight the issue of ownership of the stream, as perhaps it's not
clear enough. Sorry if this post seems a little long-winded.

--

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



[issue6454] Add example keyword argument to optparse constructor

2009-07-09 Thread Daniel Waylonis

New submission from Daniel Waylonis d...@nekotech.com:

It's useful to see and example or two detailing how a program should be 
invoked and the expected results.

I'd like to add the example keyword which will be printed below the 
options: when the usage is displayed.  It would not be formatted like 
the description string.

--
components: Library (Lib)
messages: 90364
nosy: waylonis
severity: normal
status: open
title: Add example keyword argument to optparse constructor
type: feature request
versions: Python 3.2

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



[issue6454] Add example keyword argument to optparse constructor

2009-07-09 Thread Daniel Waylonis

Daniel Waylonis d...@nekotech.com added the comment:

Looking at the source, there's the undocumented epilog keyword, but it, 
unfortunately is automatically pushed through the formatter, which would 
not be desirable for the output.

--

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



[issue6423] The cgi docs should advertize using in instead of has_key

2009-07-09 Thread Ezio Melotti

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


--
priority:  - low

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



[issue6447] PATCH: typo (English) in subprocess module

2009-07-09 Thread Lucas Prado Melo

New submission from Lucas Prado Melo lucaspradom...@gmail.com:

I am pretty sure this patch is alright.

--
nosy: +lucaspmelo

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



[issue6443] _winreg.QueryValueEx confused on double null terminated strings

2009-07-09 Thread Andrew Ziem

Andrew Ziem ahz...@gmail.com added the comment:

Yes, regedit does remove the blanks, but this bug report is about
QueryValueEx---not about SetValueEx :).  There must be a way to read all
the values compatible with Windows

--

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



[issue2751] Regression for executing packages

2009-07-09 Thread Rene Dudfield

Rene Dudfield ill...@users.sourceforge.net added the comment:

Hi,

note -m on packages still works with python3.0 and python3.1.  It works
by allowing a __main__.py file that gets called by -m.

This is a really annoying regression for python2.6.  It's a fairly wide
spread feature too.

I can't see any PEP for why this regression exists.

For pygame we will probably work around it by using python -m
tests.main or python -m pygame.tests.run which is ugly, but at least
it'll work!


cheers,

--
nosy: +illume

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



[issue2751] Regression for executing packages

2009-07-09 Thread Nick Coghlan

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

It doesn't work in 2.6 or 3.0 because, as stated above, it was only due
to a bug that it even appeared to work at all in 2.5 (it was always
meant to be disallowed because it puts dodgy data in the import
machinery's internal records if you do it).

It took a new feature (looking for a __main__ module as described in
issue 4195 and as you already noted) to make it actually work properly
for 3.1 (and 2.7 when that is released).

--

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



[issue6393] OS X: python3 from python-3.1.dmg crashes at startup

2009-07-09 Thread Ned Deily

Ned Deily n...@acm.org added the comment:

Looks good and the patched patch also works in a py3k installer build.

BTW, Mark, I was curious as to why you were unable to reproduce the 
problem with your own build.  I should have mentioned that my testing 
was with complete installer (framework) builds.  I subsequently 
experimented with a non-framework build and found that I could not 
reproduce the problem running from the ./python in the build directory.  
Stepping through gdb showed that, during the calls from create_stdio, 
the import of locale fails in textio.c, so it falls back to using 
ascii as the default encoding (~line 899) and avoids the crash.  If I 
do a make install, the unpatched installed bin/python3 does crash in the 
same way as with the installer python3.

--

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



[issue6453] Improve bool TypeError message

2009-07-09 Thread Terry J. Reedy

Terry J. Reedy tjre...@udel.edu added the comment:

Phooey. I searched for 'bool TypeError' but it failed to return 6428.
I will ask on py-dev why not.

--
priority: normal - 
resolution: duplicate - 
stage: committed/rejected - 
status: closed - open

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



[issue6443] _winreg.QueryValueEx confused on double null terminated strings

2009-07-09 Thread Andrew Ziem

Andrew Ziem ahz...@gmail.com added the comment:

Well, I no longer need QueryValueEx because I found out
win32file.MoveFileEx() does more easily what I need, but MoveFileEx (see
attachment for working example) shows that the Microsoft Window API
itself creates these invalid values

--
Added file: http://bugs.python.org/file14480/delete_locked_file.py

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



[issue2931] optparse: various problems with unicode and gettext

2009-07-09 Thread Alexey Shamrin

Changes by Alexey Shamrin sham...@gmail.com:


--
versions: +Python 2.7

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



[issue2751] Regression for executing packages

2009-07-09 Thread Rene Dudfield

Rene Dudfield ill...@users.sourceforge.net added the comment:

hello,

thanks for the explanation of why it's that way.  

Any ideas of a work around?


python2.5 has been out for ages now. Even if it was an accident, it's
the behavior people expect, and it's still a regression.

Also, why should it matter if a module is a package or a module?

Note how pygame.tests has a type of module, and not of package:
 import pygame.tests
 type(pygame.tests)
type 'module'

Even though it is a package, python calls its type a module.  This has
been true for a long time (at least as far back as python2.3).

Because it's a regression, I think this bug should be reopened.


To illustrate why it causes problems, here is part of the documentation
mentioning the __main__.



You can do a self test with:
python -m pygame.tests
Or with python2.6 do:
python -m pygame.tests.__main__

See a list of examples...
  python -m pygame.examples
Or with python2.6,
  python -m pygame.examples.__main__


It's twice as long, and I doubt anyone will remember the __main__ part.


People used to running their programs with -m now have broken programs
with python2.6.


Having said all that, maybe there is a work around...

One work around might be to make it into a module-module, not a
package-module.  Then have the module-module load the package-module
into its namespace.  I haven't tested that yet, but it might work.  Will
have to go through a round of testing to see how that works out.  Will
write back when I've found out the issues with that approach.


cheers,

--

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