[issue6855] ihooks support for relative imports

2009-09-07 Thread Neil Schemenauer

New submission from Neil Schemenauer nas-pyt...@arctrix.com:

ihooks in 2.6 does not support relative imports. The attached patch was 
impired by Brett's import in Python code.

--
assignee: brett.cannon
components: Library (Lib)
files: ihooks_relimport.txt
messages: 92345
nosy: brett.cannon, nascheme
priority: normal
severity: normal
stage: patch review
status: open
title: ihooks support for relative imports
type: behavior
versions: Python 2.6
Added file: http://bugs.python.org/file14852/ihooks_relimport.txt

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



[issue6856] allow settong uid and gid when creating tar files

2009-09-07 Thread Tarek Ziadé

New submission from Tarek Ziadé ziade.ta...@gmail.com:

I am proposing this feature for an issue we have in Distutils: being
able to set the uid/gid of files added in a tar archive using tarfile.

Here's what I am proposing:

- adding two methods to TarInfo: set_uid and set_gid, that are able to
take a user and group name *or* a uid and gid number

- adding in TarFile a new filter option to add() called include. If
given, it's a callable that receives the tarinfo object right before
it's added, so its uid/gid can be tweaked. This callable must return the
object. If it returns None, the object is not added to the tar file.

--
components: Library (Lib)
messages: 92348
nosy: lars.gustaebel, tarek
severity: normal
status: open
title: allow settong uid and gid when creating tar files
type: feature request
versions: Python 2.7, Python 3.2

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



[issue6516] reset owner/group to root for distutils tarballs

2009-09-07 Thread Tarek Ziadé

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

#6856 created.

--
dependencies: +allow settong uid and gid when creating tar files

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



[issue6856] allow setting uid and gid when creating tar files

2009-09-07 Thread Tarek Ziadé

Changes by Tarek Ziadé ziade.ta...@gmail.com:


--
title: allow settong uid and gid when creating tar files - allow setting uid 
and gid when creating tar files

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



[issue6546] [Distutils][PATCH] Add bdist_rpm option to select the name of the resulting package

2009-09-07 Thread Tarek Ziadé

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

Can you explain the reason why you need to change the distribution name,
and not use the name+version metadata to do it ?

Thanks

--

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



[issue6163] [HP-UX] ld: Unrecognized argument: +s -Ldir

2009-09-07 Thread Tarek Ziadé

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

Ok so, just to make sure, the final patch for both changes should be:

{{{
...
elif sys.platform[:5] == hp-ux:
if compiler.find('gcc'):
return [-Wl,+s, -L + dir]
return [+s, -L + dir]
...
}}}

--

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



[issue6516] reset owner/group to root for distutils tarballs

2009-09-07 Thread Tarek Ziadé

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

We can add two options to the commands that create tarballs:

- owner
- group
 

but we first need to add this capacity to the tarfile module because
right now the API doesn't allow you to add files with custom uid and gid.

I am going to add another issue with a proposal for this.

--
versions: +Python 2.7, Python 3.2 -Python 2.6

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



[issue6296] Native (and default) tarfile support for setup.py sdist in distutils on Windows

2009-09-07 Thread Tarek Ziadé

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

I think there's no consensus at this point in the best format for all
platform.

I am closing this issue as wontfix. Maybe a new format will rule them
all in a few years.
 
Michael, can you create a specific issue for the CRLF problem ? Thanks a
lot.

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

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



[issue1457] Cannot write an array in a file opened in r+b mode.

2009-09-07 Thread Ravon Jean-Michel

Ravon Jean-Michel jean-michel.ra...@gemalto.com added the comment:

It works in python 2.5. Why not in jython?

--
nosy: +jmravon
title: IDLE - configDialog - new layout for key config - Cannot write an array 
in a file opened in r+b mode.

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



[issue6145] distutils.extension.read_setup_file misinterprets -C switch

2009-09-07 Thread Tarek Ziadé

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

Thanks for the patch. 

I need to look at how read_setup_file is actually used in the community,
then apply the patch in consequence.

--
type:  - behavior
versions:  -Python 2.4, Python 2.5, Python 2.6, Python 3.0

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



[issue6114] distutils build_ext path comparison only based on strings

2009-09-07 Thread Tarek Ziadé

Changes by Tarek Ziadé ziade.ta...@gmail.com:


--
priority:  - normal
resolution:  - accepted
versions: +Python 2.7, Python 3.1, Python 3.2 -Python 2.5

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6114
___
___
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-09-07 Thread Tarek Ziadé

Changes by Tarek Ziadé ziade.ta...@gmail.com:


--
priority:  - high

___
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



[issue6856] allow setting uid and gid when creating tar files

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

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


--
assignee:  - lars.gustaebel

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



[issue6163] [HP-UX] ld: Unrecognized argument: +s -Ldir

2009-09-07 Thread Michael Haubenwallner

Michael Haubenwallner michael.haubenwall...@salomon.at added the comment:

Basically yes, two minor ones:
*) also look for 'g++',
*) string.find() returns the index where found, -1 when not found,
so:
{{{
...
elif sys.platform[:5] == hp-ux:
if compiler.find('gcc') = 0 or compiler.find('g++') = 0:
return [-Wl,+s, -L + dir]
return [+s, -L + dir]
...
}}}

Two lines below already is another search for 'gcc' or 'g++', which also
should be changed from 'compiler[:3]' to 'compiler.find()':
{{{
...
elif compiler.find(gcc) = 0 or compiler.find(g++) = 0:
return -Wl,-R + dir
...
}}}

Thank you!

--

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



[issue6163] [HP-UX] ld: Unrecognized argument: +s -Ldir

2009-09-07 Thread Tarek Ziadé

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

 Two lines below already is another search for 'gcc' or 'g++', 
 which also should be changed from 'compiler[:3]' to 'compiler.find()'

But compiler[:3] implies that the compiler string starts *with* 'gcc'.

so are you sure we're looking for 'gcc' anywhere in the string,
or at the beginning of it ?

In any case, I find these string searches very weak in there. I am going
to  refactor a function in distutils that guesses the type of compiler,
given a list of known compilers 'names' and a list of matching strings
(or regular expressions) for them.

I'll take all cases from unixcompiler and add a test for that, then use
it in this code.

Please don't hesitate to give me your list of

compiler string - compiler 'type'

so I can add them in my test.

Thanks !

--

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



[issue6829] Frendly error message when inheriting from function

2009-09-07 Thread anatoly techtonik

anatoly techtonik techto...@gmail.com added the comment:

How about:

Error running metaclass bases
(attempt to inherit from object that is not a class)

--

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



[issue6829] Frendly error message when inheriting from function

2009-09-07 Thread anatoly techtonik

anatoly techtonik techto...@gmail.com added the comment:

Or just:

Error inheriting from object that is not a class

--

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



[issue6829] Frendly error message when inheriting from function

2009-09-07 Thread anatoly techtonik

anatoly techtonik techto...@gmail.com added the comment:

Or with more info if possible:

Error when inheriting class %s - parent is not a class.

--

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



[issue6163] [HP-UX] ld: Unrecognized argument: +s -Ldir

2009-09-07 Thread Michael Haubenwallner

Michael Haubenwallner michael.haubenwall...@salomon.at added the comment:

 But compiler[:3] implies that the compiler string starts *with* 'gcc'.
 
 so are you sure we're looking for 'gcc' anywhere in the string,
 or at the beginning of it ?

It is very common to use the host triplet in the compiler name, like
'i686-pc-linux-gnu-gcc', even for non-cross builds. Sometimes the
compiler string also looks like 'ccache gcc' or 'distcc gcc'. Even
'/path/to/some/gcc' is possible, in combination with '/path/to/ccache'
and/or '/path/to/distcc'. And sometimes the version number is appended,
like 'gcc-X.Y.Z'. Also ABI-specific flags might be set there, like 'gcc
-m32'.

 In any case, I find these string searches very weak in there.

Agreed, but AFAICT, native and other non-gcc compilers never do have
something like 'gcc' in their installation path, especially not in their
executable basename (on AIX, HP-UX, Solaris). So eventually it is save
enough to search for gcc/g++ after the last path-separator, although
this won't work for things like 'gcc -I/my/local/include'.

 I am going to refactor a function in distutils that guesses the type
 of compiler, given a list of known compilers 'names' and a list of
 matching strings (or regular expressions) for them.

The most reliable way IMHO would be to preprocess '#ifdef __GNUC__', and
avoid searching the compiler string for anything.

Thank you!

--

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



[issue6854] UnicodeDecodeError when retrieving binary data from cgi.FieldStorage()

2009-09-07 Thread Ezio Melotti

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

Can you paste the traceback of the error?

--
nosy: +ezio.melotti

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



[issue6856] allow setting uid and gid when creating tar files

2009-09-07 Thread Lars Gustäbel

Lars Gustäbel l...@gustaebel.de added the comment:

TarInfo does not need set_uid() or set_gid() methods, both can be set
using the uid and gid attributes.
If the list of files to add to the archive is known you can do this:

tar = tarfile.open(foo.tar.gz, w:gz)
for filename in filenames:
  tarinfo = tar.gettarinfo(filename)
  if tarinfo.isreg():
fobj = open(filename)
  else:
fobj = None
  tarinfo.uid = 0
  tarinfo.gid = 0
  tar.addfile(tarinfo, fobj)
tar.close()

I am not against adding a new option. Although, it's too bad that I
added the exclude option in 2.6 not long ago, which does something very
similar and would again be replaced by this more general include
option. BTW, I think calling the option filter would be more suitable
for what it's doing.

--

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



[issue6844] BaseException DeprecationError raises inappropriately

2009-09-07 Thread Duncan Grisby

Duncan Grisby duncan-pyt...@grisby.org added the comment:

This affects my application too. We have a large body of code that uses
exception classes automatically generated from CORBA IDL, with
attributes named message. It is infeasible for us to change to use a
different attribute name. We've ended up with dirty hacks all over the
place to suppress the warnings.

--
nosy: +dgrisby

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



[issue6856] allow setting uid and gid when creating tar files

2009-09-07 Thread Tarek Ziadé

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

 TarInfo does not need set_uid() or set_gid() methods, 
 both can be set using the uid and gid attributes.

I was thinking about the set_ methods to be able to use
root (str) instead of 0 (int) for example, like 
what the tar command seems to allow with --uid and --gid.


 I am not against adding a new option. Although, it's too bad that 
 I added the exclude option in 2.6 not long ago, which does 
 something very similar and would again be replaced by this 
 more general include option. BTW, I think calling 
 the option filter would be more suitable for what it's doing.

Maybe we could add the filter option for 2.7/3.2 together with the
exclude option? And add a deprecation warning for exclude when it's
used, since it would then become *one* use case for filter.

We could also add an exclude callable in the module, as an example
usage of the filter option, exactly like I did for shutil.copytree
(look for ignore_patterns).

--

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



[issue1457] IDLE - configDialog - new layout for key config

2009-09-07 Thread Amaury Forgeot d'Arc

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

I suppose this update should have been directed to bugs.jython.org.
Something is probably wrong with the jython issue tracker...

--
nosy: +amaury.forgeotdarc, loewis
title: Cannot write an array in a file opened in r+b mode. - IDLE - 
configDialog - new layout for key config

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



[issue6713] Integer Long types: Performance improvement of 1.6x to 2x for base 10 conversions

2009-09-07 Thread Eric Smith

Changes by Eric Smith e...@trueblade.com:


--
nosy: +eric.smith

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



[issue6850] decimal.py: format_dict['type'] not initialized

2009-09-07 Thread Eric Smith

Changes by Eric Smith e...@trueblade.com:


--
nosy: +eric.smith

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



[issue6850] decimal.py: format_dict['type'] not initialized

2009-09-07 Thread Eric Smith

Eric Smith e...@trueblade.com added the comment:

The test as written will always give an error for None. I think the
better fix is to change it to be:

if format_dict['type'] is None or format_dict['type'] in 'gG':

That fixes this particular exception, but since the format specifier
is invalid, it produces nonsense. I think Decimal's format parser needs
to detect this as an error.

--

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



[issue6850] decimal.py: format_dict['type'] not initialized

2009-09-07 Thread Eric Smith

Changes by Eric Smith e...@trueblade.com:


--
components: +Library (Lib)
type:  - behavior

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



[issue6829] Frendly error message when inheriting from function

2009-09-07 Thread R. David Murray

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

It is possible that a TypeError could arise during the execution of the
metaclass bases that is not the result of inheriting from something
other than a class/type.  It might, however, be possible to enhnace the
message with the name of the metaclass or first base class...but someone
who knows more about the interpreter internals than I do would have to
be willing to take that on, as it isn't clear to me from reading the
code what the right thing would be to put in the message.

--

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



[issue6850] decimal.py: format_dict

2009-09-07 Thread Stefan Krah

Stefan Krah stefan-use...@bytereef.org added the comment:

Eric Smith rep...@bugs.python.org wrote:
 The test as written will always give an error for None. I think the
 better fix is to change it to be:
 
 if format_dict['type'] is None or format_dict['type'] in 'gG':
 
 That fixes this particular exception, but since the format specifier
 is invalid, it produces nonsense. I think Decimal's format parser needs
 to detect this as an error.

Do you mean that zero significant digits are invalid or that the conversion
specifier cannot be omitted? If I look at the following, the intentions are
not quite clear to me:

'0.1'

'0.1'

Traceback (most recent call last):
  File stdin, line 1, in module
  File /usr/lib/python3.1/decimal.py, line 3611, in __format__
spec = _parse_format_specifier(specifier, _localeconv=_localeconv)
  File /usr/lib/python3.1/decimal.py, line 5595, in _parse_format_specifier
if format_dict['type'] in 'gG' or format_dict['type'] is None:
TypeError: 'in string' requires string as left operand, not NoneType

'0.1'

1. Conversion specifier can be omitted if significant digits != 0.

2. Significant digits can be zero if conversion specifier is present.

3. Exception

4. float() accepts the format.

I would be in favour of making the conversion specifier mandatory - and
perhaps disallow zero significant digits in the case of 'g'.  If the
intention is to mimic the C Standard, zero significant digits should
probably be silently promoted to one.

In any case, float() and Decimal() should preferably behave identically.

P.S.:

Unrelated, but I just see that float() has the wrong default alignment.

--
title: decimal.py: format_dict['type'] not initialized - decimal.py: 
format_dict

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



[issue6795] decimal.py: minor issues usability

2009-09-07 Thread Stefan Krah

Stefan Krah stefan-use...@bytereef.org added the comment:

[...]
 But in Python this error condition *can* 'otherwise be indicated', by 
 raising a suitable Python exception.  So I propose changing the decimal 
 module in 2.7 and 3.2 so that int(Decimal('nan')) and 
 long(Decimal('nan')) raise ValueError.

Excellent analysis, I would be very much in favour of this.

 Issue 3. I can't see how this could cause any real problems, since you'd 
 get an error as soon as you tried to use a bogus context.  Further, an 
 explicit typecheck goes against Python's duck-typing philosophy:  a 
 suitably crazy and misguided person ought to be able to create their own 
 'quacks like a context' class, not necessarily inheriting from 
 Decimal.Context, and pass this into setcontext in place of a real 
 context.  I'm -0 on changing this.

Agreed, it's not really important.

--

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



[issue6850] decimal.py: format_dict

2009-09-07 Thread Eric Smith

Eric Smith e...@trueblade.com added the comment:

The format string is valid. Sorry for the noise. The fill character of
'a' threw me off.

With my suggested change to decimal.py, line 5595, in py3k:
 from decimal import *
 format(Decimal(0.12345), a=-7.0)
'0.1'
 format(0.12345, a=-7.0)
'0.1'
 

If float has the wrong alignment, could you open another issue with an
example?

--

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



[issue6857] float().__format__() default alignment

2009-09-07 Thread Stefan Krah

New submission from Stefan Krah stefan-use...@bytereef.org:

format(float(0.12345), 7.0)  -  '0.1'

The default alignment should be 'left-aligned'.

--
messages: 92370
nosy: skrah
severity: normal
status: open
title: float().__format__() default alignment
versions: Python 2.6, Python 2.7, Python 3.0, Python 3.1

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



[issue6850] decimal.py: format_dict

2009-09-07 Thread Stefan Krah

Stefan Krah stefan-use...@bytereef.org added the comment:

Yes, I'll do that.  -  The tracker has eaten my examples, so hopefully
this goes through:

1. format(Decimal(0.12345), 7.1)   -  '0.1'

2. format(Decimal(0.12345), 7.0g)  -  '0.1'

3. format(Decimal(0.12345), 7.0)
Traceback (most recent call last):
  File stdin, line 1, in module
  File /usr/lib/python3.1/decimal.py, line 3611, in __format__
spec = _parse_format_specifier(specifier, _localeconv=_localeconv)
  File /usr/lib/python3.1/decimal.py, line 5595, in
_parse_format_specifier
if format_dict['type'] in 'gG' or format_dict['type'] is None:
TypeError: 'in string' requires string as left operand, not NoneType

4. format(float(0.12345), 7.0) - '0.1'


But I've opened a separate issue now.

--

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



[issue6857] float().__format__() default alignment

2009-09-07 Thread Stefan Krah

Changes by Stefan Krah stefan-use...@bytereef.org:


--
nosy: +eric.smith

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



[issue6850] decimal.py: format_dict

2009-09-07 Thread Mark Dickinson

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

Thanks for the report.  I've fixed the order of the checks as Eric 
suggested in r74704 (trunk), r74705 (release26-maint), r74706 (py3k) and 
r74707 (release31-maint).

--
resolution:  - fixed
stage:  - committed/rejected
status: open - closed
versions: +Python 3.2 -Python 3.0

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



[issue6856] allow setting uid and gid when creating tar files

2009-09-07 Thread Lars Gustäbel

Lars Gustäbel l...@gustaebel.de added the comment:

I do not quite see the benefit from the set_* methods. Although the
attribute access I proposed may be slightly more complicated (because
you might need the pwd and grp modules) it offers the most freedom.
Let's take the set_uid() method as an example: Its purpose would be to
set both the uid and uname field in the tar header. That is fine as long
as its argument is a uid or username that actually exists. If set_uid()
gets a username that does not exist, what are we going to do? Only set
the uname field and leave the uid field alone or raise an exception? If
the user wants to set a non-existant username on purpose, he cannot use
the set_uid() method. And what are we going to do on Windows? Is there
anything comparable to pwd/grp we could use?
I expect the common use case for these both methods will be to *reset*
the owner information to a default, and this is done by setting uname to
root and uid to 0.

The filter argument is actually a nice idea. I have attached a patch
that outlines my idea of how it is supposed to be. Comments welcome.

--
keywords: +patch
Added file: http://bugs.python.org/file14853/issue6856.diff

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



[issue3597] Allow application developers to select ciphers, and default to strong in ssl lib

2009-09-07 Thread Chris Frantz

Chris Frantz frant...@gmail.com added the comment:

I believe the attached patch provides the desired functionality.

By default, the SSL library selects appropriate ciphers.  If the user
creates an SSLSocket with a cipher_list, the string is passed directly
to SSL_CTX_set_cipher_list().

--
keywords: +patch
nosy: +cfrantz
Added file: http://bugs.python.org/file14854/py-ssl.diff

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



[issue6856] allow setting uid and gid when creating tar files

2009-09-07 Thread Tarek Ziadé

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

 I do not quite see the benefit from the set_* methods. 
 .. some explanations of the underlying complexity...

The only benefit I can see for the set_* method is to hide 
the underlying complexity you've explained.

In Distutils, I'd like to provide a uid and gid option
to the sdist command where the user can set root for instance
and see the lib taking care of creating a tarfile with everything
set to the right value (and ignore the flags under windows etc)

So it seems that working per TarInfo is the wrong approach, 
and a global function to create an archive would be better.


 The filter argument is actually a nice idea. I have attached a 
 patch that outlines my idea of how it is supposed to be. 
 Comments welcome.

The patch looks nice to me

small typo in the doc :

 How create

should be How to create

--

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



[issue6546] [Distutils][PATCH] Add bdist_rpm option to select the name of the resulting package

2009-09-07 Thread OG7

OG7 ony...@users.sourceforge.net added the comment:

In most cases, a distribution named foo becomes and rpm named
python-foo, so it can't be the same name for both.

I'm using bdist_rpm to generate rpms from eggs I didn't write myself, so
an option to give external control works best.

--

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



[issue6831] 2to3 assignment division conversion

2009-09-07 Thread Benjamin Peterson

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

Could you expand a little on what you expect to happen, please?

--
nosy: +benjamin.peterson

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



[issue6857] float().__format__() default alignment

2009-09-07 Thread Mark Dickinson

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

Hmm.  PEP 3101 does indeed say that left-aligned is the default, but it's 
a bit of a strange default for numeric types.  I'd expect integers (at 
least) to be right-aligned by default.

I'd be inclined to say that the current float formatting is correct, and 
that it's the Decimal formatting that's wrong.

--
nosy: +marketdickinson

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



[issue6857] float().__format__() default alignment

2009-09-07 Thread Eric Smith

Eric Smith e...@trueblade.com added the comment:

That is interesting. I'd agree that it's a bug in the PEP. Note that
%-formatting right aligns floats by default:

 '%7.0g' % 0.12345
'0.1'

I'll raise the issue on python-dev.

Eric.

--
assignee:  - eric.smith

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



[issue6795] decimal.py: minor issues usability

2009-09-07 Thread Mark Dickinson

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

Fixed __long__ bug and changed behaviour of int(Decimal('nan')) in r74708 
(trunk), r74709 (py3k).  I still need to fix the __long__ bug in the 
release branches.

--

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



[issue6795] decimal.py: minor issues usability

2009-09-07 Thread Mark Dickinson

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

On second thoughts, I'm going to call this a bug and backport to 2.6 and 
3.1.

--

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



[issue6852] Unicode IO not working in cgi applet

2009-09-07 Thread Mark Dickinson

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

I don't think this is a Python bug;  it has to do with the stdout 
encoding.  When connected to a terminal, sys.stdout.encoding is 
(probably, on Ubuntu) UTF-8, but when you're using this as a cgi script 
it's likely to be defaulting to ascii instead.  Not surprisingly, Python 
won't let you send non-ASCII characters to a stream whose encoding is 
'ascii'.

A workaround is to use sys.stdout.buffer.write (which writes bytes, not 
text), and to manually encode your unicode output in whatever encoding 
you want ('utf-8', I'm assuming):

 sys.stdout.buffer.write('中文\n'.encode('utf8'))
中文
7

--
nosy: +marketdickinson
resolution:  - invalid
status: open - closed

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



[issue6812] Snow Leopard python program fails because _PyType_Modified is missing from python framework

2009-09-07 Thread Seamus O'Shea

Seamus O'Shea os...@uleth.ca added the comment:

(1) When running python (/usr/bin/python) in Terminal I am able to  
import objc successfully. I printed the directory to be sure it's  
complete

Seamuss-MacBook:~ seamus$ /usr/bin/python
Python 2.6.1 (r261:67515, Jul  7 2009, 23:51:51)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type help, copyright, credits or license for more information.
  import objc
  print dir(objc)
['Accessor', 'BadPrototypeError', 'CFToObject', 'Category', 'FSRef',  
'FSSpec', 'IBAction', 'IBOutlet', 'IMP', 'LockError',  
'MAC_OS_X_VERSION_10_1', ..

(2) I restarted Xcode, did a Clean all and rebuilt the app, but I  
got this dump

Running…
2009-09-07 12:25:39.355 First_PyObjC[2796:a0f] mainFilePath is /Users/ 
seamus/Science/xcode exploration/Objc-programs/First_PyObjC/build/ 
Debug/First_PyObjC.app/Contents/Resources/main.py
2009-09-07 12:25:39.360 First_PyObjC[2796:a0f] pythonpath is (
 /Users/seamus/Science/xcode exploration/Objc-programs/ 
First_PyObjC/build/Debug/First_PyObjC.app/Contents/Resources,
 /Users/seamus/Science/xcode exploration/Objc-programs/ 
First_PyObjC/build/Debug/First_PyObjC.app/Contents/Resources/PyObjC,
 /System/Library/Frameworks/Python.framework/Versions/Current/ 
Extras/lib/python/
)
Traceback (most recent call last):
   File /Users/seamus/Science/xcode exploration/Objc-programs/ 
First_PyObjC/build/Debug/First_PyObjC.app/Contents/Resources/main.py,  
line 10, in module
 import objc
   File /System/Library/Frameworks/Python.framework/Versions/Current/ 
Extras/lib/python/PyObjC/objc/__init__.py, line 22, in module
 _update()
   File /System/Library/Frameworks/Python.framework/Versions/Current/ 
Extras/lib/python/PyObjC/objc/__init__.py, line 19, in _update
 import _objc
ImportError: dlopen(/System/Library/Frameworks/Python.framework/ 
Versions/Current/Extras/lib/python/PyObjC/objc/_objc.so, 2): Symbol  
not found: _PyType_Modified
   Referenced from: /System/Library/Frameworks/Python.framework/ 
Versions/Current/Extras/lib/python/PyObjC/objc/_objc.so
   Expected in: flat namespace
  in /System/Library/Frameworks/Python.framework/Versions/Current/ 
Extras/lib/python/PyObjC/objc/_objc.so
2009-09-07 12:25:39.460 First_PyObjC[2796:a0f] *** Terminating app due  
to uncaught exception 'NSInternalInconsistencyException', reason: '/ 
Users/seamus/Science/xcode exploration/Objc-programs/First_PyObjC/ 
main.m:46 main() PyRun_SimpleFile failed with file '/Users/seamus/ 
Science/xcode exploration/Objc-programs/First_PyObjC/build/Debug/ 
First_PyObjC.app/Contents/Resources/main.py'.  See console for errors.'
*** Call stack at first throw:
(
0   CoreFoundation  0x90a1858a __raiseError + 410
1   libobjc.A.dylib 0x9309cf49  
objc_exception_throw + 56
2   CoreFoundation  0x90a182b8 +[NSException  
raise:format:arguments:] + 136
3   CoreFoundation  0x90a1822a +[NSException  
raise:format:] + 58
4   First_PyObjC0x2bc2 main + 1084
5   First_PyObjC0x275a start + 54
)
sharedlibrary apply-load-rules all

It seems identical to the original problem.

(3) I wondered if there is something the PATH specifications that  
caused things to be misdirected during the build, so I printed  
sys.path out from within python.

/Library/Python/2.6/site-packages/pyobjc-2.2b2-py2.6.egg
/Library/Python/2.6/site-packages/ 
pyobjc_framework_XgridFoundation-2.2b2-py2.6.egg
/Library/Python/2.6/site-packages/pyobjc_framework_WebKit-2.2b2- 
py2.6.egg
/Library/Python/2.6/site-packages/ 
pyobjc_framework_SystemConfiguration-2.2b2-py2.6-macosx-10.6- 
universal.egg
/Library/Python/2.6/site-packages/pyobjc_framework_SyncServices-2.2b2- 
py2.6.egg
/Library/Python/2.6/site-packages/pyobjc_framework_SearchKit-2.2b2- 
py2.6.egg
/Library/Python/2.6/site-packages/pyobjc_framework_ScreenSaver-2.2b2- 
py2.6-macosx-10.6-universal.egg
/Library/Frameworks/Python.framework/Versions/Current/bin
/Library/Frameworks/Python.framework/Versions/2.6/bin
/Library/Frameworks/Python.framework/Versions/3.0/bin
/Library/Frameworks/Python.framework/Versions/2.4/bin
/opt/local/bin
/opt/local/sbin
/sw/bin
/sw/sbin
/usr/bin
/bin
/usr/sbin
/sbin
/usr/local/bin
/usr/X11/bin
/usr/X11R6/bin
/System/Library/Frameworks/Python.framework/Versions/2.6/lib/ 
python26.zip
/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6
/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/ 
plat-darwin
/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/ 
plat-mac
/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/ 
plat-mac/lib-scriptpackages
/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/ 
python
/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/ 
lib-tk
/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/ 

[issue6844] BaseException DeprecationError raises inappropriately

2009-09-07 Thread Brett Cannon

Changes by Brett Cannon br...@python.org:


--
nosy: +brett.cannon

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



[issue6844] BaseException DeprecationError raises inappropriately

2009-09-07 Thread Brett Cannon

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

If someone can come up w/ a patch to make this work for all of you I would 
be happy to review it and backport to 2.6. But the deprecation warning 
cannot go away as it's needed for anyone who came to rely on the feature 
in their 2.5 code from Python.

--

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



[issue6854] UnicodeDecodeError when retrieving binary data from cgi.FieldStorage()

2009-09-07 Thread loveminix

loveminix lovemi...@yahoo.com.cn added the comment:

Here is the trackback (the uploaded file is a PDF file):

UnicodeDecodeError Python 3.1.1: /home/chu7/software/bin/python3
Mon Sep 7 12:31:07 2009 

A problem occurred in a Python script. Here is the sequence of function 
calls leading up to the error, in the order they occurred.

 /home/chu7/web/cgi-bin/upload.py in () 
 35 );
 
 36 elif pathInfo == /upload:
 
=   37 fieldStorage = cgi.FieldStorage();
 
 38 fileItem = fieldStorage[file];
 
 39 if fileItem.filename != :
 
fieldStorage undefined, cgi = module 'cgi' 
from '/home/chu7/software/lib/python3.1/cgi.py', cgi.FieldStorage = 
class 'cgi.FieldStorage' 
 /home/chu7/software/lib/python3.1/cgi.py in __init__(self=FieldStorage
(None, None, []), fp=None, headers={'content-length': '76784', 'content-
type': 'multipart/form-data; boundary=---
7d95563062a'}, outerboundary='', environ=os._Environ object at 
0x8ee040c, keep_blank_values=0, strict_parsing=0) 
489 self.read_urlencoded()
 
490 elif ctype[:10] == 'multipart/':
 
=  491 self.read_multi(environ, keep_blank_values, 
strict_parsing)
 
492 else:
 
493 self.read_single()
 
self = FieldStorage(None, None, []), self.read_multi = bound method 
FieldStorage.read_multi of FieldStorage(None, None, []), environ = 
os._Environ object at 0x8ee040c, keep_blank_values = 0, 
strict_parsing = 0 
 /home/chu7/software/lib/python3.1/cgi.py in read_multi
(self=FieldStorage(None, None, []), environ=os._Environ object at 
0x8ee040c, keep_blank_values=0, strict_parsing=0) 
609 # Create bogus content-type header for proper multipart 
parsing
 
610 parser.feed('Content-Type: %s; boundary=%s\r\n\r\n' % 
(self.type, ib))
 
=  611 parser.feed(self.fp.read())
 
612 full_msg = parser.close()
 
613 # Get subparts
 
parser = email.feedparser.FeedParser object at 0x910daac, parser.feed 
= bound method FeedParser.feed of email.feedparser.FeedParser object 
at 0x910daac, self = FieldStorage(None, None, []), self.fp = 
_io.TextIOWrapper name='stdin' encoding='ANSI_X3.4-1968', 
self.fp.read = built-in method read of _io.TextIOWrapper object at 
0x8ee833c 
 /home/chu7/software/lib/python3.1/encodings/ascii.py in decode
(self=encodings.ascii.IncrementalDecoder object at 0x8f6b74c, 
input=b'-7d95563062a\r\nCo...\n-
7d95563062a--\r\n', final=True) 
 24 class IncrementalDecoder(codecs.IncrementalDecoder):
 
 25 def decode(self, input, final=False):
 
=   26 return codecs.ascii_decode(input, self.errors)[0]
 
 27 
 
 28 class StreamWriter(Codec,codecs.StreamWriter):
 
global codecs = module 'codecs' 
from '/home/chu7/software/lib/python3.1/codecs.py', 
codecs.ascii_decode = built-in function ascii_decode, input = b'--
---7d95563062a\r\nCo...\n---
--7d95563062a--\r\n', self = encodings.ascii.IncrementalDecoder object 
at 0x8f6b74c, self.errors = 'strict' 

UnicodeDecodeError: 'ascii' codec can't decode byte 0xc7 in position 
158: ordinal not in range(128) 
  args = ('ascii', b'-
7d95563062a\r\nCo...\n-7d95563062a--\r\n', 
158, 159, 'ordinal not in range(128)') 
  encoding = 'ascii' 
  end = 159 
  object = b'-7d95563062a\r\nCo...\n
-7d95563062a--\r\n' 
  reason = 'ordinal not in range(128)' 
  start = 158 
  with_traceback = built-in method with_traceback of 
UnicodeDecodeError object at 0x905bd2c

--

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



[issue6844] BaseException DeprecationError raises inappropriately

2009-09-07 Thread Jean-Paul Calderone

Jean-Paul Calderone exar...@divmod.com added the comment:

After looking at this more carefully, I find myself wondering what
exactly is being deprecated at all.

Brett said:
 it's needed for anyone who came to rely on the feature  in their 2.5
code from Python.

Can someone help me understand what the feature is?

--

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



[issue6844] BaseException DeprecationError raises inappropriately

2009-09-07 Thread Brett Cannon

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

On Mon, Sep 7, 2009 at 12:35, Jean-Paul Calderonerep...@bugs.python.org wrote:

 Jean-Paul Calderone exar...@divmod.com added the comment:

 After looking at this more carefully, I find myself wondering what
 exactly is being deprecated at all.

The message attribute as introduced in Python 2.5 based on
http://www.python.org/dev/peps/pep-0348/ .


 Brett said:
 it's needed for anyone who came to rely on the feature  in their 2.5
 code from Python.

 Can someone help me understand what the feature is?

 --

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


--

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



[issue6844] BaseException DeprecationError raises inappropriately

2009-09-07 Thread Jean-Paul Calderone

Jean-Paul Calderone exar...@divmod.com added the comment:

Hm.  That PEP is marked as rejected, though.  I guess it was partially
implemented, those changes included in the Python 2.5 release, and then
it was decided that it was a bad idea, rejected, and the changes undone
for 3.x (what about 2.7)?  Or did something else happen?

I did a simple search on the PEP for the word message, but the word
doesn't appear anywhere in the text!  So I guess it's a feature that's
implied by the PEP, but I would appreciate some help figuring out the
implication.

Here's what I do see:

  - If one argument is passed to BaseException.__init__, then the value
is used as the value for the message attribute.
  - If zero or more than one arguments are passed, then the attribute is
given the empty string for a value.
  - If zero or one arguments are passed, the message attribute is used
as the string representation of the exception instance.

The deprecation warning emitted in 2.6 doesn't tell me which of these
things is deprecated, though.  Is there something more to the message
attribute, or are one or more of the above list things which should no
longer be relied on?

--

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



[issue6719] pdb messes up when debugging an non-ascii program

2009-09-07 Thread Ilya Sandler

Ilya Sandler ilya.sand...@gmail.com added the comment:

Here is what's happening: when pdb starts up it sets tracing and several
trace events happen before the pdb reaches the first line of the
debugged program. So, pdb has some logic to ignore certain events on
startup (_wait_for_main_pyfile).

On normal startup only call and lineevents need to be ignored and so
that's what pdb did. However, the coding directive causes some
additional code to get executed and results in return and exception
events.

I am attaching the patch to properly ignore irrelevant return and
exceptionevents on startup. The patch fixes both the startup and the
exit problems.

--
nosy: +isandler
Added file: http://bugs.python.org/file14856/pdb-nonascii.patch.v1

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



[issue6844] BaseException DeprecationError raises inappropriately

2009-09-07 Thread Brett Cannon

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

On Mon, Sep 7, 2009 at 13:01, Jean-Paul Calderonerep...@bugs.python.org wrote:

 Jean-Paul Calderone exar...@divmod.com added the comment:

 Hm.  That PEP is marked as rejected, though.  I guess it was partially
 implemented, those changes included in the Python 2.5 release, and then
 it was decided that it was a bad idea, rejected, and the changes undone
 for 3.x (what about 2.7)?  Or did something else happen?


I screwed up and pasted in the URL for the wrong PEP. Sorry about
that. Written a few too many PEPs involving exceptions. The correct
one is http://www.python.org/dev/peps/pep-0352/ .

 I did a simple search on the PEP for the word message, but the word
 doesn't appear anywhere in the text!  So I guess it's a feature that's
 implied by the PEP, but I would appreciate some help figuring out the
 implication.

 Here's what I do see:

  - If one argument is passed to BaseException.__init__, then the value
 is used as the value for the message attribute.
  - If zero or more than one arguments are passed, then the attribute is
 given the empty string for a value.
  - If zero or one arguments are passed, the message attribute is used
 as the string representation of the exception instance.

 The deprecation warning emitted in 2.6 doesn't tell me which of these
 things is deprecated, though.  Is there something more to the message
 attribute, or are one or more of the above list things which should no
 longer be relied on?

The 'message' attribute itself is deprecated as it didn't exist prior
to being introduced in 2.5. The original idea was to not let
BaseException take multiple arguments to its constructor and have
message be what replaced 'args'. But when I tried to do that at PyCon
2007 the pain was too great so it was decided a more long-term
strategy to making BaseException accept a single argument was needed.
So the 'message' attribute that got added to BaseException was
retracted.

--

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



[issue6844] BaseException DeprecationError raises inappropriately

2009-09-07 Thread Georg Brandl

Changes by Georg Brandl ge...@python.org:


--
nosy: +georg.brandl

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



[issue6849] Tutorial changes

2009-09-07 Thread Georg Brandl

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

I've already renamed the message attribute in the 2.x tutorial in trunk.

--
nosy: +georg.brandl

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



[issue6844] BaseException DeprecationError raises inappropriately

2009-09-07 Thread Alan Isaac

Alan Isaac alan.is...@gmail.com added the comment:

 The 'message' attribute itself is deprecated
 as it didn't exist prior to being introduced in 2.5.

That seems to me to be the wrong way to phrase it, and indeed that kind
of phrasing implies the current bug.  For example, it leads to the
incorrect statement that The 'message' attribute ... didn't exist prior
to being introduced in 2.5.  But looking at the docutils and Twisted
code bases, to take two examples, tells us that it **did** exist: a slew
of instances had this attribute.  The correct statement, that
BaseException did not initialize a `message` attribute, is an entirely
different matter.

Imo, deprecating setting and accessing an **instance attribute** is just
flat out wrong and grossly violates inheritability promises.  As we have
seen.

I think (?) that what was desired to be deprecated is the combination of

- setting a message attribute via BaseException.__init__, AND
- accessing an instances message attribute that was set *this way*

But in fact the setting cannot really be deprecated because it is
implicit: it is something currently done by BaseException, not by the
user.  So I think (?) the best we can do is look at whether the user
initializes BaseException (**not** the derived classes) with a single
argument, which is a nonempty string, and then tries to access this as a
`message` attribute.  Which is why I originally proposed setting a flag
when BaseException.__init__ is called and conditioning the deprecation
warning on this flag.  (E.g., the flag could be set if and only if the
user calls BaseException.__init__(instance, string).)

In any case, I think Jean-Paul is asking exactly the right question
(i.e., just what exactly is being deprecated?).  A more careful answer
will hopefully lead to less buggy DeprecationWarning.

--

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



[issue6844] BaseException DeprecationError raises inappropriately

2009-09-07 Thread Jean-Paul Calderone

Jean-Paul Calderone exar...@divmod.com added the comment:

Alright.  So in Python 3.1, this is the behavior:

 BaseException().message
(attribute error)
 BaseException(foo).message
(attribute error)
 BaseException(foo, bar).message
(attribute error)
 x = BaseException()
 x.message = foo
 x.message
'foo'
 x = BaseException(foo)
 x.message = bar
 x.message
'bar'
 x = BaseException(foo)
 x.message = bar
 x.message
'bar'

So I propose the following as the new behavior for 2.x:

 BaseException().message
(deprecation warning)
''
 BaseException(foo).message
(deprecation warning)
'foo'
 BaseException(foo, bar).message
(deprecation warning)
''
 x = BaseException()
 x.message = foo
 x.message
'foo'
 x = BaseException(foo)
 x.message = bar
 x.message
'bar'
 x = BaseException(foo, bar)
 x.message = baz
 x.message
'baz'

Summarized: emit a warning when the same code in Python 3.1 would raise
an exception; let all other cases pass.

There is one other case that I would think about changing, but I don't
see how it can, given the behavior that is implemented in 3.1 already. 
BaseException(a message) is a Python 2.5-supported way of creating an
exception with a value for its message attribute.  This no longer works
in Python 3.1.  So, arguably, this is another case where a deprecation
warning should be emitted.  However, this would be pretty obnoxious,
since BaseException(a message) in Python 2.4 (by way of Exception(a
message), of course, since Python 2.4 did not have BaseException) was
perfectly valid.  It seems like BaseException(string) should have been
deprecated and BaseException(tuple) been made the preferred API.  That's
for another time, though.

How does the above proposed deprecation behavior sound?

--

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



[issue6844] BaseException DeprecationError raises inappropriately

2009-09-07 Thread Brett Cannon

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

On Mon, Sep 7, 2009 at 14:57, Jean-Paul Calderonerep...@bugs.python.org wrote:

 Jean-Paul Calderone exar...@divmod.com added the comment:

 Alright.  So in Python 3.1, this is the behavior:

 BaseException().message
 (attribute error)
 BaseException(foo).message
 (attribute error)
 BaseException(foo, bar).message
 (attribute error)
 x = BaseException()
 x.message = foo
 x.message
 'foo'
 x = BaseException(foo)
 x.message = bar
 x.message
 'bar'
 x = BaseException(foo)
 x.message = bar
 x.message
 'bar'

 So I propose the following as the new behavior for 2.x:

 BaseException().message
 (deprecation warning)
 ''
 BaseException(foo).message
 (deprecation warning)
 'foo'
 BaseException(foo, bar).message
 (deprecation warning)
 ''
 x = BaseException()
 x.message = foo
 x.message
 'foo'
 x = BaseException(foo)
 x.message = bar
 x.message
 'bar'
 x = BaseException(foo, bar)
 x.message = baz
 x.message
 'baz'

 Summarized: emit a warning when the same code in Python 3.1 would raise
 an exception; let all other cases pass.

 There is one other case that I would think about changing, but I don't
 see how it can, given the behavior that is implemented in 3.1 already.
 BaseException(a message) is a Python 2.5-supported way of creating an
 exception with a value for its message attribute.  This no longer works
 in Python 3.1.  So, arguably, this is another case where a deprecation
 warning should be emitted.  However, this would be pretty obnoxious,
 since BaseException(a message) in Python 2.4 (by way of Exception(a
 message), of course, since Python 2.4 did not have BaseException) was
 perfectly valid.  It seems like BaseException(string) should have been
 deprecated and BaseException(tuple) been made the preferred API.  That's
 for another time, though.

 How does the above proposed deprecation behavior sound?

Works for me. If someone can create a patch for that I will review it
and apply it to 2.6 (the warning will be removed from 2.7 and so will
the attribute).

--

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



[issue6713] Integer Long types: Performance improvement of 1.6x to 2x for base 10 conversions

2009-09-07 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@haypocalc.com:


Added file: http://bugs.python.org/file14857/bench_long_format.py

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



[issue6858] This is a python file, apply syntax highlighting

2009-09-07 Thread gert cuykens

New submission from gert cuykens gert.cuyk...@gmail.com:

http://groups.google.be/group/comp.lang.python/browse_thread/thread/252fa1ccd0251977#

Menu option please, so I can highlight .wsgi .txt .xml files with python
code in it, does not matter if non python code gets wrongly highlighted too.

--
components: IDLE
messages: 92395
nosy: gert
severity: normal
status: open
title: This is a python file, apply syntax highlighting
type: feature request
versions: Python 3.2

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



[issue6811] add a filename argument to marshal.load*

2009-09-07 Thread Frank Wierzbicki

Changes by Frank Wierzbicki fwierzbi...@gmail.com:


--
nosy: +fwierzbicki

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



[issue6713] Integer Long types: Performance improvement of 1.6x to 2x for base 10 conversions

2009-09-07 Thread STINNER Victor

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

Would it be possible to share some constant data between intobject.c and
longobject.c? There is already static const unsigned char BitLengthTable[32]
(32 bytes), and the patch introduces static const char _decimal_digit_table[]
(100 bytes).

--

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



[issue5705] os.getpwent returns unsigned 32bit value, os.setuid refuses it

2009-09-07 Thread STINNER Victor

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

@boya: It's maybe better to open a new issue for posix_lchown.

--
nosy: +haypo

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



[issue5080] PyArg_Parse* should raise TypeError for float parsed with integer format

2009-09-07 Thread STINNER Victor

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

+10. It would fix the os.urandom(1.2) bug. On Linux, os.urandom() displays
the following warnings and then go into an unlimited loop...

/usr/lib/python2.5/os.py:734: DeprecationWarning: integer argument expected,
got float
  bytes += read(_urandomfd, n - len(bytes))

read(1.2 - 1) ~ read(0.2) ~ read(0)...

Tolerate float as integers introduces subtle bugs like byte/unicode bugs...

--
nosy: +haypo

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



[issue6817] char buffer in function posix_getcwdu should not be fix length

2009-09-07 Thread STINNER Victor

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

Your patch is mixing tabs and spaces :-/

A free(tmpbuf); is missing in if (res == NULL) return posix_error();.

--
nosy: +haypo

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



[issue6713] Integer Long types: Performance improvement of 1.6x to 2x for base 10 conversions

2009-09-07 Thread STINNER Victor

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

By benchmark should be reproduced on a 64 bits CPU with 2^15 and 2^30
bases for the long type.

--

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



[issue6713] Integer Long types: Performance improvement of 1.6x to 2x for base 10 conversions

2009-09-07 Thread STINNER Victor

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

I wrote a dummy script to generate a big number (2568 decimal digits, 8530
bits) and then benchmark str(n). Results on my computer:

Python 2.7a0, Pentium4 @ 3.0 GHz (32 bits), long base=2^15

Smallest value of 5 runs:

  original = 5046.8 ms
  patched = 2032.4 ms

For huge numbers, the patch is much (60%) faster.

--

Small integer (type=int) : n=factorial(10) (22 bits, 7 decimal digits) with
10 loops.

   original = 861.7 ms
   patched = 639.2 ms

It's also faster (26%).

--

And with n=1 (1 bit, 1 decimal digit), type=int :

  original = 606.7
  patched = 561.6

It's a little bit faster (7%) with the patch.

I don't see any performance regression, only good improvements: 60% faster
to huge numbers.

--
nosy: +haypo

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



[issue6817] char buffer in function posix_getcwdu should not be fix length

2009-09-07 Thread STINNER Victor

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

The #ifdef MS_WINDOWS is not a the right place in posix_getcwdu(): buf and
res are declared but unused, and there is dead code on Windows.

The patch only fixes the UNIX implementation, not the Windows
implementation.

In the py3k branch, bytes and unicode versions of getcwd are factorized in a
common function. The same should be done in python trunk.

--

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



[issue6816] Provide CPython command line functionality via runpy module

2009-09-07 Thread Frank Wierzbicki

Changes by Frank Wierzbicki fwierzbi...@gmail.com:


--
nosy: +fwierzbicki

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



[issue6859] stdint (eg. uint64_t) for ctypes

2009-09-07 Thread STINNER Victor

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

It would be nice to have (at least) some stdint.h types in ctypes:
- uint8_t, int8_t
- int16_t, uint16_t
- int32_t, uint32_t
- uint64_t, int64_t

Attached fle is a Python implementation of that.

stdint.h contains much more types, but I don't think that
(u)int_leastXX_t/(u)int_fastXX_t are used in public structures/functions.

Other interesting types/constants from stdint.h:
- intptr_t / uintptr_t
- (U)INT(8|16|32|64)_(MIN|MAX)
- PTRDIFF_MAX

--
components: Extension Modules
files: stdint.py
messages: 92403
nosy: haypo
severity: normal
status: open
title: stdint (eg. uint64_t) for ctypes
type: feature request
Added file: http://bugs.python.org/file14858/stdint.py

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



[issue6859] stdint (eg. uint64_t) for ctypes

2009-09-07 Thread STINNER Victor

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

Oooh. I just see that ctypes already includes ctypes.c_(u)int(8|16|32|64)
types... Sorry for the noise :-)

--
status: open - closed

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



[issue6859] stdint (eg. uint64_t) for ctypes

2009-09-07 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@haypocalc.com:


--
resolution:  - invalid

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



[issue6858] This is a python file, apply syntax highlighting

2009-09-07 Thread Chris Rebert

Changes by Chris Rebert pyb...@rebertia.com:


--
nosy: +cvrebert

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



[issue6858] This is a python file, apply syntax highlighting

2009-09-07 Thread Gabriel Genellina

Changes by Gabriel Genellina gagsl-...@yahoo.com.ar:


--
nosy: +gagenellina

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



[issue6860] Inconsistent naming of custom command in setup.py help output

2009-09-07 Thread Patrick Näf

New submission from Patrick Näf herzb...@herzbube.ch:

The attached setup.py file defines a custom command named test, which
is implemented in a class named TestClass. Try to run both of the
following:

1) ./setup.py test -h
2) ./setup.py --help-commands

In case 1, Distutils will use the class name to print the help output.
In case 2, it will use the command name. This behaviour is inconsistent.
As a developer, if I want to get the output right in both cases, I am
forced to use the same name both for the command class and the command
name (a string in a dictionary).

I propose that Distutils always use the command name. Besides fixing the
inconsistency, this solution gives the freedom to choose class names
back to the developer.

I have tested this behaviour on Mac OS X 10.5, both with the
system-provided Python 2.5 and custom-installed versions of Python 2.6
and 3.1.

--
assignee: tarek
components: Distutils
files: setup.py
messages: 92405
nosy: herzbube, tarek
severity: normal
status: open
title: Inconsistent naming of custom command in setup.py help output
type: behavior
versions: Python 2.5, Python 2.6, Python 3.1
Added file: http://bugs.python.org/file14859/setup.py

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



[issue6861] bytearray.__new__ doesn't subclass

2009-09-07 Thread kai zhu

New submission from kai zhu kaizhu...@gmail.com:

# a00.py

parent = bytearray # fails
# parent = bytes   # works
# parent = str # works

class Foo(parent):

  def __new__(klass, x): return parent.__new__(klass, x)

Foo(x = None)



$ python3.1 -c import a00
Traceback (most recent call last):
  File string, line 1, in module
  File a00.py, line 11, in module
Foo(x = None)
TypeError: 'x' is an invalid keyword argument for this function
lethe 3 /tmp/kaizhu/Python-3.1.1:

--
components: Interpreter Core, Library (Lib)
messages: 92406
nosy: kaizhu
severity: normal
status: open
title: bytearray.__new__ doesn't subclass
type: behavior
versions: Python 3.1

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



[issue6861] bytearray.__new__ doesn't subclass

2009-09-07 Thread Brandon Height

Brandon Height bmhei...@gmail.com added the comment:

This behavior is also found inside of version 2.6.2

--
nosy: +lasko

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



[issue6861] bytearray.__new__ doesn't subclass

2009-09-07 Thread Benjamin Peterson

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

That's because bytearray is mutable, so it uses __init__ instead of __new__.

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

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



[issue2320] Race condition in subprocess using stdin

2009-09-07 Thread Chris Miles

Changes by Chris Miles miles.ch...@gmail.com:


--
nosy: +chrismiles

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