[issue5220] os.makedirs' mode argument has bad default value

2010-06-13 Thread R. David Murray

R. David Murray  added the comment:

I don't understand what you mean when you say "how umask works in relation to 
Python".  How it works in relation to Python isn't different from how it works 
for any other Unix program.  Consider, for example, the unix man page for 
'open'.

I don't think a docstring change is called for; the docstrings are brief 
summaries to act as memory aids, the real docs are the docs.  If someone does 
want to propose such a change they should open a new issue.

--
nosy: +r.david.murray

___
Python tracker 

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



[issue8988] import + coding = failure (3.1.2/win32)

2010-06-13 Thread R. David Murray

Changes by R. David Murray :


--
components: +Interpreter Core -None
stage:  -> unit test needed
type: crash -> behavior

___
Python tracker 

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



[issue8988] import + coding = failure (3.1.2/win32)

2010-06-13 Thread R. David Murray

Changes by R. David Murray :


--
nosy: +haypo

___
Python tracker 

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



[issue8987] Distutils doesn't quote Windows command lines properly

2010-06-13 Thread R. David Murray

R. David Murray  added the comment:

Note that list2cmdline does correct quoting (which includes the "s) if you are 
passing the string directly to a program.  In that case cmd.exe's 
metacharacters aren't special.  (As I noted in issue 8972, I believe that 
list2cmdline's current quoting of '|' characters is in error).

Perhaps a canonical list2cmdline actually belongs in shutil?

--
nosy: +r.david.murray

___
Python tracker 

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



[issue8993] Small typo in docs for PySys_SetArgv

2010-06-13 Thread flashk

New submission from flashk :

The docs for PySys_SetArgv say:

"This function works like PySys_SetArgv() with updatepath set to 1."

I believe it should be "PySys_SetArgvEx".

I've attached a patch.

--
assignee: d...@python
components: Documentation
files: init.rst.patch
keywords: patch
messages: 107771
nosy: d...@python, flashk
priority: normal
severity: normal
status: open
title: Small typo in docs for PySys_SetArgv
versions: Python 2.7
Added file: http://bugs.python.org/file17665/init.rst.patch

___
Python tracker 

___
___
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-06-13 Thread R. David Murray

R. David Murray  added the comment:

See issue 8972 for motivation for accepting this proposal.  Maybe I should 
start working on the patch :)

--

___
Python tracker 

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



[issue8972] subprocess.list2cmdline doesn't quote the & character

2010-06-13 Thread R. David Murray

R. David Murray  added the comment:

The actual bug here is that list2cmdline is called when shell=True and a list 
is passed.  This should not be done.  Instead, Popen should raise an TypeError 
(see issue 7839).

When calling Popen with shell=True, you should be passing in a string that is 
already correctly quoted.  This is how it works in Unix, and is how it should 
work in Windows as well.

So I agree with exarkun's comments in msg107679, and I think Gregory's fix in 
r60115 for issue 1300 was incorrect and that in fact the OP was correct that he 
did not understand what was happening (note that he did not report an actual 
bug, he just reported that the code looked wrong to him).

--
nosy: +gregory.p.smith, r.david.murray
resolution:  -> invalid
stage:  -> committed/rejected
status: open -> pending
superseder:  -> Popen should raise ValueError if pass a string when shell=False 
or a list when shell=True

___
Python tracker 

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



[issue8972] subprocess.list2cmdline doesn't quote the & character

2010-06-13 Thread Jean-Paul Calderone

Jean-Paul Calderone  added the comment:

> That remark is not relevant, because the actual problem is different.

Maybe you can expand the test case to demonstrate the actual problem?  The 
tests in the latest patch are for list2cmdline directly.  But you can't observe 
the problem a bug in list2cmdline causes until you actually try to launch a 
child process.  So perhaps the test should do that?

--

___
Python tracker 

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



[issue8989] email.utils.make_msgid: specify domain

2010-06-13 Thread R. David Murray

Changes by R. David Murray :


--
assignee:  -> r.david.murray

___
Python tracker 

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



[issue8989] email.utils.make_msgid: specify domain

2010-06-13 Thread R. David Murray

R. David Murray  added the comment:

This does seem like a reasonable (and backward compatible) addition to the API. 
 I'm only +0 on adding it, though, without at least one specific use case.  I'd 
want to mention that use case in the docs as an example, and stress that using 
the default is recommended unless you've got a good reason to do otherwise 
("such as").

Adrian, what use case(s) do you have in mind?

--

___
Python tracker 

___
___
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-06-13 Thread Eric Smith

Changes by Eric Smith :


--
stage:  -> needs patch

___
Python tracker 

___
___
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-06-13 Thread Eric Smith

Eric Smith  added the comment:

Closed issue 8985 as a duplicate of this; merging nosy lists.

--
nosy: +gosella, mark.dickinson, merwok

___
Python tracker 

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



[issue8985] String format() has problems parsing numeric indexes

2010-06-13 Thread Eric Smith

Eric Smith  added the comment:

I'll consider this a duplicate. Issue 7951 is the existing feature request for 
this issue. I'll merge the nosy lists.

--
resolution: rejected -> duplicate
superseder:  -> Should str.format allow negative indexes when used for 
__getitem__ access?

___
Python tracker 

___
___
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-06-13 Thread Eric Smith

Changes by Eric Smith :


--
versions:  -Python 2.7

___
Python tracker 

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



[issue5220] os.makedirs' mode argument has bad default value

2010-06-13 Thread Sindre Myren

Sindre Myren  added the comment:

I have to agree with jab. While the way relative paths works are more or less 
common knowledge, the way umask does and does not work in relation to python 
isn't.

It is however given a short description at 
http://docs.python.org/library/os.html#os.makedirs:
...The default mode is 0777 (octal). On some systems, mode is ignored. Where it 
is used, the current umask value is first masked out.

And as it is documented (briefly) online that the umask *is* used, perhaps it 
is not necessary to add it to the doc-string?

--
nosy: +smyrman

___
Python tracker 

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



[issue8930] messed up formatting after reindenting

2010-06-13 Thread Arfrever Frehtes Taifersar Arahesis

Arfrever Frehtes Taifersar Arahesis  added the comment:

The following command (in bash shell) shows more files:
find -name '*.[ch]' -exec grep -El $'^\t' {} \;

I think that internal copies of libffi should be ignored.

--
nosy: +Arfrever

___
Python tracker 

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



[issue8912] `make patchcheck` should check the whitespace of .c/.h files

2010-06-13 Thread Éric Araujo

Éric Araujo  added the comment:

Updating patch to check header files too. Untested.

--
Added file: http://bugs.python.org/file17664/check-tabs.diff

___
Python tracker 

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



[issue8912] `make patchcheck` should check the whitespace of .c/.h files

2010-06-13 Thread Éric Araujo

Changes by Éric Araujo :


--
nosy: +pitrou

___
Python tracker 

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



[issue8925] Improve c-api/arg.rst: use "bytes" or "str" types instead of "string"

2010-06-13 Thread Éric Araujo

Éric Araujo  added the comment:

haypo, I was not speaking about documenting the buffer protocol in general, but 
reacting to this specific change in your patch/commit:

-   buffer protocol (such as :class:`bytes` or :class:`bytearray` objects).
+   buffer protocol.

Before the commit, the term “buffer protocol” was explained by the two examples 
with links, but now there’s neither link nor example, which is arguably a doc 
regression .

--
title: Improve c-api/arg.rst: use "bytes" or "str" types insteadof 
"string" -> Improve c-api/arg.rst: use "bytes" or "str" types instead of 
"string"

___
Python tracker 

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



[issue8653] urlparse.urlparse/urlsplit doc missing

2010-06-13 Thread Éric Araujo

Éric Araujo  added the comment:

Dave, can you explain your problem with a quote or a file name and line number, 
or directly propose a doc patch?

--

___
Python tracker 

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



[issue8814] functools.WRAPPER_ASSIGNMENTS should include __annotations__

2010-06-13 Thread Éric Araujo

Éric Araujo  added the comment:

Patch looks good to me. Could you add some tests to Lib/test/test_functools.py 
to check that annotations are really copied?

(3.2 is not frozen, adjusting versions)

--
stage:  -> unit test needed
versions:  -Python 3.3

___
Python tracker 

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



[issue8538] Add ConfigureAction to argparse

2010-06-13 Thread Éric Araujo

Éric Araujo  added the comment:

I think you can go ahead and produce a patch. Don’t start splitting argparse 
into a package now though, this is a sensible decision IMO but has to be agreed 
by the maintainer; just add FlagAction and ConfigureAction to argparse for now.

--
stage:  -> needs patch

___
Python tracker 

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



[issue8602] documentation of bz2 module mildly erroneous

2010-06-13 Thread Éric Araujo

Éric Araujo  added the comment:

Also, don’t bother with 3.0: It is not supported by python-dev anymore. Make 
documentation patches for py3k and trunk, and they’ll be backported to the 
stable branches 3.1 and 2.6.

--

___
Python tracker 

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



[issue8602] documentation of bz2 module mildly erroneous

2010-06-13 Thread Éric Araujo

Éric Araujo  added the comment:

I’d remove the lines “Specifically it does not define the :meth:`__enter__` and 
:meth:`__exit__` methods required by the :keyword:`with` statement”, since they 
add unnecessary length to a simple note.

Please provide one patch per branch, and diff from the top level of the 
checkout (see http://www.python.org/dev/patches/). Thanks!

--
status: pending -> open

___
Python tracker 

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



[issue8350] os.mkdir doc comment is incorrect

2010-06-13 Thread Éric Araujo

Changes by Éric Araujo :


--
assignee: georg.brandl -> d...@python
nosy: +d...@python

___
Python tracker 

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



[issue8850] Remove "w" format of PyParse_ParseTuple()

2010-06-13 Thread STINNER Victor

STINNER Victor  added the comment:

"w#" is not only useless but also not used in py3k source code. "w" is also not 
used. Only "w*" is used by fnctl and socket modules.

The problem with w# is that the caller cannot "release" the buffer and so we 
cannot lock the buffer. I don't know exactly what happens if you get a pointer 
to a bytearray, release the GIL and then use it, whereas another thread 
modifies and/or destroys the bytearray object. (I suppose that something bad 
will happen, like a segfault)

--

___
Python tracker 

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



[issue8912] `make patchcheck` should check the whitespace of .c/.h files

2010-06-13 Thread Éric Araujo

Éric Araujo  added the comment:

Here’s a quick crack at it. Conservative approach: Don’t reindent, just 
complain.

--
keywords: +patch
nosy: +merwok
stage:  -> patch review
versions: +Python 2.7, Python 3.2
Added file: http://bugs.python.org/file17663/check-tabs.diff

___
Python tracker 

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



[issue8969] Windows: use (mbcs in) strict mode to encode/decode filenames, and enable os.fsencode()

2010-06-13 Thread STINNER Victor

Changes by STINNER Victor :


--
resolution:  -> fixed
status: open -> closed

___
Python tracker 

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



[issue8992] convertsimple() doesn't need to call converterr() if an exception was already raised

2010-06-13 Thread STINNER Victor

New submission from STINNER Victor :

If convertitem() result is not NULL, an error occured and seterror() is called 
(by the function calling convertitem()). seterror() does nothing if an 
exception was raised (if PyErr_Occurred() is non zero).

convertitem() doesn't need to call converterr() if an exception occurred 
because the string formatted by converterr() will be ignored. We just need to 
return a non NULL pointer: msgbuf.

Attached patch creates a RETURN_ERR_OCCURRED macro. convertsimple() should be a 
little bit faster and the code is more readable. Details:
 - addcleanup() now takes a boolean to indicate if it's a buffer or a pointer 
to simplify the API and have to raise a special error if the destructor is 
unknown
 - don't check that the result of PyUnicode_AsEncodedString() is a bytes 
object: PyUnicode_AsEncodedString() does already check that

--
components: Interpreter Core
files: getarg_err_occurred.patch
keywords: patch
messages: 107753
nosy: haypo
priority: normal
severity: normal
status: open
title: convertsimple() doesn't need to call converterr() if an exception was 
already raised
versions: Python 3.2
Added file: http://bugs.python.org/file17662/getarg_err_occurred.patch

___
Python tracker 

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



[issue8972] subprocess.list2cmdline doesn't quote the & character

2010-06-13 Thread shypike

shypike  added the comment:

The discussion is going the wrong way. Let me state what is the actual problem.
When the Popen() function is called with "shell=True", you cannot pass command 
line elements in which the characters '&' and '|' are embedded (example 
r'Q&A'). list2cmdline should embed such elements in double quotes '"' in the 
same way as when a space is detected (so r'"Q&A"').
When '&' and '|' require their special meaning, they should be passed as 
separate elements (r'&') and in that case list2cmdline should not double-quote 
them.

The whole C++ discussion was only invoked because I said a potential 
work-around doesn't work because the way list2cmdline is designed. That remark 
is not relevant, because the actual problem is different.

--

___
Python tracker 

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



[issue8987] Distutils doesn't quote Windows command lines properly

2010-06-13 Thread Éric Araujo

Éric Araujo  added the comment:

Distutils is frozen, because even fixing blatant bugs breaks third-party code 
that relies on internals. Can you check your bug with a Distutils2 checkout 
from hg.python.org/distutils2?

--
nosy: +merwok

___
Python tracker 

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



[issue8215] getargs.c in Python3 contains some TODO and the documentation is outdated

2010-06-13 Thread STINNER Victor

STINNER Victor  added the comment:

r81811 and r81923 improve Doc/c-api/arg.rst. I opened more specific issues to 
improve getargs code and documentation:
 - #8991: PyArg_Parse*() functions: reject discontinious buffers
 - #8926: getargs.c: release the buffer on error
 - #8952: Doc/c-api/arg.rst: fix documentation of number formats
 - #8949: PyArg_Parse*(): "z" should not accept bytes
 - #8951: PyArg_Parse*(): factorize code of 's' and 'z' formats, and 'u' and 
'Z' formatsopen
 - #8850: Remove "w" format of PyParse_ParseTuple()

I prefer to close this issue because it is too generic. All points of this 
issues can be found in the other issues or are already fixed by some commits.

--
resolution:  -> duplicate
status: open -> closed

___
Python tracker 

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



[issue8991] PyArg_Parse*() functions: reject discontinious buffers

2010-06-13 Thread STINNER Victor

New submission from STINNER Victor :

getbuffer() checks that the buffer is contiguous. "s#", "y", "z" formats use 
convertbuffer() which doesn't check that the buffer is contigious, as "w" and 
"w#" formats which call directly PyObject_GetBuffer() which extra check.

I don't think that the functions using these format support discontiguous 
buffers. I cannot check because I don't know how to create such buffer. It 
would be safer to reject discontigious buffer.

If a function would like to support discontigious buffer, it should use "O" 
format, call PyObject_GetBuffer() with the right option and do its own checks 
on the buffer object.

--
components: Interpreter Core
messages: 107749
nosy: haypo
priority: normal
severity: normal
status: open
title: PyArg_Parse*() functions: reject discontinious buffers
versions: Python 3.2

___
Python tracker 

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



[issue8949] PyArg_Parse*(): "z" should not accept bytes

2010-06-13 Thread STINNER Victor

Changes by STINNER Victor :


Removed file: http://bugs.python.org/file17591/pyarg_z_no_bytes.patch

___
Python tracker 

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



[issue8949] PyArg_Parse*(): "z" should not accept bytes

2010-06-13 Thread STINNER Victor

STINNER Victor  added the comment:

Update the patch to update also the new tests that I added in r81973 (to fix 
#8592).

--
Added file: http://bugs.python.org/file17661/pyarg_z_no_bytes-2.patch

___
Python tracker 

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



[issue8592] 'y' does not check for embedded NUL bytes

2010-06-13 Thread STINNER Victor

STINNER Victor  added the comment:

I commited a bigger patch: r81973 not only fixes "y" format, but also "u" and 
"Z". It does also add a lot of tests in test_getargs2.py for many string 
formats (not all, eg. "es" is not tested).

Even if I consider this as a bugfix, I don't want to backport to 3.1 because it 
might break programs which rely on this strange behaviour.

--
resolution:  -> fixed
status: open -> closed

___
Python tracker 

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



[issue6560] socket sendmsg(), recvmsg() methods

2010-06-13 Thread David Watson

David Watson  added the comment:

Optional patch to replace SocketTCPTest, etc. with the classes from the sendmsg 
patch.

--
Added file: http://bugs.python.org/file17660/v4-replace-existing-classes.diff

___
Python tracker 

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



[issue8972] subprocess.list2cmdline doesn't quote the & character

2010-06-13 Thread Eric Smith

Changes by Eric Smith :


--
nosy: +eric.smith

___
Python tracker 

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



[issue6560] socket sendmsg(), recvmsg() methods

2010-06-13 Thread David Watson

David Watson  added the comment:

New version with minor changes.  Will also upload at 
http://codereview.appspot.com/1487041/show

--
Added file: http://bugs.python.org/file17659/baikie-hwundram-v4.diff

___
Python tracker 

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



[issue8990] array constructor and array.fromstring should accept bytearray.

2010-06-13 Thread Thomas Jollans

New submission from Thomas Jollans :

Currently, the array constructor, if given a bytearray, detects this with 
PyByteArray_Check, and hands it on to array_fromstring, which does not support 
bytearray (by using "s#" with PyArg_ParseTuple) and raises TypeError.

>>> array('h', bytearray(b'xyxyxyxyxyxyxyxyxy'))
Traceback (most recent call last):
  File "", line 1, in 
TypeError: must be bytes or read-only buffer, not bytearray
>>>  


I see no reason to insist on read-only buffers. I'm attaching a patch that I 
think fixes this.

--
components: Extension Modules, Library (Lib)
files: array.diff
keywords: patch
messages: 107744
nosy: tjollans
priority: normal
severity: normal
status: open
title: array constructor and array.fromstring should accept bytearray.
type: behavior
versions: Python 3.1, Python 3.2, Python 3.3
Added file: http://bugs.python.org/file17658/array.diff

___
Python tracker 

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



[issue5094] datetime lacks concrete tzinfo impl. for UTC

2010-06-13 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

Also I changed Py_DECREFs in destructor to Py_CLEAR.  I understand that while 
not strictly required in this case, it is a good practice.

--

___
Python tracker 

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



[issue5094] datetime lacks concrete tzinfo impl. for UTC

2010-06-13 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

issue5094g.diff addresses all Mark's suggestions except making struct 
definition public.  I also made a few other changes:

1. Constructor now raises TypeError when offset is not a timedelta instead of 
ValueError in previous version.

2. NEWS entry no longer says that argument is ignored by tzinfo methods 
implemented in timezone.  (Since these methods now check the type of the 
argument, it would be misleading to say that arg is ignored.)

3. Added some more tests for error cases.

4. Added ACK for Rafe Kaplan as the author of the original patch.

--
Added file: http://bugs.python.org/file17657/issue5094g.diff

___
Python tracker 

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



[issue7370] patch: BaseHTTPServer reinventing rfc822 date formatting

2010-06-13 Thread Éric Araujo

Éric Araujo  added the comment:

The skeleton is good but you have to change one thing. Your test should
exercise a function or method of BaseHTTPServer, not the underlying
implementation detail. I failed to explain that earlier:

1a) Write a test that checks that the current code produces right values
for a handful of cases (perhaps the RFC has them, else pick at random);
1b) Check that the test pass with the current code;
2a) Change BaseHTTPServer to use emails.utils.formatdate;
2b) Check that the test still pass.

End of HOWTO write a regression test :)

--

___
Python tracker 

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



[issue7370] patch: BaseHTTPServer reinventing rfc822 date formatting

2010-06-13 Thread Shashwat Anand

Shashwat Anand  added the comment:

Agreed.
Attaching the unit test.

--
Added file: http://bugs.python.org/file17656/test_httpserver.patch

___
Python tracker 

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



[issue8985] String format() has problems parsing numeric indexes

2010-06-13 Thread Germán L . Osella Massa

Germán L. Osella Massa  added the comment:

I now see the rationale behind not accepting ' 10 ' == 10. But what about not 
accepting '-1' == -1?

I think is odd that negative numbers are not accepted as valid indexes. I'd 
expect that something like 

"First element is {0[0]} and last element is {0[-1]}".format([0,1,2,3])

would work but it didn't.

Should I create a new Issue requesting this as a new feature? Or could be 
reconsidered as a bug?

I could provide a simple patch that change get_integer() so it would accept 
negative integers as a valid number.

(This is the first issue I reported and English is not my native language so I 
apology for any mistake that I made)

--

___
Python tracker 

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



[issue5094] datetime lacks concrete tzinfo impl. for UTC

2010-06-13 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

Just to add a little bit of historical perspective, this proposal is really 
more than seven years old:

"""
s.keim (Dec 20, 2002 3:33 am; Comment #13)

.. do we really need methods like utcnow. I believe the following could be a 
little more easy to learn:

* the module define an UTC tzinfo object

* the module define an UTC tzinfo object instead of utcfromtimestamp(x) and 
utcnow(), the user can use fromtimestamp(x, tzinfo=UTC) and now(tzinfo=UTC)
""" http://www.zope.org/Members/fdrake/DateTimeWiki/SuggestedRequirements

Apparently, this proposal have been forgotten and reinvented again in 
msg106411, point 2.

--

___
Python tracker 

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



[issue5094] datetime lacks concrete tzinfo impl. for UTC

2010-06-13 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

On Sun, Jun 13, 2010 at 10:09 AM, Mark Dickinson  wrote:
..
> - Should the PyDateTime_TimeZone struct definition go into
> datetime.h, so that it's avaiable if you want to export any C-API
> functions later on?
>
The original patch had this in the header file, but I moved it down to .c 
during dst debate. (See msg107186, point 3.)  In the future we may add accessor 
functions to datetime.h, but this can be done without exposing the C struct.
 
> - If you're not allowing subclassing, then presumably you don't need
>  the new_timezone / new_timezone_ex dance?
>
I agree, but if you don't mind, I will not change it at this point.  There is a 
small chance that there will be an outcry for supporting subclassing and we 
will put that back in. Also, issue #2267 debate may result in removing the 
dance from other factory functions. (If the camp saying that the base class has 
no idea how to construct subclass instances wins.) Not a big deal either way, 
though.

> - For clarity, please consider adding parentheses in:
>
>    self = (PyDateTime_TimeZone *)type->tp_alloc(type, 0);
>

will do.  PEP 7 does not mention that, but probably should. 

> - Whitespace issues: there are a couple of tabs in the source (at
> around lines 810, 3388, 3390), and an overly long line (>79
> characters) at around line 3365.
>

Thanks.  I thought I checked those.  Maybe I should take over issue8912 as a 
community service. :-) 

> - Please add a brief comment before the added C functions (like
> new_timezone_ex) explaining their purpose.
>

Will do.

> - I wonder whether __ne__ should return the correct result (rather
> than returning NotImplemented) for timezone instances. 

Will do.

>  OTOH, I agree with the decision not to allow timezone order
> comparisons (though I bet they get requested at some point).

I will support such request.  It is very easy to implement (just remove the 
check that disallows it) and makes perfect sense.  I left them out only because 
it is easier to add features than to remove in the future and I don't want to 
debate this now.


>
> - There doesn't seem to be any mention of timezone.min or timezone.max
> in the docs.  Is this deliberate?
>
Yes.  Without ordering, having min and max is rather strange.  I wanted to 
expose these for testing and will definitely document them when (and if) order 
comparisons are implemented.  For now, let's keep them as easter eggs.

--

___
Python tracker 

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



[issue8989] email.utils.make_msgid: specify domain

2010-06-13 Thread Shashwat Anand

Shashwat Anand  added the comment:

Adrian, Could you generate the diffs from the
top level of the checkout and attach it here?

--
nosy: +l0nwlf

___
Python tracker 

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




[issue8989] email.utils.make_msgid: specify domain

2010-06-13 Thread Éric Araujo

Éric Araujo  added the comment:

Seems straightforward. Any reason not to allow it David?

Adrian, I edited the versions: new features go into 3.2 only. Please make sure 
your patch applies to this version (branch named py3k). Can you also write unit 
tests for this new parameter?

--
keywords: +patch
nosy: +merwok, r.david.murray
stage:  -> unit test needed
type:  -> feature request
versions: +Python 3.2 -Python 2.6, Python 3.1

___
Python tracker 

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



[issue8989] email.utils.make_msgid: specify domain

2010-06-13 Thread Adrian von Bidder

New submission from Adrian von Bidder :

Using the hostname for the domain part of a Message-Id is probably the right 
thing usually but users may want to override this.

Please consider this rather trivial patch:

=
--- utils.py.orig   2010-06-13 16:59:30.533861099 +0200
+++ utils.py2010-06-13 17:02:18.650697979 +0200
@@ -173,13 +173,15 @@
 
 
 

-def make_msgid(idstring=None):
+def make_msgid(idstring=None, domain=None):
 """Returns a string suitable for RFC 2822 compliant Message-ID, e.g:
 
 <20020201195627.33539.96...@nightshade.la.mastaler.com>
 
 Optional idstring if given is a string used to strengthen the
-uniqueness of the message id.
+uniqueness of the message id.  The domain part of the Message-ID
+defaults to the locally defined hostname, but can be specified
+explicitly.
 """
 timeval = time.time()
 utcdate = time.strftime('%Y%m%d%H%M%S', time.gmtime(timeval))
@@ -189,8 +191,9 @@
 idstring = ''
 else:
 idstring = '.' + idstring
-idhost = socket.getfqdn()
-msgid = '<%s.%s.%...@%s>' % (utcdate, pid, randint, idstring, idhost)
+if domain is None:
+domain = socket.getfqdn()
+msgid = '<%s.%s.%...@%s>' % (utcdate, pid, randint, idstring, domain)
 return msgid
 
 
=

thanks & greetings
-- vbi

--
components: Library (Lib)
messages: 107734
nosy: avbid...@fortytwo.ch
priority: normal
severity: normal
status: open
title: email.utils.make_msgid: specify domain
versions: Python 2.6, Python 3.1

___
Python tracker 

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



[issue5094] datetime lacks concrete tzinfo impl. for UTC

2010-06-13 Thread Mark Dickinson

Mark Dickinson  added the comment:

The latest patch looks good to me.  I only have minor comments, in random order:

- Should the PyDateTime_TimeZone struct definition go into datetime.h, so that 
it's avaiable if you want to export any C-API functions later on?

- If you're not allowing subclassing, then presumably you don't need
  the new_timezone / new_timezone_ex dance?

- For clarity, please consider adding parentheses in:

self = (PyDateTime_TimeZone *)type->tp_alloc(type, 0);

  to make it:

self = (PyDateTime_TimeZone *)(type->tp_alloc(type, 0));

- Whitespace issues: there are a couple of tabs in the source (at around lines 
810, 3388, 3390), and an overly long line (>79 characters) at around line 3365.

- Please add a brief comment before the added C functions (like 
new_timezone_ex) explaining their purpose.

- I wonder whether __ne__ should return the correct result (rather than 
returning NotImplemented) for timezone instances.  I realize that it's not 
necessary to implement it in order for 'tz1 != tz2' to work, but it still makes 
me uncomfortable that it's not implemented.  OTOH, I agree with the decision 
not to allow timezone order comparisons (though I bet they get requested at 
some point).

- There doesn't seem to be any mention of timezone.min or timezone.max in the 
docs.  Is this deliberate?

--

___
Python tracker 

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



[issue8986] math.erfc OverflowError

2010-06-13 Thread Mark Dickinson

Mark Dickinson  added the comment:

Fixed in r81967 (trunk) and r81968 (py3k).

I had to weaken the tests for erfc:  its accuracy for largish arguments (25.0 
or so) is not ideal---I was seeing errors of 100 ulps and more.  However, I 
think this level of error is acceptable in practice, since for arguments this 
size the difference between erfc(x) and erfc(next_float_up(x)) is already 
several hundred ulps.

If anyone wants to look at improving the accuracy for large arguments, it's the 
calculation of exp(-x*x) that's the source of the error.  The way to fix it, if 
anyone cared, would be to do the multiplication x*x in double-double precision, 
giving x*x = y + z for doubles y and z, and then use exp(-y) * exp(-z) in place 
of exp(-x*x).

Thanks for catching this, Geremy!

--
resolution:  -> fixed
status: open -> closed

___
Python tracker 

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



[issue8988] import + coding = failure (3.1.2/win32)

2010-06-13 Thread gonegown

New submission from gonegown :

I have python 3.1.2 fetched from the main site.

imagine two source files:

a.py:
---
# coding: cp1251
import b;
print('A');
---

b.py:
---
print('B');
---

Both reside in the same directory containing at least one non-ascii character 
(try 0xdb) in the _path_.

import will fail with an empty error!
#coding here works fine with utf-8 and fails using any other one

now tell me how the hell can file system encoding be related to file content 
encoding?!

I've attached the source

--
components: None
files: pybug-import-coding.zip
messages: 107731
nosy: gonegown
priority: normal
severity: normal
status: open
title: import + coding = failure (3.1.2/win32)
type: crash
versions: Python 3.1
Added file: http://bugs.python.org/file17655/pybug-import-coding.zip

___
Python tracker 

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



[issue8986] math.erfc OverflowError

2010-06-13 Thread geremy condra

geremy condra  added the comment:

On Sun, Jun 13, 2010 at 5:47 AM, Mark Dickinson  wrote:
>
> Mark Dickinson  added the comment:
>
> Geremy, can you verify that the attached patch fixes the problem?  If so, 
> I'll add tests and commit.

I've only tested it from 2**16 + 1 to -2**16 at unit and half-unit
intervals, but it doesn't blow up
here. Thanks- and I appreciate the quick response.

Geremy Condra

> --
> keywords: +patch
> Added file: http://bugs.python.org/file17654/issue8986.patch
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue8986] math.erfc OverflowError

2010-06-13 Thread geremy condra

geremy condra  added the comment:

On Sun, Jun 13, 2010 at 5:14 AM, Mark Dickinson  wrote:
>
> Mark Dickinson  added the comment:
>
> Thanks for the report.  What platform are you on?  I'm not seeing this 
> behaviour on OS X:

I'm on Ubuntu 10.04 64-bit.

Geremy Condra

> Python 3.2a0 (py3k:81935M, Jun 12 2010, 10:01:38)
> [GCC 4.2.1 (Apple Inc. build 5659)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
 from math import erfc
 erfc(-28.0)
> 2.0
>
> It should be easy to fix, since erfc is already 2.0 (to within machine 
> accuracy) in that argument range, but I'd like to understand where the 
> problem is coming from first.
>
> --
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue8986] math.erfc OverflowError

2010-06-13 Thread Mark Dickinson

Mark Dickinson  added the comment:

Geremy, can you verify that the attached patch fixes the problem?  If so, I'll 
add tests and commit.

--
keywords: +patch
Added file: http://bugs.python.org/file17654/issue8986.patch

___
Python tracker 

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



[issue8986] math.erfc OverflowError

2010-06-13 Thread Mark Dickinson

Mark Dickinson  added the comment:

Looking at the source, I think I know where this is coming from:  one of the 
terms in the expression for erfc(x) is exp(-x*x).  For abs(x) >= 27.284 or so, 
this underflows to zero.

So the likely cause is that whatever platform you're on is setting errno to 
ERANGE on underflow to 0;  that errno value later gets interpreted as 
representing an overflow.

And for x >= 30.0 a constant expression is used instead, so there's no 
OverflowError any more.

Okay:  solved in principle!

--

___
Python tracker 

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



[issue8986] math.erfc OverflowError

2010-06-13 Thread Mark Dickinson

Changes by Mark Dickinson :


--
versions: +Python 2.7

___
Python tracker 

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



[issue8986] math.erfc OverflowError

2010-06-13 Thread Mark Dickinson

Mark Dickinson  added the comment:

Thanks for the report.  What platform are you on?  I'm not seeing this 
behaviour on OS X:

Python 3.2a0 (py3k:81935M, Jun 12 2010, 10:01:38) 
[GCC 4.2.1 (Apple Inc. build 5659)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from math import erfc
>>> erfc(-28.0)
2.0

It should be easy to fix, since erfc is already 2.0 (to within machine 
accuracy) in that argument range, but I'd like to understand where the problem 
is coming from first.

--

___
Python tracker 

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



[issue8986] math.erfc OverflowError

2010-06-13 Thread Mark Dickinson

Changes by Mark Dickinson :


--
assignee:  -> mark.dickinson

___
Python tracker 

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



[issue8911] regrtest.main should have a test skipping argument

2010-06-13 Thread Ezio Melotti

Changes by Ezio Melotti :


--
nosy: +ezio.melotti, flox
stage:  -> needs patch
type:  -> behavior

___
Python tracker 

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



[issue8940] *HTTPServer need a summary page with API inheritance table

2010-06-13 Thread Ezio Melotti

Ezio Melotti  added the comment:

Can you provide a patch?

--
nosy: +ezio.melotti
stage:  -> needs patch

___
Python tracker 

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



[issue8957] strptime('%c', ..) fails to parse output of strftime('%c', ..) in non-English locale

2010-06-13 Thread Ezio Melotti

Changes by Ezio Melotti :


--
nosy: +ezio.melotti

___
Python tracker 

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



[issue8887] “pydoc str” works but not “ pydoc str.translate”

2010-06-13 Thread Ezio Melotti

Changes by Ezio Melotti :


--
nosy: +ezio.melotti

___
Python tracker 

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



[issue8986] math.erfc OverflowError

2010-06-13 Thread Ezio Melotti

Changes by Ezio Melotti :


--
nosy: +mark.dickinson
stage:  -> unit test needed

___
Python tracker 

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



[issue7936] sys.argv contains only scriptname

2010-06-13 Thread Sworddragon

Sworddragon  added the comment:

This registry key contains "E:\Python31\python.exe" "%1" %*. I have too 2 
python versions installed and manually associated the .py files to Python 3.

--

___
Python tracker 

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



[issue8202] sys.argv[0] and python -m package

2010-06-13 Thread Nick Coghlan

Nick Coghlan  added the comment:

Reverted in r81964, marking as 3.2 only.

For 3.2, I'll get rid of the hack by having SetArgV treat both "-c" and "-m" as 
special values for sys.argv[0], and by adding some unit tests that make sure 
the presence of files with those names has no effect on the value of 
sys.path[0] when the corresponding command line switches are used.

--
stage: commit review -> unit test needed
versions:  -Python 2.7

___
Python tracker 

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