[issue8298] in what way we have to save tha module?

2010-04-03 Thread Eric Smith

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

Hi.

Please don't use the bug tracker to ask Python questions. You've already been 
asked twice to refer to 
http://www.python.org/about/help/#got-a-python-problem-or-question . Please 
read and follow those instructions. Your questions have not been about bugs in 
Python, so this is not the correct place to ask them.

--
nosy: +eric.smith
resolution:  - invalid
status: open - closed

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



[issue8304] strftime and Unicode characters

2010-04-03 Thread Eric Smith

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


--
nosy: +eric.smith

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



[issue8309] Sin(x) is Wrong

2010-04-03 Thread Eric Smith

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


--
nosy: +eric.smith
type: performance - behavior

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



[issue7994] object.__format__ should reject format strings

2010-04-02 Thread Eric Smith

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

Committed in trunk in r79596. I'll leave this open until I port to py3k, check 
the old tests for this usage, and create the issue to make it a 
DeprecationWarning.

--
stage: patch review - committed/rejected

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



[issue8293] HTTPSConnection.close() does not immediately close the connection.

2010-04-02 Thread Eric Smith

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


--
nosy: +eric.smith

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



[issue8278] os.utime doesn't allow a atime (Last Access) which is 27 years in the future.

2010-04-01 Thread Eric Smith

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


--
nosy: +eric.smith

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



[issue8272] Odd exception messages when using cStringIO.StringIO instances as callables.

2010-03-31 Thread Eric Smith

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

cStringIO.StringIO is a factory function, so those messages are correct. This 
is mentioned in http://docs.python.org/library/stringio.html#module-cStringIO .

--
nosy: +eric.smith
resolution:  - rejected
status: open - closed

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



[issue7994] object.__format__ should reject format strings

2010-03-30 Thread Eric Smith

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

Meador: Your patch (-3) looks identical to mine (-2), unless I'm making some 
mistake. Could you check? I'd like to get this applied in the next few days, 
before 2.7b1.

Thanks!

--

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



[issue1578269] Add os.symlink() and os.path.islink() support for Windows

2010-03-30 Thread Eric Smith

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

I had some style issues at one point, but I haven't looked at it closely 
recently. I won't have time to look at this before next week, so proceed 
without me.

--

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



[issue8252] add a metadata section in setup.cfg

2010-03-28 Thread Eric Smith

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


--
nosy: +eric.smith

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



[issue8257] Decimal constructor to accept float

2010-03-28 Thread Eric Smith

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


--
nosy: +eric.smith

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



[issue8214] Add exception logging function to syslog module

2010-03-25 Thread Eric Smith

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

Good point. So that makes the implementation more like:

import traceback
import syslog
import sys

def syslog_exception(etype, evalue, etb):
# The result of traceback.format_exception might contain
# embedded newlines, so we have the nested loops.
for line in traceback.format_exception(etype, evalue, etb):
for line in line.rstrip().split('\n'):
syslog.syslog(line)

def logexceptions(chain=True):
# Should we chain to the existing sys.excepthook?
current_hook = sys.excepthook if chain else None

def hook(etype, evalue, etb):
if current_hook:
current_hook(etype, evalue, etb)
syslog_exception(etype, evalue, etb)
sys.excepthook = hook

We could then make syslog_exception take a tuple instead of the 3 values. I'm 
not sure which is more convenient, or more widely used in other APIs.

Once it's moved into syslog, maybe syslog_exception named syslog.log_exception.

--

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



[issue8214] Add exception logging function to syslog module

2010-03-25 Thread Eric Smith

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

 Once it's moved into syslog, maybe syslog_exception named 
 syslog.log_exception.

That's should be named, of course. Although on second thought maybe 
syslog.syslog_exception really is the right name, to mirror syslog.syslog.

 In that case, how would be called the second function? Can write a patch with 
 an unit test?

I'm not sure which second function you mean.

As far as the implementation, Sean's working on it, although I'm willing to 
help.

--

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



[issue8214] Add exception logging function to syslog module

2010-03-25 Thread Eric Smith

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

Ah, I see. Yes, logexceptions needs a better name. Maybe 
enable_exception_logging.

--

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



[issue8214] Add exception logging function to syslog module

2010-03-25 Thread Eric Smith

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

Here's a version that would be more analogous to what the C implementation 
would look like. It uses a class instead of a closure to capture the chain 
value. The 2 exposed functions syslog_exception and enable_exception_logging 
are the new APIs in this proposal, which would be written in C as part of the 
syslog module. The class is a hidden implementation detail.


import traceback
import syslog
import sys

def syslog_exception(etype, evalue, etb):
# The result of traceback.format_exception might contain
# embedded newlines, so we have the nested loops.
for line in traceback.format_exception(etype, evalue, etb):
for line in line.rstrip().split('\n'):
syslog.syslog(line)

class _Hook(object):
def __init__(self, chain):
# Should we chain to the existing sys.excepthook?
self._current_hook = sys.excepthook if chain else None

def _hook(self, etype, evalue, etb):
if self._current_hook:
self._current_hook(etype, evalue, etb)
syslog_exception(etype, evalue, etb)

def enable_exception_logging(chain=True):
sys.excepthook = _Hook(chain)._hook

--

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



[issue8224] subprocess.Popen raises WindowsError if there is a dot in program name

2010-03-25 Thread Eric Smith

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

I agree with David that this is a Windows problem. I copied xcopy.exe into a 
local directory as xcopy.exe and xcopy.a.exe. When running this VBScript, the 
first line runs, the second gives me an error 0x8007002, The system could not 
find the file specified.

WScript.CreateObject(WScript.Shell).Run xcopy, 1, true
WScript.CreateObject(WScript.Shell).Run xcopy.a, 1, true

I only tested on XP.

--
nosy: +eric.smith
resolution:  - invalid
stage: test needed - committed/rejected
status: open - closed

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



[issue6081] str.format_from_mapping()

2010-03-25 Thread Eric Smith

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

It occurs to me that Raymond's use case could be satisfied using existing 
Python, by slightly changing the format string. After all, str.format() 
supports mapping lookup already:

$ ./python.exe
Python 2.6.5+ (release26-maint:79421, Mar 25 2010, 08:51:39)
[GCC 4.2.1 (Apple Inc. build 5646) (dot 1)] on darwin
Type help, copyright, credits or license for more information.
 class Default(dict):
...  def __missing__(self, key):
...   return key
...
 s = '{m[name]} was born in {m[country]}'
 s.format(m=Default(name='Guido'))
'Guido was born in country'


Considering that, maybe the best thing is to do nothing. Or maybe update the 
documentation with this example.

Plus, you could mix and match this with *args as you'd like.

--

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



[issue8219] Facility and priority values/constants not documented for SysLogHandler

2010-03-24 Thread Eric Smith

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


--
nosy: +eric.smith

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



[issue8219] Facility and priority values/constants not documented for SysLogHandler

2010-03-24 Thread Eric Smith

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


--
nosy: +vinay.sajip
priority:  - normal
versions: +Python 2.6, Python 2.7, Python 3.1, Python 3.2

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



[issue8219] Facility and priority values/constants not documented for SysLogHandler

2010-03-24 Thread Eric Smith

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

It still doesn't say that the LOG_ constants are defined on SysLogHandler. Or 
is the intention that the user just use the strings?

--

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



[issue8219] Facility and priority values/constants not documented for SysLogHandler

2010-03-24 Thread Eric Smith

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

 Vinay Sajip vinay_sa...@yahoo.co.uk added the comment:
 Whoops, now fixed (I think).

Looks good. Thanks!

--

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



[issue8214] Add exception logging function to syslog module

2010-03-23 Thread Eric Smith

New submission from Eric Smith e...@trueblade.com:

Sean Reifschneider proposed [1] adding the ability to log an exception using 
the syslog module.

My proposed implementation is along the lines of:

def logexceptions(chain=True):
import sys
import traceback
import syslog

# Should we chain to the existing sys.excepthook?
current_hook = sys.excepthook if chain else None

def syslog_exception(etype, evalue, etb):
if current_hook:
current_hook(etype, evalue, etb)
# The result of traceback.format_exception might contain
# embedded newlines, so we have the nested loops.
for line in traceback.format_exception(etype, evalue, etb):
for line in line.rstrip().split('\n'):
syslog.syslog(line)
sys.excepthook = syslog_exception

Although it would need to be written in C to work in the existing syslog 
module, and of course it would call syslog.syslog directly.


[1] http://mail.python.org/pipermail/python-ideas/2010-March/006927.html

--
messages: 101605
nosy: eric.smith, jafo
priority: normal
severity: normal
stage: needs patch
status: open
title: Add exception logging function to syslog module
type: feature request
versions: Python 2.7, Python 3.2

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



[issue8214] Add exception logging function to syslog module

2010-03-23 Thread Eric Smith

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


--
components: +Extension Modules

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



[issue6081] str.format_from_mapping()

2010-03-23 Thread Eric Smith

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

I'm not sure I'm wild about the *args parameter. Calling Fred the 0-th 
parameter here seems non-intuitive:

My name is {0}.format_using_mapping({}, 'Fred')

If you're going to have *args, why not **kwargs and then merge/update the 
dicts? I'm being facetious, but I think even having *args is feature creep.

I think it's time to ask about this on python-dev. I'd vote for not using 
*args. It can always be added in the future if it's seen as a hole in the API.

--
stage: test needed - patch review

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



[issue8188] Unified hash for numeric types.

2010-03-20 Thread Eric Smith

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


--
nosy: +eric.smith

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



[issue6081] str.format_from_mapping()

2010-03-19 Thread Eric Smith

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

I believe this patch fixes the issue. Tests and documentation are still needed, 
of course.

--
Added file: http://bugs.python.org/file16585/issue6081.diff

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



[issue6081] str.format_from_mapping()

2010-03-19 Thread Eric Smith

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

Added a comment to explain the change.

--
Added file: http://bugs.python.org/file16586/issue6081.diff

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



[issue6081] str.format_from_mapping()

2010-03-19 Thread Eric Smith

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


Removed file: http://bugs.python.org/file16585/issue6081.diff

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



[issue6081] str.format_from_mapping()

2010-03-19 Thread Eric Smith

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

http://docs.python.org/library/stdtypes.html#str.format, for starters. This is 
in Doc/library/stdtypes.rst.

For tests, probably in Lib/test/test_unicode.py.

I'm not sure if we should add this to 2.7 (or even 3.2, for that matter), but 
if so, we should start by patching trunk and then porting to py3k.

--

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



[issue6081] str.format_from_mapping()

2010-03-18 Thread Eric Smith

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

I agree with David.

Although it's not clear to my why the code doesn't just work with the addition 
of do_string_format_using_mapping and without the other code. It's possible the 
existing code is too dict-specific and should be calling a more generic 
PyObject interface, like PyMapping_GetItemString instead of PyDict_GetItem.

--

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



[issue8155] Incompatible change to test.test_support.check_warnings behaviour

2010-03-16 Thread Eric Smith

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


--
nosy: +eric.smith

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



[issue6081] str.format_from_mapping()

2010-03-15 Thread Eric Smith

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


--
assignee:  - eric.smith

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



[issue8128] String interpolation with unicode subclass fails to call __str__

2010-03-13 Thread Eric Smith

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


--
nosy: +eric.smith

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



[issue8134] collections.defaultdict gives KeyError with format()

2010-03-13 Thread Eric Smith

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

str.format() does not take a mapping object. You want:

 {0[foo]}.format(d)
'0'

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

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



[issue8134] collections.defaultdict gives KeyError with format()

2010-03-13 Thread Eric Smith

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

See also issue 6081.

--

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



[issue7300] Unicode arguments in str.format()

2010-03-11 Thread Eric Smith

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

I'm not sure I'm wild about doing the work twice, once as string and once as 
unicode if need be. But I'll consider it, especially since this is only a 2.7 
issue.

There could be side effects of evaluating the replacement strings, but I'm not 
sure it's worth worrying about. Attribute (or index) access having side effects 
isn't something I think we need to cater to.

--

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



[issue8096] locale.format_string fails on mapping keys

2010-03-09 Thread Eric Smith

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

There's definitely some weirdness going on with handling mapping keys. I'll 
look at it.

--
assignee:  - eric.smith
keywords: +easy
nosy: +eric.smith
priority:  - normal
stage:  - needs patch

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



[issue8060] PEP 3101 string formatting missing engineering presentation type for floating point

2010-03-04 Thread Eric Smith

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

This would be a new feature, so it can't be added to 2.6 or 3.2. It's an 
interesting idea, though.

--
assignee:  - eric.smith
nosy: +mark.dickinson

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



[issue8049] Wrong calculation result

2010-03-03 Thread Eric Smith

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

Please read http://docs.python.org/tutorial/floatingpoint.html

--
nosy: +eric.smith
resolution:  - invalid
status: open - closed

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



[issue8039] precedence rules for ternary operator

2010-03-03 Thread Eric Smith

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

For what it's worth, these are properly called Conditional Expressions. See 
PEP 308 for the gory details, including figuring out what the precedence is. It 
was news to me that the allowed syntax is slightly different in 2.x and 3.x.

--
nosy: +eric.smith

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



[issue8050] smtplib SMTP.sendmail (TypeError: expected string or buffer)

2010-03-03 Thread Eric Smith

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


--
components: +Library (Lib) -Regular Expressions
type: crash - behavior

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



[issue7839] Popen should raise ValueError if pass a string when shell=False or a list when shell=True

2010-02-28 Thread Eric Smith

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

I think the better design is to have 2 distinct APIs: Popen_shell and 
Popen_exec. I'm not wild about the name Popen_exec, suggestions welcome. 
Neither of these would accept a shell parameter.

For starters these could be convenience APIs that just call Popen with the 
correct shell= value, and check the type of args. We could ultimately deprecate 
Popen itself.

I don't see a use case where you programmatically compute the value of shell: 
it's always known as a function of how you're building up args. And even if 
such a rare case exists, you could select between the two APIs to call.

Whether at this point we can make this change is another issue, of course. I'm 
just trying to get at the best design. But if it's done over a number of 
releases I think it's doable.

--

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



[issue7994] object.__format__ should reject format strings

2010-02-26 Thread Eric Smith

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

I haven't looked at the patch, but:

Thanks for the the additional tests. Missing unicode was definitely a mistake.

str(w[0].message) is an improvement.

The PEP is out of date in many respects. I think it's best to note that in the 
PEP and continue to keep the documentation up-to-date.

This issue already applies to 3.3, but my plan is to remove that and create a 
new issue when I close this one. But I'd still like to leave the comments in 
place.

I'm aware of the existing tests which trigger the warning. I think they should 
probably be removed, although I haven't really spent much time thinking about 
it.

--

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



[issue5965] Format Specs: doc 's' and implicit conversions

2010-02-25 Thread Eric Smith

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

Checked in.

trunk: r78440
release26-maint: r78441
py3k: r78442
release31-maint: r78443

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

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



[issue7928] String formatting: grammar wrongly limits [index] to integer

2010-02-25 Thread Eric Smith

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

Checked in.

trunk: r78444
release26-maint: r78445
py3k: r78446
release31-maint: r78447

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

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



[issue5965] Format Specs: doc 's' and implicit conversions

2010-02-24 Thread Eric Smith

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

I think the only remaining issue here is that 's' isn't documented. The 
exceptions are now more meaningful, and commas have been documented.

--
versions: +Python 3.2 -Python 3.0

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



[issue5965] Format Specs: doc 's' and implicit conversions

2010-02-24 Thread Eric Smith

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

Here's my proposed changes. Please review.

I put the string type 's' into its own table. That's probably overkill, but I 
think it gets lost if it's just mentioned in the text. Feel free to change 
that, though.

Also, I'm not wild about my wording for the int-float conversions. But I think 
it needs to go near the int presentation types, not at the end of the section. 
I'd actually prefer it at the top of the int table, but I couldn't find a way 
of working it in.

--
keywords: +needs review, patch
priority:  - normal
stage:  - patch review
Added file: http://bugs.python.org/file16356/issue5965.diff

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



[issue7309] crasher in str(Exception())

2010-02-24 Thread Eric Smith

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

 A much better solution would IMHO be to forbid setting the encoding,
 object and reason attributes to objects of the wrong type in the first
 place. Unfortunately this would require an extension to PyMemberDef for
 the T_OBJECT and T_OBJECT_EX types.

Agreed that's a better approach. But I wanted to get the fix in for 2.6 
and 3.1.

You can open another issue if you'd like. I'm going to close this one as 
soon as I get the crash fixed.

--

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



[issue7649] u'%c' % char broken for chars in range '\x80'-'\xFF'

2010-02-24 Thread Eric Smith

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

I'm working on a similar issue for int.__format__('c'). What's not clear to me 
is why this doesn't work the same as chr(i).  That is, shouldn't chr(i) == 
('%c' % i) hold for i in range(256)? And if that's so, why not just copy chr's 
implementation:
if (x  0 || x = 256) {
PyErr_SetString(PyExc_ValueError,
chr() arg not in range(256));
return NULL;
}
s[0] = (char)x;
return PyString_FromStringAndSize(s, 1);

--

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



[issue5965] Format Specs: doc 's' and implicit conversions

2010-02-24 Thread Eric Smith

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

That looks good. I tweaked it a little and fixed a few other problems with the 
patch. New patch attached.

--
Added file: http://bugs.python.org/file16360/issue5965-1.diff

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



[issue7649] u'%c' % char broken for chars in range '\x80'-'\xFF'

2010-02-24 Thread Eric Smith

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

Of course. Sorry about that.

But then why not copy unichr()? It calls PyUnicode_FromOrdinal.

I guess my real question is:

Should '%c' % i be identical to chr(i) and should u'%c' % i be identical 
to unichr(i)?

And by identical I mean return the same results and throw the same errors 
(with a possible difference in the error text).

--

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



[issue7649] u'%c' % char broken for chars in range '\x80'-'\xFF'

2010-02-23 Thread Eric Smith

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

The patch looks good to me, in that it implements your desired functionality 
well.

I haven't been following the issue closely enough to know whether or not this 
new functionality is the right way to go. (I'm not saying it's not, just that I 
don't have an opinion on it.)

--

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



[issue7994] object.__format__ should reject format strings

2010-02-23 Thread Eric Smith

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

This version of the patch adds support for classic classes and adds tests. 
Documentation still needs to be written.

Again, this diff is against trunk.

If anyone wants to review this, in particular the tests that exercise 
PendingDeprecationWarning, that would be great.

--
keywords:  -easy
Added file: http://bugs.python.org/file16344/issue7994-1.diff

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



[issue7980] time.strptime not thread safe

2010-02-22 Thread Eric Smith

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

With 10.6's stock python, I've had this test either work or crash Python.

On trunk, I get it to either work or give the same error as the original report.

Unfortunately I've been unable to get it to crash again in a debugger so I can 
get a stack trace. But I'm still trying.

--
nosy: +eric.smith

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



[issue7980] time.strptime not thread safe

2010-02-22 Thread Eric Smith

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

Oops, sorry for not specifying that. It's:
Python 2.6.4 (r264:75706, Jan 27 2010, 12:09:19) 
[GCC 4.2.1 (Apple Inc. build 5646) (dot 1)] on darwin

--

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



[issue7928] String formatting: grammar wrongly limits [index] to integer

2010-02-22 Thread Eric Smith

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

I'm not exactly sure what wording to use here.

  element_index: `integer` | `identifier`

is not exactly correct, because it can be a non-identifier (as the example that 
eddy quotes points out. It's really any sequence of characters except ']'.

Any ideas on the best way to express that? Maybe taking a clue from string 
literals, this would be:
  element_index: `integer` | index_string
  index_string: any source character except ] +

--

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



[issue7928] String formatting: grammar wrongly limits [index] to integer

2010-02-22 Thread Eric Smith

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

Proposed patch attached. The rest of the documentation in the following 2 
paragraphs looks correct. It refers to __getitem__, which is how either strings 
or integers is looked up.

--
keywords: +patch
stage:  - patch review
Added file: http://bugs.python.org/file16302/issue7928.diff

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



[issue5988] Delete PyOS_ascii_formatd, PyOS_ascii_strtod, and PyOS_ascii_atof

2010-02-22 Thread Eric Smith

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

These were originally deprecated in issue 5835.

Removed them from py3k in r78306.

--
resolution:  - accepted
stage:  - committed/rejected
status: open - closed
superseder:  - Deprecate PyOS_ascii_formatd

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



[issue5988] Delete PyOS_ascii_formatd, PyOS_ascii_strtod, and PyOS_ascii_atof

2010-02-22 Thread Eric Smith

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

I closed this even though the functions remain in 2.7. They would not be 
removed until 2.8, and since 2.8 seems unlikely I'll close this. Even if there 
is a 2.8, then these functions will still be present but do no harm.

--

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



[issue7980] time.strptime not thread safe

2010-02-22 Thread Eric Smith

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

I just tried it again under gdb on MacOS 10.6, the supplied python 2.6.4 and 
got this backtrace:

Program received signal SIGTRAP, Trace/breakpoint trap.
[Switching to process 61133]
0x7fff87a4b790 in __CFInitialize ()
(gdb) bt
#0  0x7fff87a4b790 in __CFInitialize ()
#1  0x7fff5fc0d5ce in 
__dyld__ZN16ImageLoaderMachO11doImageInitERKN11ImageLoader11LinkContextE ()
#2  0x7fff5fc0d607 in 
__dyld__ZN16ImageLoaderMachO16doInitializationERKN11ImageLoader11LinkContextE ()
#3  0x7fff5fc0bcec in 
__dyld__ZN11ImageLoader23recursiveInitializationERKNS_11LinkContextEj ()
#4  0x7fff5fc0bc9d in 
__dyld__ZN11ImageLoader23recursiveInitializationERKNS_11LinkContextEj ()
#5  0x7fff5fc0bc9d in 
__dyld__ZN11ImageLoader23recursiveInitializationERKNS_11LinkContextEj ()
#6  0x7fff5fc0bda6 in 
__dyld__ZN11ImageLoader15runInitializersERKNS_11LinkContextE ()
#7  0x7fff5fc08fbb in __dyld_dlopen ()
#8  0x7fff8276fe00 in dlopen ()
#9  0x0001000e876f in _PyImport_GetDynLoadFunc ()
#10 0x0001000d2ce4 in _PyImport_LoadDynamicModule ()
#11 0x0001000d0fbf in import_submodule ()
#12 0x0001000d14da in load_next ()
#13 0x0001000d17ec in PyImport_ImportModuleLevel ()
#14 0x0001000aeeb3 in builtin___import__ ()
#15 0x0001c092 in PyObject_Call ()
#16 0x0001000b00e7 in PyEval_CallObjectWithKeywords ()
#17 0x0001000b43ae in PyEval_EvalFrameEx ()
#18 0x0001000b8fd0 in PyEval_EvalCodeEx ()
#19 0x0001000b90b6 in PyEval_EvalCode ()
#20 0x0001000cdeb0 in PyImport_ExecCodeModuleEx ()
#21 0x0001000cf112 in load_source_module ()
#22 0x0001000d0fbf in import_submodule ()
#23 0x0001000d14da in load_next ()
#24 0x0001000d17ec in PyImport_ImportModuleLevel ()
#25 0x0001000aeeb3 in builtin___import__ ()
#26 0x0001c092 in PyObject_Call ()
#27 0x0001000b00e7 in PyEval_CallObjectWithKeywords ()
#28 0x0001000b43ae in PyEval_EvalFrameEx ()
#29 0x0001000b8fd0 in PyEval_EvalCodeEx ()
#30 0x0001000b90b6 in PyEval_EvalCode ()
#31 0x0001000cdeb0 in PyImport_ExecCodeModuleEx ()
#32 0x0001000cf112 in load_source_module ()
#33 0x0001000d0fbf in import_submodule ()
#34 0x0001000d14da in load_next ()
#35 0x0001000d17ec in PyImport_ImportModuleLevel ()
#36 0x0001000aeeb3 in builtin___import__ ()
#37 0x0001c092 in PyObject_Call ()
#38 0x0001fbe5 in PyObject_CallFunction ()
#39 0x0001000d1f9b in PyImport_Import ()
#40 0x0001000d250f in PyImport_ImportModuleNoBlock ()
#41 0x000100515733 in time_strptime ()
#42 0x0001000b8278 in PyEval_EvalFrameEx ()
#43 0x0001000b8fd0 in PyEval_EvalCodeEx ()
#44 0x00010003b355 in function_call ()
#45 0x0001c092 in PyObject_Call ()
#46 0x0001000b00e7 in PyEval_CallObjectWithKeywords ()
#47 0x0001000ef7ae in t_bootstrap ()
#48 0x7fff827a2f8e in _pthread_start ()
#49 0x7fff827a2e41 in thread_start ()
(gdb)

--

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



[issue7988] complex.__format__ has incorrect default alignment

2010-02-22 Thread Eric Smith

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

Checked in:
trunk r78329
py3k r78333
release31-maint r78334

--
priority:  - low
resolution:  - accepted
stage:  - committed/rejected
status: open - closed

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



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

2010-02-22 Thread Eric Smith

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

With the fixes for complex in issue 7988, I believe this issue is completed.

--
priority:  - normal
resolution:  - accepted
stage:  - committed/rejected
status: open - closed
type:  - behavior

___
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



[issue6871] decimal.py: more format issues

2010-02-22 Thread Eric Smith

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

I think there are no remaining issues here that don't have their own issue. I'm 
going to close this unless one of you think otherwise.

--
assignee:  - eric.smith
resolution:  - out of date
status: open - pending
type:  - behavior

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



[issue6871] decimal.py: more format issues

2010-02-22 Thread Eric Smith

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

[If the status is pending, any comment turns it back to open, by design.]

I'd rather float.__format__ agree with %-formatting for floats than with 
anything else.

 '%+08.4f' % float('nan')
'+nan'
 %00f % float('123')
'123.00'

(Not sure about the precision being displayed on that last one, I'll have to 
think about it.)

--

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



[issue7994] object.__format__ should reject format strings

2010-02-22 Thread Eric Smith

New submission from Eric Smith e...@trueblade.com:

Background:

format(obj, fmt) eventually calls object.__format__(obj, fmt) if obj (or one of 
its bases) does not implement __format__. The behavior of object.__format__ is 
basically:

def __format__(self, fmt):
return str(self).__format__(fmt)

So the caller of format() thought they were passing in a format string specific 
to obj, but it is interpreted as a format string for str.

This is not correct, or at least confusing. The format string is supposed to be 
type specific. However in this case the object is being changed (to type str), 
but the format string which was to be applied to its original type is now being 
passed to str.

This is an actual problem that occurred in the migration from 3.0 - 3.1 and 
from 2.6 - 2.7 with complex. In the earlier versions, complex did not have a 
__format__ method, but it does in the latter versions. So this code:
 format(1+1j, '10s')
'(1+1j)'
worked in 2.6 and 3.0, but gives an error in 2.7 and 3.1:
 format(1+1j, '10s')
Traceback (most recent call last):
  File stdin, line 1, in module
ValueError: Unknown format code 's' for object of type 'complex'

Proposal:
object.__format__ should give an error if a non-empty format string is 
specified. In 2.7 and 3.2 make this a PendingDeprecationWarning, in 3.3 make it 
a DeprecationWarning, and in 3.4 make it an error.

Modify the documentation to make this behavior clear, and let the user know 
that if they want this behavior they should say:

format(str(obj), '10s')

or the equivalent:

{0!s:10}.format(obj)

That is, the conversion to str should be explicit.

--
assignee: eric.smith
components: Interpreter Core
messages: 99847
nosy: eric.smith
priority: normal
severity: normal
stage: needs patch
status: open
title: object.__format__ should reject format strings
type: behavior
versions: Python 2.7, Python 3.2

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



[issue6902] Built-in types format incorrectly with 0 padding.

2010-02-22 Thread Eric Smith

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

The root of this problem is an interaction with ',' formatting that was 
introduced in 2.7 and 3.1. I'm still trying to figure out how to implement it.

I'm changing the priority to low because I can't imagine this is a problem in 
practice. If anyone thinks otherwise, please comment and give a use case.

--
priority: normal - low

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



[issue7649] u'%c' % char broken for chars in range '\x80'-'\xFF'

2010-02-22 Thread Eric Smith

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

Could you add a comment on why you're calling PyUnicode_FromString and then 
throwing away the result? I believe it's so you'll get the same error checking 
as PyUnicode_FromString, but it's sufficiently tricky that I think it deserves 
a comment.

Now that I think about it, having done the conversion in PyUnicode_FromString, 
why not use:
buf[0] = PyUnicode_AS_UNICODE(s)[0];
? This way you skip the cast and you know for a fact you're using the same 
interpretation as PyUnicode_FromString, having used its output.

Also, since you know the size you may as well call PyUnicode_FromStringAndSize. 
It's trivially faster and makes the intent clearer, I think.

--

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



[issue7997] http://www.python.org/dev/faq/ doesn't seem to explain how to regenerate configure

2010-02-22 Thread Eric Smith

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

Isn't it true that after regenerating configure that you need to check it back 
in? Or is that so obvious to everyone except me that it's not worth mentioning?

--
nosy: +eric.smith

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



[issue7950] subprocess.Popen documentation should contain a good warning about the security implications when using shell=True

2010-02-18 Thread Eric Smith

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

If you want to generate some more discussion, I suggest you close this issue 
and reopen the other one, since that has more people on the nosy list.

--

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



[issue1578269] Add os.symlink() and os.path.islink() support for Windows

2010-02-18 Thread Eric Smith

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

At the language summit we okay'd using ctypes in the tests for standard lib 
modules, specifically for this issue.

--

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



[issue7950] subprocess.Popen documentation should contain a good warning about the security implications when using shell=True

2010-02-17 Thread Eric Smith

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

This was just discussed in issue 6760.

--
nosy: +eric.smith
resolution:  - duplicate
stage:  - committed/rejected
status: open - closed
superseder:  - patch to subprocess docs to better explain Popen's 'args' 
argument

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



[issue7951] Should str.format allow negative indexes when used for __getitem__ access?

2010-02-17 Thread Eric Smith

New submission from Eric Smith e...@trueblade.com:

It surprised me that this doesn't work:
 {0[-1]}.format('fox')
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: string indices must be integers

I was expecting it to be equivalent to:

 {0[2]}.format('fox')
'x'

I don't think there's any particular reason this doesn't work. It would, 
however break the following code:

 {0[-1]}.format({'-1':'foo'})
'foo'

But note that this doesn't work currently:

 {0[1]}.format({'1':'foo'})
Traceback (most recent call last):
  File stdin, line 1, in module
KeyError: 1

--
assignee: eric.smith
components: Interpreter Core
keywords: easy
messages: 99482
nosy: eric.smith
priority: normal
severity: normal
status: open
title: Should str.format allow negative indexes when used for __getitem__ 
access?
type: feature request
versions: Python 2.7, Python 3.2

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



[issue7906] float(INFI) returns inf on certain platforms

2010-02-12 Thread Eric Smith

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

I agree that backporting the various parts needed to get this working would be 
risky and shouldn't be done.

As for Solaris sure, I'm not sure. You might ask on python-dev. I get the 
impression that few (if any) core developers have access to a Solaris machine.

--

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



[issue7919] reading scientific notation using d instead of e on max osx

2010-02-12 Thread Eric Smith

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

str-float conversions have been reworked in 2.7 and 3.1. The 'D' exponent will 
not on any platform starting with those versions.

So, this would be a non-platform specific feature request.

--
assignee: ronaldoussoren - 
components: +Interpreter Core -Macintosh
nosy: +eric.smith, mark.dickinson
versions: +Python 2.7, Python 3.2 -Python 2.5

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



[issue7919] reading scientific notation using d instead of e on max osx

2010-02-12 Thread Eric Smith

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

That was supposed to say:

The 'D' exponent will not work on any platform starting with those versions.

--

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



[issue7919] reading scientific notation using d instead of e on max osx

2010-02-12 Thread Eric Smith

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

Unless and until we implement 'd' exponents, we should add a test to make sure 
they don't work. That they ever worked on any platform was a surprise. 
--
Eric.

--
title: reading scientific notation using d instead of e on max osx - reading 
scientific notation using d instead of e on max   osx

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



[issue7919] reading scientific notation using d instead of e on max osx

2010-02-12 Thread Eric Smith

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

I'm -1 on this, too. Closing.

--
resolution:  - rejected
stage:  - committed/rejected
status: open - closed

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



[issue7906] float(INFI) returns inf on certain platforms

2010-02-11 Thread Eric Smith

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


--
nosy: +eric.smith, mark.dickinson

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



[issue6760] patch to subprocess docs to better explain Popen's 'args' argument

2010-02-04 Thread Eric Smith

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

I think this is an improvement to the existing docs, and should be committed.

--

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



[issue6760] patch to subprocess docs to better explain Popen's 'args' argument

2010-02-04 Thread Eric Smith

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

When merging to py3k, don't forget to modify the print statement to be a 
function.

--
status: pending - open

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



[issue7844] Add -3 warning for absolute imports.

2010-02-03 Thread Eric Smith

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


--
nosy: +eric.smith

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



[issue1578269] Add os.link() and os.symlink() and os.path.islink() support for Windows

2010-02-02 Thread Eric Smith

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

- When run with patch 20 as non-admin on Windows 7, I get the same test_tarfile 
errors that Brian gets. I do not get these errors with an unpatched py3k build.

- When run with patch 20 as an admin on Windows 7, I do not get the errors in 
test_tarfile. However, I do get errors in test_posixpath that I do not get on 
an unpatched py3k build:
==
FAIL: test_realpath_basic (test.test_posixpath.PosixPathTest)
--
Traceback (most recent call last):
  File C:\opt\cygwin\home\eric\python\py3k\lib\test\test_posixpath.py, line 49
9, in test_realpath_basic
self.assertEqual(realpath(ABSTFN), ABSTFN+1)
AssertionError: 'C:\\opt\\cygwin\\home\\eric\\python\\py3k/C:\\opt\\cygwin\\home
\\eric\\python\\py3k/C:\\opt\\cygwin\\home\\eric\\python\\py3k/@test_3404_tmp1'
!= 'C:\\opt\\cygwin\\home\\eric\\python\\py3k/@test_3404_tmp1'

==
FAIL: test_realpath_resolve_before_normalizing (test.test_posixpath.PosixPathTes
t)
--
Traceback (most recent call last):
  File C:\opt\cygwin\home\eric\python\py3k\lib\test\test_posixpath.py, line 56
0, in test_realpath_resolve_before_normalizing
self.assertEqual(realpath(ABSTFN + /link-y/..), ABSTFN + /k)
AssertionError: 'C:\\opt\\cygwin\\home\\eric\\python\\py3k/C:\\opt\\cygwin\\home
\\eric\\python\\py3k/@test_3404_tmp/C:\\opt\\cygwin\\home\\eric\\python\\py3k/@t
est_3404_tmp/k' != 'C:\\opt\\cygwin\\home\\eric\\python\\py3k/@test_3404_tmp/k'

==
FAIL: test_realpath_resolve_first (test.test_posixpath.PosixPathTest)
--
Traceback (most recent call last):
  File C:\opt\cygwin\home\eric\python\py3k\lib\test\test_posixpath.py, line 58
3, in test_realpath_resolve_first
self.assertEqual(realpath(base + link), ABSTFN)
AssertionError: 'C:\\opt\\cygwin\\home\\eric\\python\\py3k/C:\\opt\\cygwin\\home
\\eric\\python\\py3k/@test_3404_tmp' != 'C:\\opt\\cygwin\\home\\eric\\python\\py
3k/@test_3404_tmp'

==
FAIL: test_realpath_resolve_parents (test.test_posixpath.PosixPathTest)
--
Traceback (most recent call last):
  File C:\opt\cygwin\home\eric\python\py3k\lib\test\test_posixpath.py, line 53
7, in test_realpath_resolve_parents
self.assertEqual(realpath(a), ABSTFN + /y/a)
AssertionError: 'C:\\opt\\cygwin\\home\\eric\\python\\py3...@test_3404_tmp\\k/a'
 != 'C:\\opt\\cygwin\\home\\eric\\python\\py3k/@test_3404_tmp/y/a'

==
FAIL: test_realpath_symlink_loops (test.test_posixpath.PosixPathTest)
--
Traceback (most recent call last):
  File C:\opt\cygwin\home\eric\python\py3k\lib\test\test_posixpath.py, line 50
9, in test_realpath_symlink_loops
self.assertEqual(realpath(ABSTFN), ABSTFN)
AssertionError: 'C:\\opt\\cygwin\\home\\eric\\python\\py3k/C:\\opt\\cygwin\\home
\\eric\\python\\py3k/C:\\opt\\cygwin\\home\\eric\\python\\py3k/@test_3404_tmp' !
= 'C:\\opt\\cygwin\\home\\eric\\python\\py3k/@test_3404_tmp'

==
FAIL: test_samefile (test.test_posixpath.PosixPathTest)
--
Traceback (most recent call last):
  File C:\opt\cygwin\home\eric\python\py3k\lib\test\test_posixpath.py, line 34
3, in test_samefile
False
  File C:\opt\cygwin\home\eric\python\py3k\lib\test\test_posixpath.py, line 29
, in assertIs
self.assertTrue(a is b)
AssertionError: False is not True

==
FAIL: test_samestat (test.test_posixpath.PosixPathTest)
--
Traceback (most recent call last):
  File C:\opt\cygwin\home\eric\python\py3k\lib\test\test_posixpath.py, line 38
4, in test_samestat
False
  File C:\opt\cygwin\home\eric\python\py3k\lib\test\test_posixpath.py, line 29
, in assertIs
self.assertTrue(a is b)
AssertionError: False is not True

--
Ran 30 tests in 0.201s

FAILED (failures=7)
test test_posixpath failed -- multiple errors occurred
1 test failed:
test_posixpath

Even though cygwin is in the path, I am running these tests from a cmd.exe 
(or whatever the built-in shell is called these days) shell. I am not running 
these tests under cygwin bash.

--

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

[issue6760] patch to subprocess docs to better explain Popen's 'args' argument

2010-02-02 Thread Eric Smith

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

From David's patch:

   Note in particular that options and their arguments go in separate list
   elements, while arguments that need quoting when used in the shell
   (such as filenames containing spaces or the python command shown
   above) are single list elements.

It's not always true that options and their arguments should be in separate 
elements. For example:
['/bin/ls', '-l',  '--block-size=1024']
I understand the sentiment, but if we're trying to give guidance that people 
can follow without understanding the underlying issue, then they should be 
correct all the time.

Also, the code snippet includes subprocess without using it.

--
nosy: +eric.smith

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



[issue6760] patch to subprocess docs to better explain Popen's 'args' argument

2010-02-02 Thread Eric Smith

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

Now you need to put the import of subprocess back in!

Otherwise it looks good to me.

--

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



[issue7839] Popen should raise ValueError if pass a string when shell=False or a list when shell=True

2010-02-02 Thread Eric Smith

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


--
nosy: +eric.smith

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



[issue7766] sys.getwindowsversion as PyStructSequence

2010-01-26 Thread Eric Smith

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

The more I think about this, the more concerned I am about changing the number 
of elements in the tuple. That's the change that broke platform.py. Maybe we 
should add a parameter named something like level, defaulting to 0.

0 = existing behavior, but with named tuple
1 = return named 9-tuple OSVERSIONINFOEX values
other values: reserved for future use

Or maybe we should make it a bool instead, and not worry about future expansion.

--

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



[issue7766] sys.getwindowsversion as PyStructSequence

2010-01-26 Thread Eric Smith

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

Great idea, Marc-Andre. I agree that's the better approach.

It looks like PyStructSequence supports this, by setting n_in_sequence to a 
value smaller then the number of PyStructSequence_Fields. A quick look doesn't 
show any uses of this in the C code (except maybe os.stat), but I'll 
investigate and make sure that's a supported use case.

--

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



[issue7766] sys.getwindowsversion as PyStructSequence

2010-01-26 Thread Eric Smith

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

Here's a patch that implement's Marc-Andre's suggestion. The docstring and 
documentation need work. I still need to verify that this isn't a misuse of 
PyStructSequence, but the tests pass on Windows. I need to verify a few other 
platforms to make sure the #ifdef logic is correct.

--
Added file: http://bugs.python.org/file16012/winver_as_structseq_ex2.diff

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



[issue7766] sys.getwindowsversion as PyStructSequence

2010-01-26 Thread Eric Smith

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

I can confirm the most recent patch (ex2) doesn't break anything on MacOS or 
Linux.

It's clear that structseq.c is designed to be used this way, with more named 
members than unnamed members (and vice-versa, actually). See n_members vs. 
n_in_sequence in Objects/structseq.c.

I'll work on the docstring and documentation then I'll commit it.

--

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



[issue7789] Issue using datetime with format()

2010-01-26 Thread Eric Smith

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

datetime.datetime passes its format string to strftime:

 import datetime
 x = datetime.datetime(2001, 1, 2, 3, 4)
 x.strftime('%Y-%m-%d')
'2001-01-02'
 '{0:%Y-%m-%d}'.format(x)
'2001-01-02'

I'll check to make sure this is documented.

--
assignee:  - eric.smith
components: +Documentation -Library (Lib)
nosy: +eric.smith
stage: test needed - 

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



[issue7789] Issue using datetime with format()

2010-01-26 Thread Eric Smith

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

I don't think this is documented (that I can find, at least), so I'll assign it 
to Georg.

I think the correct thing to do is something like this, in the datetime, date, 
and time object descriptions:

date.__format__(fmt)
For a date d, format(d, fmt) is equivalent to d.strftime(fmt).

Ditto for date.__format__. But maybe there's a better, more obvious place to 
document this.

--

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



[issue7789] Issue using datetime with format()

2010-01-26 Thread Eric Smith

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

The documentation for this belongs in the mini-language specification, since 
that just address built-in types. Each type can define its own format 
specification language.

So I think adding documentation of __format__ to each non-builtin type that 
implements __format__ is probably the best way to go.

--

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



[issue7789] Issue using datetime with format()

2010-01-26 Thread Eric Smith

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

Eric Smith wrote:
 The documentation for this belongs in the mini-language specification, ...

Oops. does NOT belong in the mini-language specification.

--

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



[issue7766] sys.getwindowsversion as PyStructSequence

2010-01-26 Thread Eric Smith

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

Here's the final version of the patch. After some testing on various platforms 
I'll commit it.

--
Added file: http://bugs.python.org/file16020/winver_as_structseq_ex4.diff

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



[issue7766] sys.getwindowsversion as PyStructSequence

2010-01-26 Thread Eric Smith

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

Committed in trunk r77763, in py3k r77765.

--
assignee:  - eric.smith
resolution:  - accepted
stage: patch review - committed/rejected
status: open - closed

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



[issue7789] Issue using datetime with format()

2010-01-26 Thread Eric Smith

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


--
assignee: eric.smith - georg.brandl
nosy: +georg.brandl

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



[issue7766] sys.getwindowsversion as PyStructSequence

2010-01-25 Thread Eric Smith

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

Here's an updated patch. I fixed some docstrings, modified it to work with the 
most recent assertIsInstance changes, and added #ifdef for Windows.

There are a number of test failures still, I think all of them relating to 
errors in platform.py where it calls sys.getwindowsversion() and unpacks the 
result. I'll look at those soon.

--
Added file: http://bugs.python.org/file16006/winver_as_structseq_ex1.diff

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



[issue7766] sys.getwindowsversion as PyStructSequence

2010-01-23 Thread Eric Smith

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

I like this. I've visually reviewed the patch, but haven't tested it yet. I'm 
willing to commit this.

Could you add to the tests to assert that .major is equal to [0], etc.?

Also, the documentation says that element [4] is text, but you've referred to 
it as service_pack. I don't think service_pack is documented anywhere, but 
is clearly a better name than text. The documentation of OSVERSIONINFO 
describes this as szCSDVersion, with the description of 'A null-terminated 
string, ..., that indicates the latest Service Pack installed on the system 
...', so service_pack is okay with me. Can you change the documentation to 
refer to this field as service_pack?

Another idea would be to expose OSVERSIONINFOEX. I've personally wanted to get 
access to wProductType in the past. Any thoughts on that? I think 
OSVERSIONINFOEX would be available on any version of Windows that we care about 
going forward.

I don't see any point in changing it from a function to a property at this 
point. There's the hassle of migrating to the new version, and it's wrapping a 
Win32 API call anyway.

--
nosy: +eric.smith

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



[issue7758] cPickle.load() segfault on invalid data

2010-01-22 Thread Eric Smith

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

This is a duplicate of issue 7455.

--
components: +Extension Modules -None
nosy: +eric.smith
resolution: out of date - duplicate
superseder:  - cPickle: stack underflow in load_pop()

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



[issue7743] Additional potential string - float conversion issues.

2010-01-20 Thread Eric Smith

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


--
nosy: +eric.smith

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



<    1   2   3   4   5   6   7   8   >