[issue11692] subprocess demo functions

2011-03-27 Thread Ross Lagerwall

New submission from Ross Lagerwall rosslagerw...@gmail.com:

Running subprocess as a module invokes some demo functions.

On posix, one of these doesn't work:

$ ./python -m subprocess
Process list:
b'  PID TTY  TIME CMD\n 9003 pts/600:00:00 python\n 9004 pts/6
00:00:00 ps\n23760 pts/600:00:00 bash\n'
Looking for 'hda'...
b''

Trying a weird file...
The file didn't exist.  I thought so...
Child traceback:
Traceback (most recent call last):
  File /home/ross/code/py3kdev/silly/Lib/subprocess.py, line 1757, in 
_demo_posix
print(Popen([/this/path/does/not/exist]).communicate())
  File /home/ross/code/py3kdev/silly/Lib/subprocess.py, line 766, in __init__
restore_signals, start_new_session)
  File /home/ross/code/py3kdev/silly/Lib/subprocess.py, line 1439, in 
_execute_child
raise child_exception_type(errno_num, err_msg)
OSError: [Errno 2] No such file or directory: '/this/path/does/not/exist'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File /home/ross/code/py3kdev/silly/Lib/runpy.py, line 160, in 
_run_module_as_main
__main__, fname, loader, pkg_name)
  File /home/ross/code/py3kdev/silly/Lib/runpy.py, line 73, in _run_code
exec(code, run_globals)
  File /home/ross/code/py3kdev/silly/Lib/subprocess.py, line 1790, in module
_demo_posix()
  File /home/ross/code/py3kdev/silly/Lib/subprocess.py, line 1762, in 
_demo_posix
print(e.child_traceback)
AttributeError: 'OSError' object has no attribute 'child_traceback'


I think these demo functions should be either be removed or incorporated into 
the docs.

--
messages: 132291
nosy: gregory.p.smith, rosslagerwall
priority: normal
severity: normal
status: open
title: subprocess demo functions
type: behavior
versions: Python 3.3

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



[issue7639] bdist_msi fails on files with long names

2011-03-27 Thread Martin v . Löwis

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


Added file: http://bugs.python.org/file21423/msilib2.diff

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



[issue7639] bdist_msi fails on files with long names

2011-03-27 Thread Roundup Robot

Roundup Robot devnull@devnull added the comment:

New changeset e51366a05b84 by Martin v. Löwis in branch '2.7':
Fix short file name generation in bdist_msi.
http://hg.python.org/cpython/rev/e51366a05b84

New changeset fd8336947f90 by Martin v. Löwis in branch '3.1':
Fix short file name generation in bdist_msi.
http://hg.python.org/cpython/rev/fd8336947f90

New changeset c7d0fc181376 by Martin v. Löwis in branch '3.2':
merge #7639
http://hg.python.org/cpython/rev/c7d0fc181376

New changeset a7e0a1dbfbb6 by Martin v. Löwis in branch 'default':
merge #7639
http://hg.python.org/cpython/rev/a7e0a1dbfbb6

--
nosy: +python-dev
resolution:  - fixed
stage: test needed - committed/rejected
status: open - closed

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



[issue11685] possible SQL injection into db APIs via table names... sqlite3

2011-03-27 Thread Rene Dudfield

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

Hi,

aaah, ok.

It seems to require the use of a quote function.  See 
http://www.sqlite.org/c3ref/mprintf.html  

However python does not seem to expose the function?  I don't see how you can 
write safe queries using python without it.

--

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



[issue1128] msilib.Directory.make_short only handles file names with a single dot in them

2011-03-27 Thread Martin v . Löwis

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

This is now fixed with Christoph Gohlke's patch in issue 7639. If anything 
remains to be done, please submit a new issue (rather than posting to this one).

--
resolution:  - fixed
status: open - closed

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



[issue11693] memory leak in email.generator.Generator().flatten() method

2011-03-27 Thread Kaushik Kannan

Changes by Kaushik Kannan kaushik1...@gmail.com:


--
components: IO, Library (Lib)
files: debug_as_string.py
nosy: Kaushik.Kannan, barry, r.david.murray
priority: normal
severity: normal
status: open
title: memory leak in email.generator.Generator().flatten() method
type: resource usage
versions: Python 2.6
Added file: http://bugs.python.org/file21424/debug_as_string.py

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



[issue9929] subprocess.Popen unbuffered not work

2011-03-27 Thread Ross Lagerwall

Ross Lagerwall rosslagerw...@gmail.com added the comment:

Unbuffered subprocess was fixed in 1dc52ecb8949
Closing this as a duplicate of #11459.

--
nosy: +rosslagerwall
resolution:  - duplicate
status: open - closed

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



[issue11284] slow close file descriptors in subprocess, popen2, os.popen*

2011-03-27 Thread Ross Lagerwall

Ross Lagerwall rosslagerw...@gmail.com added the comment:

Closing this as a duplicate of #8052

--
nosy: +rosslagerwall
resolution:  - duplicate
status: open - closed

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



[issue8052] subprocess close_fds behavior should only close open fds

2011-03-27 Thread Ross Lagerwall

Ross Lagerwall rosslagerw...@gmail.com added the comment:

See #11284 (a duplicate) for more discussion about this issue.

--
nosy: +haypo, loewis, neologix, s7v7nislands

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



[issue8006] os.popen in Python 3.1

2011-03-27 Thread Ross Lagerwall

Ross Lagerwall rosslagerw...@gmail.com added the comment:

Closing as invalid - believed to be a buffering issue.

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

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



[issue11393] Integrate faulthandler module into Python 3.3

2011-03-27 Thread Antoine Pitrou

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

 I updated the (Hg repo and the) patch to fix all Antoine's remarks.

Can you make the suggested changes to the tests? Thank you.

--

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



[issue11681] -b option undocumented

2011-03-27 Thread Nick Coghlan

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

Even from __future__ import unicode_literals doesn't make it do anything.

Perhaps Christian merged it by mistake in [5341b30b1812]?

--
nosy: +ncoghlan

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



[issue7639] bdist_msi fails on files with long names

2011-03-27 Thread Mark Mc Mahon

Mark Mc Mahon mtnbikingm...@gmail.com added the comment:

Following up from my comment in issue1128, please find the patch 
msilib.make_id_fix_and_tests.patch

This improves the make_id() function in the following way:
 - ensures that NO invalid identifier characters make it through (it does this 
by only including good characters rather than filtering out some bad 
characters). The list of bad characters is immense (most unicode characters!) 
while the list of acceptable characters is limited.

This also adds some tests.

--
nosy: +markm -python-dev
Added file: http://bugs.python.org/file21425/msilib.make_id_fix_and_tests.patch

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



[issue9696] xdrlib's pack_int generates DeprecationWarnings for negative in-range values

2011-03-27 Thread Filip Gruszczyński

Filip Gruszczyński grusz...@gmail.com added the comment:

Here is a test and a patch.

--
keywords: +patch
nosy: +gruszczy
Added file: http://bugs.python.org/file21426/9696.patch

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



[issue8052] subprocess close_fds behavior should only close open fds

2011-03-27 Thread STINNER Victor

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

Can we use FD_CLOEXEC to archive this goal? Example: open all files with 
FD_CLOEXEC set and don't close explicitly files on fork. preexec_fn will get 
access to the files, but the problem is exec(), not preexec_fn.

I suppose that it will slow down programs not using subprocess, and it may have 
border effects.

--

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



[issue11393] Integrate faulthandler module into Python 3.3

2011-03-27 Thread Antoine Pitrou

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

I have pushed a new branch faulthandler-thread in 
http://hg.python.org/features/faulthandler/. It contains an implementation of 
dump_tracebacks_later() using a watchdog thread, instead of alarm().

It has two advantages:
- it works under Windows
- it won't disrupt use of alarm() or SIGALRM by user code (including the test 
suite)

It has one drawback: you can only display all threads, since the watchdog 
thread is not a Python thread.

I haven't fixed the tests for it, I'm waiting for Victor's changes first ;)

--

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



[issue7639] bdist_msi fails on files with long names

2011-03-27 Thread Mark Mc Mahon

Mark Mc Mahon mtnbikingm...@gmail.com added the comment:

For Directory.make_short() the only things which are left could be considered 
splitting hairs.

1. Do we need to remove '\/:' from the file name - if these characters are 
there then the file name is not valid in the first place.

2. These characters '+,;=[]' should really be changed to '_' if we want to 
match more closely how Windows makes short names.

I can write a patch for the above if they should be fixed and either way I can 
add tests for this function. (the test I had for testing my own patch - almost 
completely pass - but the only failure was depending on point 2.)

--

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



[issue9544] xdrlib.Packer().pack_fstring throws a TypeError when called with a str()

2011-03-27 Thread Filip Gruszczyński

Filip Gruszczyński grusz...@gmail.com added the comment:

Here is a simple patch with a test. Depending o bytes in this library seems 
strange, maybe it should be changed somehow? Anyway, this simple patch should 
be a quick fix to the problem.

--
keywords: +patch
nosy: +gruszczy
Added file: http://bugs.python.org/file21427/9544.patch

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



[issue8052] subprocess close_fds behavior should only close open fds

2011-03-27 Thread Charles-Francois Natali

Charles-Francois Natali neolo...@free.fr added the comment:

If you're suggesting to set FDs CLOEXEC by default, I think it's neither 
possible nor reasonable:
- you have to take into account not only files, but also pipes, sockets, etc
- there's no portable way to e.g. open a file and set it CLOEXEC atomically
- first and foremost, it' going to break a lot of existing code, for example, 
pipe + fork, accept + fork, etc
As for the dedicated syscalls, there's already been some discussion about 
closefrom and friends, but Gregory did some research and it looked like those 
are not async-safe - which, if it's really the case, renders those calls mostly 
useless.

--

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



[issue8052] subprocess close_fds behavior should only close open fds

2011-03-27 Thread Charles-Francois Natali

Charles-Francois Natali neolo...@free.fr added the comment:

Ooops, it's of course not going to break code containing accept + fork or pipe 
+ fork, you obviously also need an execve ;-)
But the point is that you can't change the semantics of FDs being inheritable 
across an execve (think about inetd for example).

--

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



[issue11694] xdrlib raises ConversionError in inconsistent way

2011-03-27 Thread Filip Gruszczyński

New submission from Filip Gruszczyński grusz...@gmail.com:

xdrlib defines ConversionError, but very seldom uses it. For example:

def pack_float(self, x):
try: self.__buf.write(struct.pack('f', x))
except struct.error as msg:
raise ConversionError(msg)

But it doesn't do so here:

def pack_uint(self, x):
self.__buf.write(struct.pack('L', x))

Shouldn't that be more consistent?

I am happy to write a patch, that will make xdrlib raise ConversionError, as 
well as write proper test (I believe xdrlib tests should get some love 
altogether, so I would add a separate test case for this).

--
components: Library (Lib)
messages: 132309
nosy: gruszczy
priority: normal
severity: normal
status: open
title: xdrlib raises ConversionError in inconsistent way
type: behavior
versions: Python 3.3

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



[issue11549] Rewrite peephole to work on AST

2011-03-27 Thread Nick Coghlan

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

Finally got around to reviewing this (just a visual scan at this stage) - 
thanks for the effort. These are mostly big picture type comments, so I'm 
keeping them here rather than burying them amongst all the details in the code 
review tool.

The effect that collapsing Num/Str/Bytes into a single Lit node type has on 
ast.literal_eval bothered me initially, but looking more closely, I think those 
changes will actually improve the function (string concatenation will now work, 
and errors like 'hello' - 'world' should give a more informative TypeError). 
(Bikeshed: We use Attribute rather than Attr for that node type, perhaps the 
full Literal name would be better, too)

Lib/test/disutil.py should really be made a feature of the dis module itself, 
by creating an inner disassembly function that returns a string, then making 
the existing dis and disassembly functions print that string (i.e. similar 
to what I already did in making dis.show_code() a thin wrapper around the new 
dis.code_info() function in 3.2). In the absence of a better name, dis_to_str 
would do.

Since the disassembly is interpreter specific, the new disassembly tests really 
shouldn't go directly in test_compile.py. A separate test_ast_optimiser file 
would be easier for alternate implementations to skip over. A less fragile 
testing strategy may also be to use the ast.PyCF_ONLY_AST flag and check the 
generated AST rather than the generated bytecode.

I'd like to see a written explanation for the first few changes in 
test_peepholer.py. Are those cases no longer optimised? Are they optimised 
differently? Why did these test cases have to change? (The later changes in 
that file look OK, since they seem to just be updating tests to handle the more 
comprehensive optimisation)

When you get around to rebasing the patch on 3.3 trunk, don't forget to drop 
any unneeded from __future__ imports.

The generated code for the Lit node type looks wrong: it sets v to Py_None, 
then immediately checks to see if v is NULL again.

Don't use string as a C type - use char * (and char ** instead of string 
*).

There should be a new compiler flag to skip the AST optimisation step.

A bunch of the compiler internal changes seem to make the basic flow of the 
generated assembly not match the incoming source code. It doesn't seem like a 
good idea to conflate these with the AST optimisation patch. If that means 
leaving the peepholer in to handle them for now, that's OK - it's fine to just 
descope the peepholer without removing it entirely.

--

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



[issue11677] make test has horrendous performance on an ecryptfs

2011-03-27 Thread Antoine Pitrou

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

One strong reason for having the test files in the build directory is ease of 
cleanup, especially on the buildbots where crashes or hangs can lead to 
progressive disk fillup (and some tests create very large files, e.g. 2GB).

See also 673a5afce4e0.

--
nosy: +pitrou

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



[issue887237] Machine integers

2011-03-27 Thread Daniel Urban

Changes by Daniel Urban urban.dani...@gmail.com:


--
nosy: +durban

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



[issue11549] Rewrite peephole to work on AST

2011-03-27 Thread Nick Coghlan

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

I think the biggest thing to take out of my review is that I strongly encourage 
deferring the changes for 5(b) and 5(c).

I like the basic idea of using a template-based approach to try to get rid of a 
lot of the boilerplate code currently needed for AST visitors.

Providing a hook for optimisation in Python (as Dave Malcolm's approach does) 
is valuable as well, but I don't think the two ideas need to be mutually 
exclusive.

As a more general policy question... where do we stand in regards to backwards 
compatibility of the AST? The ast module docs don't have any caveats to say 
that it may change between versions, but it obviously *can* change due to new 
language constructs (if nothing else).

--

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



[issue11549] Rewrite peephole to work on AST

2011-03-27 Thread Antoine Pitrou

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

 As a more general policy question... where do we stand in regards to
 backwards compatibility of the AST? The ast module docs don't have any
 caveats to say that it may change between versions, but it obviously
 *can* change due to new language constructs (if nothing else).

Yes, but can existing constructs produce a different structure from one
Python version to another?
It seems to me that the ast module is the recommended way to inspect the
structure of Python code (much more so that bytecode or concrete syntax
trees). Perhaps the optimizations can leave the initial ast intact?
Perhaps with an additional API to get the optimized ast as well?

--

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



[issue11549] Rewrite peephole to work on AST

2011-03-27 Thread Georg Brandl

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

I would provide this via another compile flag a la PyCF_ONLY_AST.  If you give 
only this flag, you get the original AST.  If you give (e.g.)
PyCF_OPTIMIZED_AST, you get the resulting AST after the optimization stage (or 
the same, if optimization has been disabled).

--

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



[issue9026] argparse subcommands not printed in the same order they were added

2011-03-27 Thread Roundup Robot

Roundup Robot devnull@devnull added the comment:

New changeset 74f9ed48ae5d by Steven Bethard in branch '3.2':
Issue #9026: Fix order of argparse sub-commands in help messages.
http://hg.python.org/cpython/rev/74f9ed48ae5d

New changeset de29472c6a84 by Steven Bethard in branch 'default':
Issue #9026: Fix order of argparse sub-commands in help messages. (Merged from 
3.2.)
http://hg.python.org/cpython/rev/de29472c6a84

--
nosy: +python-dev

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



[issue9026] argparse subcommands not printed in the same order they were added

2011-03-27 Thread Roundup Robot

Roundup Robot devnull@devnull added the comment:

New changeset 75ec20b4c50e by Steven Bethard in branch '2.7':
Issue #9026: Fix order of argparse sub-commands in help messages. (Merged from 
3.2.)
http://hg.python.org/cpython/rev/75ec20b4c50e

--

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



[issue9026] argparse subcommands not printed in the same order they were added

2011-03-27 Thread Steven Bethard

Steven Bethard steven.beth...@gmail.com added the comment:

Sorry for letting this bug sit around for so long. I committed a slight variant 
of your patch to 2.7, 3.2 and 3.3. Thanks!

--
resolution:  - fixed
stage: patch review - committed/rejected
status: open - closed
versions: +Python 3.3

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



[issue8052] subprocess close_fds behavior should only close open fds

2011-03-27 Thread Ross Lagerwall

Ross Lagerwall rosslagerw...@gmail.com added the comment:

I don't think setting the cloexec flag is a viable solution, especially since 
fds can be opened in custom c modules.

For what its worth, an strace of Java's Process class appears to cheat by 
opening /proc/self/fd inbetween fork  exec.

--

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



[issue1446619] extended slice behavior inconsistent with docs

2011-03-27 Thread Steven Bethard

Steven Bethard steven.beth...@gmail.com added the comment:

The problem still exists in current trunk:

The slicing semantics have been removed from the expressions reference:
http://docs.python.org/py3k/reference/expressions.html#slicings

The datamodel and types sections still have the same equations:
http://docs.python.org/py3k/reference/datamodel.html#types
http://docs.python.org/py3k/library/stdtypes.html#typesseq

Here's a synopsis of the problem, in code:

 # positive step, works as described
 i, j, k = 2, 8, 2
 range(10)[i:j:k]
[2, 4, 6]
 [i + n * k for n in range(0, (j - i) / k)]
[2, 4, 6]
 [range(10)[i] for i in _]
[2, 4, 6]

 # negative step, does not work as described
 i, j, k = 10, 0, -2
 range(10)[i:j:k]
[9, 7, 5, 3, 1]
 [i + n * k for n in range(0, (j - i) / k)]
[10, 8, 6, 4, 2]
 [range(10)[i] for i in _]
Traceback (most recent call last):
  File stdin, line 1, in module
IndexError: list index out of range

 # actual behavior trims 10 to 9 (is the same as 9:0:-2)
 # that is, it trims to len(s) - 1, not len(s)
 range(10)[9:0:-2]
[9, 7, 5, 3, 1]

I propose to ignore the definition in the datamodel section, since it's talking 
about extended slicing in general, and doesn't mention anything about negative 
indices.

I propose the attached patch to fix the definition in the types section, which 
simply changes the statement:

  If i or j is greater than len(s), use len(s)

to say:

  If *i* or *j* is greater than len(s), use len(s) if *k* is positive, 
  or len(s) - 1 if *k* is negative.

--
keywords: +patch
versions: +Python 2.7, Python 3.2, Python 3.3 -Python 2.6, Python 3.0
Added file: http://bugs.python.org/file21428/extended_slicing_docs.diff

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



[issue1446619] extended slice behavior inconsistent with docs

2011-03-27 Thread Steven Bethard

Changes by Steven Bethard steven.beth...@gmail.com:


--
stage: test needed - patch review

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



[issue1446619] extended slice behavior inconsistent with docs

2011-03-27 Thread Mark Dickinson

Changes by Mark Dickinson dicki...@gmail.com:


--
nosy: +mark.dickinson

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



[issue1690608] email.utils.formataddr() should be rfc2047 aware

2011-03-27 Thread Torsten Becker

Torsten Becker torsten.bec...@gmail.com added the comment:

I implemented a basic test for the issue and an attempt for a fix.

I am not entirely sure with my implementation, specifically I would like to get 
comments concerning the following points:

  - Is is OK that formataddr() will now check if address is ascii safe and if 
not it will raise a UnicodeEncodeError?
  
  - I was not sure on the style how to append new tests to test_email.py, I 
just put it into the same spot where all the other formataddr() tests where, 
shall I put it to the end instead?


I am submitting this patch as part of my preparation for the Google Summer of 
Code to familiarize myself with the contribution process, any feedback on what 
I should do different is very welcome.

--
keywords: +patch
nosy: +torsten.becker
Added file: http://bugs.python.org/file21429/issue-1690608.patch

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



[issue7311] Bug on regexp of HTMLParser

2011-03-27 Thread Ezio Melotti

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

The HTML 4.01 specifications says[0]:

In certain cases, authors may specify the value of an attribute without any 
quotation marks. The attribute value may only contain letters (a-z and A-Z), 
digits (0-9), hyphens (ASCII decimal 45), periods (ASCII decimal 46), 
underscores (ASCII decimal 95), and colons (ASCII decimal 58). We recommend 
using quotation marks even when it is possible to eliminate them.


The HTML 5 draft says[1]:

The attribute name, followed by zero or more space characters, followed by a 
single U+003D EQUALS SIGN character, followed by zero or more space characters, 
followed by the attribute value, which, in addition to the requirements given 
above for attribute values, must not contain any literal space characters, any 
U+0022 QUOTATION MARK characters (), U+0027 APOSTROPHE characters ('), U+003D 
EQUALS SIGN characters (=), U+003C LESS-THAN SIGN characters (), U+003E 
GREATER-THAN SIGN characters (), or U+0060 GRAVE ACCENT characters (`), and 
must not be the empty string.


So maybe [^\s] is a little too permissive here.

[0]: http://www.w3.org/TR/html4/intro/sgmltut.html#h-3.2.2
[1]: http://dev.w3.org/html5/spec/Overview.html#attributes-0

--

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



[issue11695] Improve argparse usage/help customization

2011-03-27 Thread Steven Bethard

New submission from Steven Bethard steven.beth...@gmail.com:

I'm going to try to merge several closely related issues here. Basically, 
people would like better control over the usage message formatting so that you 
could:

* Put program name and version information at the top of the message
* Customize the usage: string (e.g. capitalize it)

One proposal from anatoly techtonik would be to allow a format string so that 
you could write something like

My Program, version 3.5
Usage: %(usage)s

Some description of my program

%(argument_groups)%

My epliog text


This should be implemented as a HelpFormatter class, but we might have to 
expose a little more of the HelpFormatter API (which is currently documented as 
a no-public API) to make this possible.

Patches welcome. ;-)

--
components: Library (Lib)
messages: 132322
nosy: bethard
priority: normal
severity: normal
stage: needs patch
status: open
title: Improve argparse usage/help customization
type: feature request
versions: Python 3.3

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



[issue11692] subprocess demo functions

2011-03-27 Thread Antoine Pitrou

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

 I think these demo functions should be either be removed or
 incorporated into the docs.

+1 for either of that.

--
nosy: +pitrou

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



[issue7284] argparse - display version in usage by default

2011-03-27 Thread Steven Bethard

Steven Bethard steven.beth...@gmail.com added the comment:

I'm moving this over to Issue 11695, which proposes support for a usage/help 
message template.

--
resolution:  - duplicate
stage:  - committed/rejected
status: open - closed
superseder:  - Improve argparse usage/help customization

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



[issue9652] Enhance argparse help output customizability

2011-03-27 Thread Steven Bethard

Steven Bethard steven.beth...@gmail.com added the comment:

I'm moving this over to Issue 11695, which proposes support for a usage/help 
message template.

To customize the argument group names, the recommended approach is to create 
your own argument groups, and only put arguments there, e.g.:

parser = argparse.ArgumentParser(add_help=False)
flags = parser.add_argument_group('My Optional Arguments')
flags.add_argument('-h', '--help', action='help')
flags.add_argument('-v', action='version', version='1.3')

Then you'll get just the My Optional Arguments heading.

--
resolution:  - duplicate
stage: test needed - committed/rejected
status: open - closed
superseder:  - Improve argparse usage/help customization

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



[issue7443] test.support.unlink issue on Windows platform

2011-03-27 Thread Antoine Pitrou

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

FWIW, Mercurial uses the following dance:
http://selenic.com/repo/hg/file/463aca32a937/mercurial/windows.py#l296

(Mercurial is under the GPL, so we can't copy that code verbatim; but it can 
serve as an inspiration)

--
nosy: +pitrou

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



[issue9694] argparse: Default Help Message Lists Required Args As Optional

2011-03-27 Thread Steven Bethard

Steven Bethard steven.beth...@gmail.com added the comment:

So it strikes me that there already exists an officially supported way to 
rename your option groups. Just only create your own option groups (never use 
the default ones) and only put arguments there, e.g.:

- temp.py --
parser = argparse.ArgumentParser(description = 'Do something', add_help=False)
flags = parser.add_argument_group('flag arguments')
flags.add_argument('-h', '--help', action='help')
flags.add_argument('--reqarg', '-r', help='This is required', required=True)
flags.add_argument('--optarg','-o', help=This is optional, required=False)
args = parser.parse_args()

$ python temp.py --help
usage: temp.py [-h] --reqarg REQARG [--optarg OPTARG]

Do something

flag arguments:
  -h, --help
  --reqarg REQARG, -r REQARG
This is required
  --optarg OPTARG, -o OPTARG
This is optional


The documentation for action='help' needs to be added, as pointed out in Issue# 
10772.

So basically, the API for customizing group names is already there. So I'm 
changing this to a documentation request - there should be an example in the 
docs showing how to change the default group names as above.

--
assignee:  - docs@python
components: +Documentation -Library (Lib)
nosy: +docs@python
stage:  - needs patch
versions: +Python 3.3 -Python 3.2

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



[issue11692] subprocess demo functions

2011-03-27 Thread Georg Brandl

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

Yeah, +1.  I can't think of anything useful for python -m subprocess to do, 
so let's just get rid of the demos.

--
nosy: +georg.brandl

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



[issue9653] New default argparse output to be added

2011-03-27 Thread Steven Bethard

Steven Bethard steven.beth...@gmail.com added the comment:

I'm moving this over to Issue 11695, which proposes support for a usage/help 
message template.

--
resolution:  - duplicate
stage:  - committed/rejected
status: open - closed
superseder:  - Improve argparse usage/help customization

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



[issue7443] test.support.unlink issue on Windows platform

2011-03-27 Thread Tim Golden

Tim Golden m...@timgolden.me.uk added the comment:

For clarity, while making unlink more robust is no bad thing, the error occurs 
when the unlink *succeeds* but a subsequent create of the same name fails. This 
happens when an indexer, Virus scanner or TortoiseSvn etc. has opened the file 
with SHARE_DELETE. This allows a DeleteFile to succeed but continues to hold an 
open handle on the file. A following test which uses an identically named file 
(such as the global TESTFN) will fail if not enough time has elapsed for the 
background process to release its handle. A good candidate to see this in 
action is the test for tarfile.

I did start to undertake a conversion of TESTFN to a named temporary, but it 
started to sprawl all over the place and came up against a number of corner 
cases (eg where tests deliberately wanted two filenames to be the same) so I 
gave up.

--

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



[issue1690608] email.utils.formataddr() should be rfc2047 aware

2011-03-27 Thread R. David Murray

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

The general approach of the patch looks good to me.  Since formataddr is 
designed to be called from user code that is constructing a message, having it 
raise for non-ascii in the address is probably OK.  However, there should be a 
test for that, and I'm curious to know what happens if you use such an address 
in an address field in the unmodified email package.

Instead of directly calling bencode, you should use the charset module and its 
header_encode method.  Note that you need to turn the charset into a Charset 
instance first.  The advantage of doing this is that it will choose the best 
encoding to use based on the charset and the contents of the string.

Your choice of location for the new tests is fine; TestMiscelaneous really 
should be split up a bit, but that will wait until I do a general refactoring 
of the tests.

Thanks for working on this.

--

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



[issue11688] SQLite trace callback

2011-03-27 Thread Antoine Pitrou

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

Thanks for the patch.

A couple of comments:
- this is a new feature, so can only go in in 3.x: no need to post a 2.7 patch 
(unless this helps Gerhard for his standalone project)
- you need to document the new API in Doc/library/sqlite3.rst

About the patch: looks mostly good!

+self.assertTrue([x for x in traced_statements if x.find(create table 
foo) != -1])

This looks a bit complicated, why not something like
`any(create table foo in x for x in traced_statements)`?

(`y in x` is simper and more readable than `x.find(y) != -1`)


+sqlite3_trace(self-db, _trace_callback, trace_callback);
+if (PyDict_SetItem(self-function_pinboard, trace_callback, Py_None) 
== -1)
+return NULL;

Shouldn't sqlite3_trace() be called only after PyDict_SetItem() succeeds?

--
nosy: +pitrou
stage:  - patch review
versions:  -Python 2.7

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



[issue7443] test.support.unlink issue on Windows platform

2011-03-27 Thread Antoine Pitrou

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

 I did start to undertake a conversion of TESTFN to a named temporary,
 but it started to sprawl all over the place and came up against a
 number of corner cases (eg where tests deliberately wanted two
 filenames to be the same) so I gave up.

How about renaming to a unique random name just before the unlink(), as
Mercurial does?
Would it alleviate the problem or am I missing something?

--

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



[issue9696] xdrlib's pack_int generates DeprecationWarnings for negative in-range values

2011-03-27 Thread Mark Dickinson

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

Patch looks good to me.  Thanks!

--
assignee:  - mark.dickinson

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



[issue9696] xdrlib's pack_int generates DeprecationWarnings for negative in-range values

2011-03-27 Thread Roundup Robot

Roundup Robot devnull@devnull added the comment:

New changeset d3f9a6d7f6e4 by Mark Dickinson in branch '2.7':
Issue #9696: Fix exception incorrectly raised by xdrlib.Packer.pack_int when 
trying to pack a negative (in-range) integer.
http://hg.python.org/cpython/rev/d3f9a6d7f6e4

--
nosy: +python-dev

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



[issue11696] msilib.make_id() is not safe for non ASCII characters.

2011-03-27 Thread Mark Mc Mahon

New submission from Mark Mc Mahon mtnbikingm...@gmail.com:

msilib.make_id() currently ensure that any of the following characters are not 
in the resulting ID:  -+~;

Per the Microsoft documentation the following list of characters are allowed.
http://msdn.microsoft.com/en-us/library/aa369212(v=vs.85).aspx
The Identifier data type is a text string. Identifiers may contain the
ASCII characters A-Z (a-z), digits, underscores (_), or periods (.). However, 
every identifier must begin with either a letter or an underscore.

If an file name contains any characters outside of the characters  -+~; + 
string.ascii_letters + string.digits + ._ then it will be an invalid ID.

This includes many punctuation characters which are valid in file names but not 
ID's, and every unicode character which does not overlap with ASCII.

The attached patch tries to fix this - and it includes tests.

--
components: Windows
files: msilib.make_id_fix_and_tests2.patch
keywords: patch
messages: 132336
nosy: markm
priority: normal
severity: normal
status: open
title: msilib.make_id() is not safe for non ASCII characters.
versions: Python 3.2
Added file: http://bugs.python.org/file21430/msilib.make_id_fix_and_tests2.patch

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



[issue9696] xdrlib's pack_int generates DeprecationWarnings for negative in-range values

2011-03-27 Thread Filip Gruszczyński

Filip Gruszczyński grusz...@gmail.com added the comment:

I believe this should be applied also against 3.3. I was working on this using 
3.3 code base, so it is not working there too.

--

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



[issue11677] make test has horrendous performance on an ecryptfs

2011-03-27 Thread Barry A. Warsaw

Barry A. Warsaw ba...@python.org added the comment:

Makes sense.  So, what do you think about adding a --usetmp/-p flag to regrtest 
to honor mkdtemp's defaults even in a build dir?  I'd add an atexit handler to 
clean it up but of course if it crashes and you've used the flag, you should 
know enough to be able to manually clean things up.

--

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



[issue11692] subprocess demo functions

2011-03-27 Thread Roundup Robot

Roundup Robot devnull@devnull added the comment:

New changeset cae30f34bd16 by Ross Lagerwall in branch 'default':
Issue #11692: Remove unnecessary demo functions in subprocess module.
http://hg.python.org/cpython/rev/cae30f34bd16

--
nosy: +python-dev

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



[issue9696] xdrlib's pack_int generates DeprecationWarnings for negative in-range values

2011-03-27 Thread Mark Dickinson

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

Patience!  I'm getting there...

--

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



[issue11692] subprocess demo functions

2011-03-27 Thread Ross Lagerwall

Ross Lagerwall rosslagerw...@gmail.com added the comment:

OK, I simply removed the functions.

--
assignee:  - rosslagerwall
resolution:  - fixed
stage:  - committed/rejected
status: open - closed

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



[issue9696] xdrlib's pack_int generates DeprecationWarnings for negative in-range values

2011-03-27 Thread Filip Gruszczyński

Filip Gruszczyński grusz...@gmail.com added the comment:

I'm sorry, I wasn't hurrying you. Just wanted to make sure you know.

--

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



[issue11677] make test has horrendous performance on an ecryptfs

2011-03-27 Thread Antoine Pitrou

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

 Makes sense.  So, what do you think about adding a --usetmp/-p flag to
 regrtest to honor mkdtemp's defaults even in a build dir?  I'd add an
 atexit handler to clean it up but of course if it crashes and you've
 used the flag, you should know enough to be able to manually clean
 things up.

Sounds good. It will also help performance on my Windows VM :)

Bikeshedding: since it won't be a widely-used option, perhaps -P is
better than -p?

Not-so-much-bikeshedding: mkdtemp() could be used inside a (e.g.)
/tmp/test_python top dir, to make manual cleanup extra easy.

--

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



[issue9696] xdrlib's pack_int generates DeprecationWarnings for negative in-range values

2011-03-27 Thread Roundup Robot

Roundup Robot devnull@devnull added the comment:

New changeset bd5e821f201c by Mark Dickinson in branch '3.1':
Issue #9696: Fix exception incorrectly raised by xdrlib.Packer.pack_int when 
trying to pack a negative (in-range) integer.
http://hg.python.org/cpython/rev/bd5e821f201c

New changeset 391b2ddbc1b7 by Mark Dickinson in branch '3.2':
Merge #9696
http://hg.python.org/cpython/rev/391b2ddbc1b7

New changeset d9b64a86d5a7 by Mark Dickinson in branch 'default':
Merge #9696
http://hg.python.org/cpython/rev/d9b64a86d5a7

--

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



[issue9696] xdrlib's pack_int generates DeprecationWarnings for negative in-range values

2011-03-27 Thread Mark Dickinson

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

 I'm sorry, I wasn't hurrying you. Just wanted to make sure you know.

No problem :-).  Thanks for the fix!

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

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



[issue11549] Rewrite peephole to work on AST

2011-03-27 Thread Eugene Toder

Eugene Toder elto...@gmail.com added the comment:

Thanks.

 string concatenation will now work, and errors like 'hello' - 'world'
 should give a more informative TypeError
Yes, 'x'*5 works too.

 Bikeshed: We use Attribute rather than Attr for that node type,
 perhaps the full Literal name would be better
Lit seemed more in line with Num, Str, BinOp etc. No reason it can't be 
changed, of course.

 Lib/test/disutil.py should really be made a feature of the dis module
 itself
Agreed, but I didn't want to widen the scope of the patch. If this is something 
that can be reviewed quickly, I can make a change to dis. I'd add a 
keyword-only arg to dis and disassembly -- an output stream defaulting to 
stdout. dis_to_str then passes StringIO and returns the string. Sounds OK?

 Since the disassembly is interpreter specific, the new disassembly
 tests really shouldn't go directly in test_compile.py. A separate
 test_ast_optimiser file would be easier for alternate
 implementations to skip over.
New tests in test_compiler are not for the AST pass, but for changes to 
compile.c. I can split them out, how about test_compiler_opts?

 I'd like to see a written explanation for the first few changes in
 test_peepholer.py
Sure.
1) not x == 2 can be theoretically optimized to x != 2, while this test is for 
another optimization. not x is more robust.
2) Expression statement which is just a literal doesn't produce any code at 
all. This is now true for None/True/False as well. To preserve constants in the 
output I've put them in tuples.

 When you get around to rebasing the patch on 3.3 trunk, don't forget
 to drop any unneeded from __future__ imports.
If you're referring to asdl_ct.py, that's actually an interesting question. 
asdl_ct.py is run by system installed python2, for obvious reasons. What is the 
policy here -- what is the minimum version of system python that should be 
sufficient to build python3? I tested my code on 2.6 and 3.1, and with 
__future__ it should work on 2.5 as well. Is this OK or should I drop 'with' so 
it runs on 2.4?

 The generated code for the Lit node type looks wrong: it sets v to
 Py_None, then immediately checks to see if v is NULL again.
Right, comment in asdl_c.py says:
# XXX: special hack for Lit. Lit value can be None and it
#  should be stored as Py_None, not as NULL.
If there's a general agreement on Lit I can certainly clean this up.

 Don't use string as a C type - use char * (and char ** instead
 of string *).
string is a typedef for PyObject that ASDL uses. I don't think I have a choice 
to not use it. Can you point to a specific place where char* could be used?

 There should be a new compiler flag to skip the AST optimisation step.
There's already an 'optimizations level' flag. Maybe we should make it more 
meaningful rather than multiplying the number of flags?

 A bunch of the compiler internal changes seem to make the basic flow
 of the generated assembly not match the incoming source code.
Can you give an example of what you mean?
The changes are basically 1) standard way of handling conditions in simple 
compilers 2) peephole.

 It doesn't seem like a good idea to conflate these with the AST
 optimisation patch. If that means leaving the peepholer in to handle
 them for now, that's OK - it's fine to just descope the peepholer
 without removing it entirely.
The reason why I think it makes sense to have this in a single change is 
testing. This allows to reuse all existing peephole tests. If I leave old 
peephole enabled there's no way to tell if my pass did something from 
disassembly. I can port tests to AST, but that seemed like more work than match 
old peepholer optimizations.
Is there any opposition to doing simple optimizations on compiler structures? 
They seem a good fit for the job. In fact, if not for stack representation, I'd 
say that they are better IR for optimizer than AST.

Also, can I get your opinion on making None/True/False into literals early on 
and getting rid of forbidden_name?

Antoine, Georg -- I think Nick's question is not about AST changing after 
optimizations (this can indeed be a separate flag), but the structure of AST 
changing. E.g. collapsing of Num/Str/Bytes into Lit.

Btw, if this is acceptable I'd make a couple more changes to make scope 
structure obvious from AST. This will allow auto-generating much of the 
symtable pass.

--

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



[issue8976] subprocess module causes segmentation fault

2011-03-27 Thread Ross Lagerwall

Ross Lagerwall rosslagerw...@gmail.com added the comment:

Without more information and a way of reproducing on a recent version of 
Python, this can't progress. Closing as works for me.

--
nosy: +rosslagerwall
resolution:  - works for me
status: open - closed

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



[issue11696] msilib.make_id() is not safe for non ASCII characters.

2011-03-27 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


--
nosy: +loewis

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



[issue11549] Rewrite peephole to work on AST

2011-03-27 Thread Eugene Toder

Eugene Toder elto...@gmail.com added the comment:

 and with __future__ it should work on 2.5 as well.
Actually, seems that at least str.format is not in 2.5 as well. Still the 
question is should I make it run on 2.5 or 2.4 or is 2.6 OK (then __future__ 
can be removed).

--

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



[issue11549] Rewrite peephole to work on AST

2011-03-27 Thread Daniel Urban

Daniel Urban urban.dani...@gmail.com added the comment:

 not x == 2 can be theoretically optimized to x != 2, ...

I don't think it can:

 class X:
... def __eq__(self, other):
... return True
... def __ne__(self, other):
... return True
... 
 x = X()
 
 not x == 2
False
 x != 2
True


--

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



[issue11549] Rewrite peephole to work on AST

2011-03-27 Thread Eugene Toder

Eugene Toder elto...@gmail.com added the comment:

 I don't think it can:
That already doesn't work in dict and set (eq not consistent with hash), I 
don't think it's a big problem if that stops working in some other cases. 
Anyway, I said theoretically -- maybe after some conservative type inference.

--

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



[issue1690608] email.utils.formataddr() should be rfc2047 aware

2011-03-27 Thread Torsten Becker

Torsten Becker torsten.bec...@gmail.com added the comment:

 However, there should be a test for that, and I'm curious to know what 
 happens if you use such an address in an address field in the unmodified 
 email package.

I added a test to check if the exceptions get thrown when a address is invalid.

I also added a small test to check how a resulting message should look, it 
looks good to me but I am not a specialist with email.  Do you have any other 
ideas how to check if it does not have a negative impact to other parts of the 
module?


 Instead of directly calling bencode, you should use the charset module and 
 its header_encode method.  Note that you need to turn the charset into a 
 Charset instance first.  The advantage of doing this is that it will choose 
 the best encoding to use based on the charset and the contents of the 
 string.

The code also uses email.charset.Charset now.

--
Added file: http://bugs.python.org/file21431/issue-1690608-v2.patch

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



[issue7443] test.support.unlink issue on Windows platform

2011-03-27 Thread Tim Golden

Tim Golden m...@timgolden.me.uk added the comment:

Well http://bugs.python.org/issue7443#msg102833 outlines the problems I 
encountered while trying to do essentially that. Nothing insurmountable, but 
definitely bigger than simply adding one line of code.

Looks to me like there are two avenues of approach (and, given the chatter on 
this issue, several people willing to address them):

* Patch Py_DeleteFileW in posixmodule.c so that it renames before deleting: 
should solve the problem overall but obviously has a possible wider impact, in 
general and on performance in particular. This rename might be a simple 
rename-to-guid or something more sophisticated such as the rename-to-recycler 
which cygwin uses.

* Patch support.unlink in the test package to do the rename dance on the basis 
that it'll fix at least some of the problems with less impact overall.

Opinions? I'm willing to do either.

--

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



[issue11688] SQLite trace callback

2011-03-27 Thread Torsten Landschoff

Torsten Landschoff t.landsch...@gmx.net added the comment:

 A couple of comments:
 - this is a new feature, so can only go in in 3.x: no need to post a 2.7 
 patch (unless this helps Gerhard for his standalone project)

The motivation for the 2.7er patch is mostly that we are still using Python 2.x 
at work and I made this patch for 2.7 first. Actually I will need to backport 
it to 2.6 but I guess there are no differences. And maybe I should have 
submitted this against pysqlite directly which is (AFAICT) also still 
targetting 2.x.

 - you need to document the new API in Doc/library/sqlite3.rst

Sure. I was just filing the report to have the code on file and this was only 
fallout from another patch. I will create an updated patch including 
documentation about the feature.

 About the patch: looks mostly good!

Thanks.

 +self.assertTrue([x for x in traced_statements if x.find(create 
 table foo) != -1])

 This looks a bit complicated, why not something like
 `any(create table foo in x for x in traced_statements)`?

Fine with me. I did not know that bar in foobarbaz works (I was expecting 
it to act as if the right hand string is a list of characters). Obviously I was 
wrong. Further I thought any was new in 2.6 and therefore not suitable for 
use in pysqlite which was also wrong.

 (`y in x` is simper and more readable than `x.find(y) != -1`)

I agree, I just did not know it works for substrings.

 +sqlite3_trace(self-db, _trace_callback, trace_callback);
 +if (PyDict_SetItem(self-function_pinboard, trace_callback, Py_None) 
 == -1)
 +return NULL;

 Shouldn't sqlite3_trace() be called only after PyDict_SetItem() succeeds?

Good catch. If SetItem fails, trace_callback may become invalid and the 
_trace_callback will crash. I did not think about that as I only derived that 
function from similar code in the module. I will have to fix this as well.

--

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



[issue11681] -b option undocumented

2011-03-27 Thread Marc-Andre Lemburg

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

Nick Coghlan wrote:
 
 Nick Coghlan ncogh...@gmail.com added the comment:
 
 Even from __future__ import unicode_literals doesn't make it do anything.
 
 Perhaps Christian merged it by mistake in [5341b30b1812]?

It looks more like some parts were left out in the merge
by accident: The 2.7 code only raises the warning for bytearrays,
not for bytes and buffers, whereas 3.2 issues the warning for
all bytes and bytearray (but not buffers; which makes sense,
since Python 3 no longer has a text buffer interface).

--
nosy: +lemburg

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



[issue8052] subprocess close_fds behavior should only close open fds

2011-03-27 Thread Martin v . Löwis

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

 Can we use FD_CLOEXEC to archive this goal? 

I think we should use FD_CLOEXEC in all places where it's reasonable.
As others have pointed out, we shouldn't set FD_CLOEXEC for file
descriptors where the application hasn't explicitly requested that.

--

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



[issue1690608] email.utils.formataddr() should be rfc2047 aware

2011-03-27 Thread R. David Murray

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

You should check if 'charset' is a string, and call Charset on it only if it is 
(a Charset may be passed directly in other email package interfaces, and so 
should be supported here as well.

The test doesn't need to cater for the fact that either b or B (or q or Q) are 
legitimate: we know which one the package is generating, so just test for that.

For the Message['To'], I wasn't clear.  What I would like is a test that 
includes non-ascii characters in the address part, *without* passing it through 
formataddr, to see what the package currently does with it.  This may in fact 
reveal an additional bug.  But, it is really out of scope for this issue, so 
you can just remove that test (sorry).

There should also be an update to the docs (Doc/library/email.utils.rst) 
documenting the API change.

--

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



[issue11696] msilib.make_id() is not safe for non ASCII characters.

2011-03-27 Thread Roundup Robot

Roundup Robot devnull@devnull added the comment:

New changeset ec84bd4c5ac4 by Martin v. Löwis in branch '2.7':
Closes #11696: Fix ID generation in msilib.
http://hg.python.org/cpython/rev/ec84bd4c5ac4

New changeset df66ce66834b by Martin v. Löwis in branch '2.7':
Add missing file from #11696.
http://hg.python.org/cpython/rev/df66ce66834b

New changeset f3d96d28a86e by Martin v. Löwis in branch '3.1':
Closes #11696: Fix ID generation in msilib.
http://hg.python.org/cpython/rev/f3d96d28a86e

New changeset 4dff2e436191 by Martin v. Löwis in branch '3.2':
merge #11696
http://hg.python.org/cpython/rev/4dff2e436191

New changeset c12e1ea49532 by Martin v. Löwis in branch 'default':
merge #11696
http://hg.python.org/cpython/rev/c12e1ea49532

--
nosy: +python-dev
resolution:  - fixed
stage:  - committed/rejected
status: open - closed

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



[issue11696] msilib.make_id() is not safe for non ASCII characters.

2011-03-27 Thread Martin v . Löwis

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

Thanks for the patch. Please submit a contributor form if you haven't done so:

http://www.python.org/psf/contrib/contrib-form/

--

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



[issue1673007] urllib2 requests history + HEAD support

2011-03-27 Thread Denver Coneybeare

Denver Coneybeare denver.coneybe...@gmail.com added the comment:

I decided to take a look at this old, forgotten issue and propose an updated 
patch.  I like the submitter's idea that urllib.Request.__init__() should take 
a method parameter to override the return value of get_method().  I've 
created and attached a patch (issue1673007_urllib_Request_method_v1.patch) 
which implements this functionality, adds unit tests, and updates the 
documentation.

--
nosy: +denversc
Added file: 
http://bugs.python.org/file21432/issue1673007_urllib_Request_method_v1.patch

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



[issue8150] urllib needs ability to set METHOD for HTTP requests

2011-03-27 Thread Denver Coneybeare

Denver Coneybeare denver.coneybe...@gmail.com added the comment:

Can this issue be closed as a duplicate of #1673007?  This specific request for 
a method parameter to the Request constructor is dealt with there.

--
nosy: +denversc

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



[issue11549] Rewrite peephole to work on AST

2011-03-27 Thread Eugene Toder

Eugene Toder elto...@gmail.com added the comment:

Also, to avoid any confusion -- currently my patch only runs AST optimizations 
before code generation, so compile() with ast.PyCF_ONLY_AST returns 
non-optimized AST.

--

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



[issue11549] Rewrite peephole to work on AST

2011-03-27 Thread Terry J. Reedy

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

While I would not be happy to use class X above, the 3.2 manual explicitly says 
There are no implied relationships among the comparison operators. The truth 
of x==y does not imply that x!=y is false.  .

--

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



[issue7796] No way to find out if an object is an instance of a namedtuple

2011-03-27 Thread Jan Kaliszewski

Jan Kaliszewski z...@chopin.edu.pl added the comment:

On python-ideas I have proposed an ABC being also a kind of a mix-in, 
potentially making namedtuple subclassing (with custom methods etc.) more 
convenient, e.g.:

class MyRecord(namedtuple.abc):
_fields = 'x y z'
def _my_custom_method(self):
return list(self._asdict().items())

or

class MyAbstractRecord(namedtuple.abc):
def _my_custom_method(self):
return list(self._asdict().items())

class AnotherAbstractRecord(MyAbstractRecord):
def __str__(self):
return '{}'.format(super().__str__())
 
class MyRecord2(MyAbstractRecord):
_fields = 'a, b'
 
class MyRecord3(AnotherAbstractRecord):
_fields = 'p', 'q', 'r'

Here is an experimental monkey-patcher adding the 'abc' attribute to namedtuple:

http://dpaste.org/T9w6/

I am not sure if it is worth preparing an actual patch based on it. If you 
think it is I could prepare one.

--
nosy: +zuo

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



[issue11697] Unsigned type in mmap_move_method

2011-03-27 Thread rmib

New submission from rmib rmib.em...@gmail.com:

In mmapmodule.c a function mmap_move_method, use unsigned variables dest, src, 
cnt, as signed:
unsigned long dest, src, cnt;
...
if (cnt 0 | | (cnt + dest) cnt | | (cnt + src) cnt | |
src 0 | | src self- size | | (src + cnt) self- size | |
dest 0 | | dest self- size | | (dest + cnt) self- size)

--
components: Library (Lib)
messages: 132364
nosy: rmib
priority: normal
severity: normal
status: open
title: Unsigned type in mmap_move_method
type: behavior
versions: Python 2.7, Python 3.2

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



[issue1673007] urllib2 requests history + HEAD support

2011-03-27 Thread Santoso Wijaya

Changes by Santoso Wijaya santoso.wij...@gmail.com:


--
nosy: +santa4nt
versions: +Python 3.3 -Python 3.2

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



[issue7796] No way to find out if an object is an instance of a namedtuple

2011-03-27 Thread Jan Kaliszewski

Jan Kaliszewski z...@chopin.edu.pl added the comment:

PS. Newer, shorter version: http://dpaste.org/2aiQ/

--

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



[issue11474] url2pathname() handling of '/C|/' on Windows

2011-03-27 Thread Santoso Wijaya

Changes by Santoso Wijaya santoso.wij...@gmail.com:


Removed file: http://bugs.python.org/file21105/nturl2path.patch

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



[issue11474] url2pathname() handling of '/C|/' on Windows

2011-03-27 Thread Santoso Wijaya

Santoso Wijaya santoso.wij...@gmail.com added the comment:

Fixing patch...

--
Added file: http://bugs.python.org/file21433/nt2urlpath.patch

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



[issue1690608] email.utils.formataddr() should be rfc2047 aware

2011-03-27 Thread Torsten Becker

Torsten Becker torsten.bec...@gmail.com added the comment:

I incorporated the changes as you suggested and added the text to the docs.  
Just out of curiosity, why are the docs repeated in email.util.rst when they 
are already in the docstrings?

--
Added file: http://bugs.python.org/file21434/issue-1690608-v3.patch

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



[issue11632] difflib.unified_diff loses context

2011-03-27 Thread Terry J. Reedy

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

2.6 only gets security fixes now.

--
nosy: +terry.reedy
versions:  -Python 2.6

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



[issue10772] Several actions for argparse arguments missing from docs

2011-03-27 Thread Éric Araujo

Changes by Éric Araujo mer...@netwok.org:


--
keywords: +easy
nosy: +eric.araujo
stage:  - needs patch
versions: +Python 3.3

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



[issue11370] Fix distutils to carry configure's LIBS through to extension modules.

2011-03-27 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

This looks like a real bug that could affect other projects than US, so it 
would be nice to get a test and fix IMO.

--

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



[issue11614] import __hello__ is broken in Python 3

2011-03-27 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

I can see the message (“Hello world...”) in 2.4 to 2.7, but actually not in 3.x.

--

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



[issue11655] map() must not swallow exceptions from PyObject_GetIter

2011-03-27 Thread Terry J. Reedy

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

I agree with Ray. This is essentially a feature request which you say has 
already been implemented in Py 3 but which cannot go into Py2.7. Only fixes for 
bugs (discrepancies between doc and behavior) can go into 2.7. I suspect 2.6 
and before acted the same way.

--
components: +Interpreter Core -None
nosy: +terry.reedy
resolution:  - out of date
status: open - closed
type:  - feature request

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



[issue11698] Improve repr for structseq objects to show named, but unindexed fields

2011-03-27 Thread Raymond Hettinger

New submission from Raymond Hettinger raymond.hettin...@gmail.com:

The current __repr__ for structseq only shows the name/value pairs for the 
positional part and it ignores the other named fields.

For example, os.stat(somefile) returns:
posix.stat_result(st_mode=33277, st_ino=8468407, st_dev=234881026, st_nlink=1, 
st_uid=0, st_gid=80, st_size=25424, st_atime=1301263901, st_mtime=1298229258, 
st_ctime=1298283922)

but it doesn't show the other named fields and their values:
{'st_ctime': 1298283922.0, 'st_rdev': 0, 'st_mtime': 1298229258.0, 'st_blocks': 
56, 'st_flags': 0, 'st_gen': 0, 'st_atime': 1301263901.0, 'st_blksize': 4096, 
'st_birthtime': 1298229258.0}

The __reduce__ method for structseq returns both the tuple portion and the 
dictionary portion.  The latter needs to be added to the repr so that 
information doesn't get hidden from the user.

--
components: Interpreter Core
keywords: easy
messages: 132372
nosy: rhettinger
priority: low
severity: normal
status: open
title: Improve repr for structseq objects to show named, but unindexed fields
type: feature request
versions: Python 3.3

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



[issue11690] Add communication FAQ to devguide

2011-03-27 Thread Éric Araujo

Changes by Éric Araujo mer...@netwok.org:


--
nosy: +brett.cannon, eric.araujo

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



[issue11687] distutils register does not work from the command line

2011-03-27 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

Thanks for reporting the bug.  Could you attach a text file containing a full 
transcript?  If possible, create a small, new setup.py and run that (it will 
enable me to try to reproduce the problem).

Could you give me the links you used?

To create a file starting with a dot, you can use Python (yay!):

with open(os.path.expanduser('~/.pypirc'), 'w') as file:
file.write(
[section]
key = value
)

--
assignee:  - eric.araujo
components: +Distutils -Windows
nosy: +eric.araujo
title: Cannot register using command-line - distutils register does not work 
from the command line

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



[issue11687] distutils register does not work from the command line

2011-03-27 Thread Éric Araujo

Changes by Éric Araujo mer...@netwok.org:


--
nosy: +tarek

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



[issue11685] possible SQL injection into db APIs via table names... sqlite3

2011-03-27 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

Aren’t you supposed to use the DB API to get safe queries?
http://docs.python.org/dev/library/sqlite3

--
nosy: +eric.araujo

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



[issue6498] Py_Main() does not return on SystemExit

2011-03-27 Thread Mark Hammond

Mark Hammond skippy.hamm...@gmail.com added the comment:

Isn't the only problem here that the docs refer to SystemError instead of 
SystemExit - eg 'raise SystemError(foo)' in an interactive session doesn't 
terminate the process at all (and I don't believe it should) whereas SystemExit 
obviously does.

--
nosy: +mhammond

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



[issue11643] Use |version| instead of X.Y in the doc

2011-03-27 Thread Terry J. Reedy

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

If the docs literally use X.Y, so that that can be grepped, then attaching a 
grep result would make this even easier for someone on Windows without grep.

--
nosy: +terry.reedy

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



[issue7796] No way to find out if an object is an instance of a namedtuple

2011-03-27 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

Thanks for working on this.  I have some remarks:

1) Please post diff files here instead of using external sites.  See 
http://docs.python.org/devguide/patch#preparation

2) The license you chose doesn’t allow the PSF to include it into Python, see 
http://www.python.org/psf/contrib/contrib-form/

3) abc looks like a module name, here something like NamedTupleABC or simply 
NamedTuple would be better.  Note that this bug is only about type checking, 
the alternate form of defining named tuples thanks to this ABC is an additional 
feature; Raymond may reject it.

--

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



[issue11643] Use |version| instead of X.Y in the doc

2011-03-27 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

Yes, this was literal.  grep result on 3.1:

c-api/intro.rst:73:path and then use ``#include pythonX.Y/Python.h``; this 
will break on
c-api/intro.rst:534:directory named :file:`lib/python{X.Y}` relative to the 
parent directory
c-api/intro.rst:540::file:`/usr/local/lib/python{X.Y}`.  (In fact, this 
particular path is also
faq/general.rst:356:titled Python X.Y Release Schedule, where X.Y is a 
version that hasn't been
howto/urllib2.rst:156:``Python-urllib/x.y`` (where ``x`` and ``y`` are the 
major and minor version
install/index.rst:240:| Unix (pure) | 
:file:`{prefix}/lib/python{X.Y}/site-packages`  | 
:file:`/usr/local/lib/python{X.Y}/site-packages` | \(1)  |
install/index.rst:242:| Unix (non-pure) | 
:file:`{exec-prefix}/lib/python{X.Y}/site-packages` | 
:file:`/usr/local/lib/python{X.Y}/site-packages` | \(1)  |
install/index.rst:265:Windows, choose :menuselection:`Start -- Programs -- 
Python X.Y --
install/index.rst:386:| pure module distribution | 
:file:`{prefix}/lib/python{X.Y}/site-packages`  | 
:option:`--install-purelib` |
install/index.rst:388:| non-pure module distribution | 
:file:`{exec-prefix}/lib/python{X.Y}/site-packages` | 
:option:`--install-platlib` |
install/index.rst:634:the search path will be set to ``['', 
'/www/python/lib/pythonX.Y/',
install/index.rst:635:'/www/python/lib/pythonX.Y/plat-linux2', ...]``.
library/site.rst:42::file:`/usr/local`.  The Python X.Y library is then 
installed in
library/site.rst:43::file:`/usr/local/lib/python{X.Y}` (where only the first 
three characters of
library/site.rst:45:a subdirectory 
:file:`/usr/local/lib/python{X.Y}/site-packages` with three
library/site.rst:65:   /usr/local/lib/pythonX.Y/site-packages/bar
library/site.rst:66:   /usr/local/lib/pythonX.Y/site-packages/foo
library/pydoc.rst:67:``http://docs.python.org/X.Y/library/`` where ``X`` and 
``Y`` are the
library/logging.rst:442:found for logger X.Y.Z is printed to the console. This 
message is intended
library/logging.rst:464:done using loggers with names matching foo.x.y, then 
the code::
library/stdtypes.rst:2324:'/usr/local/lib/pythonX.Y/os.pyc'``.

There are also things like “python2.3”:
extending/building.rst:97:   gcc -DNDEBUG -g -O3 -Wall -Wstrict-prototypes 
-fPIC -DMAJOR_VERSION=1 -DMINOR_VERSION=0 -I/usr/local/include 
-I/usr/local/include/python2.2 -c demo.c -o build/temp.linux-i686-2.2/demo.o
faq/extending.rst:240::file:`/usr/lib/python2.{x}/config/` directory, which 
contains various files
faq/general.rst:500:   python2.2 pathto/db2pickley.py database.db database.pck
install/index.rst:362:them to go in :file:`/usr/local/lib/python2.{X}` rather 
than
install/index.rst:363::file:`/usr/lib/python2.{X}`.  This can be done with ::
install/index.rst:370:modules in :file:`/usr/local/lib/python2.{X}`, but those 
modules would have to
install/index.rst:371:be installed to, say, 
:file:`/mnt/{@server}/export/lib/python2.{X}`.  This could
install/index.rst:590:   ['', '/usr/local/lib/python2.3', 
'/usr/local/lib/python2.3/plat-linux2',
install/index.rst:591:'/usr/local/lib/python2.3/lib-tk', 
'/usr/local/lib/python2.3/lib-dynload',
install/index.rst:592:'/usr/local/lib/python2.3/site-packages']
install/index.rst:703:   
:file:`{prefix}/lib/python1.5/site-packages/distutils`, so the system
library/sysconfig.rst:243:platlib = 
/usr/local/lib/python3.2/site-packages
library/sysconfig.rst:244:platstdlib = /usr/local/lib/python3.2
library/sysconfig.rst:245:purelib = 
/usr/local/lib/python3.2/site-packages
library/sysconfig.rst:247:stdlib = /usr/local/lib/python3.2
library/re.rst:1115: File /usr/local/lib/python3.2/re.py, line 132, in 
match
tutorial/interpreter.rst:13:The Python interpreter is usually installed as 
:file:`/usr/local/bin/python3.2`
tutorial/interpreter.rst:17:   python3.2
tutorial/interpreter.rst:97:   $ python3.2
tutorial/interpreter.rst:151:   #! /usr/bin/env python3.2

(Please ignore distutils and install docs, they’re frozen except for bugfixes, 
there’s no value in working on them with the replacement coming Really Soon 
Now™.)

Do docs people agree this automation would be something useful?

FYI: https://pypi.python.org/pypi/grin/1.2.1

--

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



[issue9694] argparse: Default Help Message Lists Required Args As Optional

2011-03-27 Thread Éric Araujo

Changes by Éric Araujo mer...@netwok.org:


--
versions: +Python 2.7, Python 3.2

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



  1   2   >