[issue4705] python3.0 -u: unbuffered stdout

2008-12-28 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> pitrou's patch changes PyFile_FromFd() behaviour for a text file 
> opened with buffering=0:
>   /* As a convenience, when buffering == 0 on a text file, we
>  open the underlying binary stream in unbuffered mode and
>  wrap it with a text stream in line-buffered mode. */
> 
> Why changing PyFile_FromFd() and not io.open() directly?

I must admit I'm a bit lazy, and changing io.open() means changing a
fundamental public API, as Guido said on python-dev, so more discussion
and some parts of the patches delayed to 3.1. If someone else wants to
do it, please don't hesitate...

> Note: I prefer Py_UnbufferedStdoutFlag=1 instead of 
> Py_UnbufferedStdoutFlag++ (for -u command line option).

Well, I minimally changed the existing code.

___
Python tracker 

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



[issue4759] bytearray.translate() should support None first argument

2008-12-28 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Looks like there's a problem:

>>> bytearray().translate(None, None)
Traceback (most recent call last):
  File "", line 1, in 
TypeError: Type NoneType doesn't support the buffer API
>>> bytearray().translate(None, None)
Erreur de segmentation

Also, the patch should probably be backported to trunk.

--
versions: +Python 2.7 -Python 3.0

___
Python tracker 

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



[issue4759] bytearray.translate() should support None first argument

2008-12-28 Thread Georg Brandl

Georg Brandl  added the comment:

You're right (but the segfault isn't introduced by the patch).

Fixed segfault in 3.0 and 2.6 in r67975 and r67977.
Applied path in 3k and trunk in r67974 and r67976.

--
assignee: pitrou -> georg.brandl
resolution:  -> accepted
status: open -> closed

___
Python tracker 

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



[issue4489] shutil.rmtree is vulnerable to a symlink attack

2008-12-28 Thread Mart Sõmermaa

Mart Sõmermaa  added the comment:

A shameless copy of the Perl fix for the bug
http://bugs.debian.org/286922 looks like the evident solution.

Somebody has to examine the fix though, I'm afraid I'm not currently
able to do it.

___
Python tracker 

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



[issue4731] suggest change to "Failed to find the necessary bits to build these modules" message

2008-12-28 Thread Georg Brandl

Georg Brandl  added the comment:

Done in r67978.

--
nosy: +georg.brandl
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



[issue4705] python3.0 -u: unbuffered stdout

2008-12-28 Thread STINNER Victor

STINNER Victor  added the comment:

> > Why changing PyFile_FromFd() and not io.open() directly?
>
> I must admit I'm a bit lazy, and changing io.open() means changing 
> a fundamental public API, as Guido said on python-dev, so 
> more discussion and some parts of the patches delayed to 3.1.

You're right, and PyFile_FromFd() is also a fundamental "public" API. 
Since TextIOWrapper doesn't support real unbuffered buffer (only 
pseudo line buffer: unbuffered raw buffer and line buffering for 
TextIOWrapper), I prefer to change only stdout/stderr instead of 
PyFile_FromFd(). 

My new patch only changes initstdio() using pitrou's code.

Should we also change stdin?

Added file: http://bugs.python.org/file12477/unbufferedstdout-2.patch

___
Python tracker 

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



[issue4701] range objects becomes hashable after attribute access

2008-12-28 Thread Nick Coghlan

Nick Coghlan  added the comment:

enumerate can be added to the list of builtin types which isn't
initialised correctly, as can the callable+sentinel iterator return from
the 2-argument version of iter() and the default sequence iterator
returned by iter() when given a type with both __len__ and __getitem__
methods, but no __iter__ method.

___
Python tracker 

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



[issue4701] range objects becomes hashable after attribute access

2008-12-28 Thread Nick Coghlan

Nick Coghlan  added the comment:

Copied from python-dev post:

Perhaps the path of least resistance is to change PyObject_Hash to be
yet another place where PyType_Ready will be called implicitly if it
hasn't been called already?

That approach would get us back to the Python 2.x status quo where
calling PyType_Ready was only absolutely essential if you wanted to
correctly inherit a slot from a type other than object itself.

___
Python tracker 

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



[issue4705] python3.0 -u: unbuffered stdout

2008-12-28 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Le dimanche 28 décembre 2008 à 12:19 +, STINNER Victor a écrit :
> STINNER Victor  added the comment:
> 
> > > Why changing PyFile_FromFd() and not io.open() directly?
> >
> > I must admit I'm a bit lazy, and changing io.open() means changing 
> > a fundamental public API, as Guido said on python-dev, so 
> > more discussion and some parts of the patches delayed to 3.1.
> 
> You're right, and PyFile_FromFd() is also a fundamental "public" API. 

Well, open() is fundamental as in part of the built-ins and used
pervasively. PyFile_FromFd(), on the other hand, is a relic of the 2.x C
file handling API. Let's see what others have to say about this.

> Should we also change stdin?

I don't know, but "python -h" only talks about stderr/stdout.

___
Python tracker 

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



[issue4444] unittest - use contexts to assert exceptions

2008-12-28 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

I've committed an improved patch, with tests and doc, in r67979 and
r67981. Thanks!

--
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



[issue4489] shutil.rmtree is vulnerable to a symlink attack

2008-12-28 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

The Perl patch is here:
http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=36;filename=etch_03_fix_file_path;att=1;bug=286922

It is a recursive implementation of rmtree. What it does is 1) get the
inode of the path 2) unlink it altogether if not a dir 3) otherwise,
chdir to it 4) check that '.' still has the same inode, otherwise bail out.

___
Python tracker 

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



[issue4489] shutil.rmtree is vulnerable to a symlink attack

2008-12-28 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Mmmh, the problem with Perl's approach is that it changes the current
working directory (calls to chdir()), which is process-specific and not
thread-specific. Currently, no function in shutil changes the current
working directory, which is a nice behaviour and should IMO be preserved.

___
Python tracker 

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



[issue4761] create Python wrappers for openat() and others

2008-12-28 Thread Antoine Pitrou

New submission from Antoine Pitrou :

Very recent POSIX versions have introduced a set of functions named
openat(), unlinkat(), etc. (*) which allow to access files relatively to
a directory pointed to by a file descriptor (rather than the
process-wide current working directory). They are necessary to implement
thread-safe directory traversal without any symlink attacks such as in
#4489. Providing Python wrappers for these functions would help creating
higher-level abstractions for secure directory traversal on platforms
that support it.

(*) http://www.opengroup.org/onlinepubs/9699919799/functions/openat.html

“The purpose of the openat() function is to enable opening files in
directories other than the current working directory without exposure to
race conditions. Any part of the path of a file could be changed in
parallel to a call to open(), resulting in unspecified behavior. By
opening a file descriptor for the target directory and using the
openat() function it can be guaranteed that the opened file is located
relative to the desired directory.”

--
components: Extension Modules, Library (Lib)
messages: 78407
nosy: loewis, pitrou
priority: normal
severity: normal
status: open
title: create Python wrappers for openat() and others
type: feature request
versions: Python 2.7, Python 3.1

___
Python tracker 

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



[issue4705] python3.0 -u: unbuffered stdout

2008-12-28 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

It seems the "name" field of the TextIOWrapper object isn't set in
create_stdio() (the "char *name" parameter isn't used). Otherwise, the
patch looks good.

___
Python tracker 

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



[issue1034053] unittest.py patch: add skipped test functionality

2008-12-28 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Pupeno's patch looks good to me. Additional candy would be a decorator
to flag skipped tests (e.g. @skipped_test or @skipped_test("A
message")), but we can do that later.

--
stage:  -> patch review
type:  -> feature request
versions: +Python 2.7, Python 3.1 -Python 2.4, Python 3.0

___
Python tracker 

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



[issue2153] unittest.py modernization

2008-12-28 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Will take a look.

--
versions: +Python 2.7 -Python 2.6

___
Python tracker 

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



[issue4034] traceback attribute error

2008-12-28 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

One possibility would be to only allow deleting the tb_frame attribute
(setting it to NULL), not setting it to an arbitrary object.

--
nosy: +pitrou

___
Python tracker 

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



[issue4060] PyUnicode_DecodeUTF16(..., byteorder=0) gets it wrong on Mac OS X/PowerPC

2008-12-28 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

Applied the patch in r67982.

--
nosy: +benjamin.peterson
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



[issue4728] Endianness and universal builds problems

2008-12-28 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

I applied the patch for #4060 in r67982.

I would still like to know what difference an Intel machine makes in the
installers, though.

--
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



[issue4750] tarfile keeps excessive dir structure in compressed files

2008-12-28 Thread anatoly techtonik

anatoly techtonik  added the comment:

7zip can decompress both, but it still creates "dist/" directory when
decompressing file that is made with Python.

I've noticed this bug with extra path component is actual with "tar" +
"gzip" under windows. If they are executed separately and windows path
with backslashes is used - directory prefix is not stripped. I.e. this
creates archive with invalid header:

{{{
tar -cf dist\create_tar_sep.tar package
gzip -f9 dist\create_tar_sep.tar
}}}

This command is ok:

{{{
tar -cf dist\create_tar_sep.tar package
gzip -f9 dist/create_tar_sep.tar
}}}

___
Python tracker 

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



[issue2153] unittest.py modernization

2008-12-28 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Committed in r67985, thanks!

--
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



[issue4608] urllib.request.urlopen does not return an iterable object

2008-12-28 Thread Jakub Wilk

Jakub Wilk  added the comment:

Regarding Senthil's patch:
__next__() method seems superfluous to me (and the implementation is buggy).

___
Python tracker 

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



[issue4705] python3.0 -u: unbuffered stdout

2008-12-28 Thread STINNER Victor

STINNER Victor  added the comment:

>> Should we also change stdin?
> I don't know, but "python -h" only talks about stderr/stdout.

The manpage of Python2 is clear:

   -u Force stdin, stdout and stderr to be totally unbuffered.

stdin is also unbuffered.

> It seems the "name" field of the TextIOWrapper object isn't 
> set in create_stdio()

It used only used for buffered output. Without the patch, 
sys.stdout.name == sys.stdout.buffer.name == '1' :-/

New patch:
 - use create_stdio() to create unbuffered sys.stdin
 - rename Py_UnbufferedStdoutFlag to Py_UnbufferedStdioFlag
 - replace "Py_UnbufferedStdioFlag++;" by "Py_UnbufferedStdioFlag = 
1;"
 - change create_stdio(): (...)

Note: there is no test for unbuffered input because I don't know how 
to test this (even by manual tests) :-p

Added file: http://bugs.python.org/file12478/unbufferedstdout-3.patch

___
Python tracker 

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



[issue4489] shutil.rmtree is vulnerable to a symlink attack

2008-12-28 Thread Mart Sõmermaa

Mart Sõmermaa  added the comment:

> Mmmh, the problem with Perl's approach is that it changes the current
> working directory (calls to chdir()), which is process-specific and not
> thread-specific. Currently, no function in shutil changes the current
> working directory, which is a nice behaviour and should IMO be preserved.

Using chdir() makes sense and it doesn't look like a too big problem to me:

def rmtree(...):
...
curdir = os.getcwd()
try:
call chdir() as required
finally:
try:
os.chdir(curdir)
except:
warnings.warn("Unable to chdir to previous current dir")
...

___
Python tracker 

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



[issue4762] PyFile_FromFd() doesn't set the file name

2008-12-28 Thread STINNER Victor

New submission from STINNER Victor :

PyFile_FromFd() never changes the name of new created file object:

$ ./python -c "import sys; print(sys.stdout.buffer.name, 
sys.stdout.name)"
0 0

Expected result:  .

---

Binary mode:
 - with buffering == 0, the file object is a FileIO. Changing the name 
can be done with: file._name=new_name
 - with buffering != 0, the file object is a BufferedXXX() and 
file.raw is a FileIO. So we have to set: file.raw._name=new_name

If text mode, the file object is a TextIOWrapper and file.raw is a 
BufferedXXX() (buffering=0 is forbidden for text file). So changing 
the name can be done with: file.raw.raw._name=newname.

I'm not sure of the classes/types.

Note: PyFile_FromFd() shouldn't use PyErr_Clear() if changing the name 
fails.

--
components: None
messages: 78419
nosy: haypo
severity: normal
status: open
title: PyFile_FromFd() doesn't set the file name
type: behavior
versions: Python 3.1

___
Python tracker 

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



[issue4705] python3.0 -u: unbuffered stdout

2008-12-28 Thread STINNER Victor

STINNER Victor  added the comment:

Attached: quick and dirty test to check if the standard input is 
buffered or not. My short test program works with python2.5 and py3k 
trunk without the -u command line option. So changing sys.stdin buffer 
is not really important.

About the wrong name, I opened a separated issue: #4762, 
PyFile_FromFd() doesn't set the file name.

Added file: http://bugs.python.org/file12479/test_stdin.py

___
Python tracker 

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



[issue4762] PyFile_FromFd() doesn't set the file name

2008-12-28 Thread STINNER Victor

STINNER Victor  added the comment:

In my last patch to fix the issue #4705, I replaced PyFile_FromFd() by 
custom code which set correctly the file name.

PyFile_FromFd() is also used in:
 - _Py_DisplaySourceLine(): name is not used, only 
PyFile_GetLine(file)
 - call_find_module() (imp.find_module()): return the file object with 
the wrong name

Example with imp:

>>> file, filename, extra = imp.find_module("os")
>>> file

>>> file.name
4
>>> filename
'/home/SHARE/SVN/py3k/Lib/os.py'

___
Python tracker 

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



[issue4762] PyFile_FromFd() doesn't set the file name

2008-12-28 Thread STINNER Victor

STINNER Victor  added the comment:

> In my last patch to fix the issue #4705, I replaced PyFile_FromFd()
> by custom code which set correctly the file name.

The standard I/O: sys.stdin, sys.stdout and sys.stderr.

___
Python tracker 

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



[issue4762] PyFile_FromFd() doesn't set the file name

2008-12-28 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +pitrou

___
Python tracker 

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



[issue4701] range objects becomes hashable after attribute access

2008-12-28 Thread Eric Smith

Eric Smith  added the comment:

> Perhaps the path of least resistance is to change PyObject_Hash to be
> yet another place where PyType_Ready will be called implicitly if it
> hasn't been called already?

I think that's the best thing to do. It would bring PyObject_Hash in
line with PyObject_Format, for example.

If we pick some other solution (instead of modifying PyObject_Hash),
then we should find all of the lazy calls to PyType_Ready (that exist to
solve this problem) and remove them. IOW, it should be handled the same
everywhere.

___
Python tracker 

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



[issue1034053] unittest.py patch: add skipped test functionality

2008-12-28 Thread Remy Blank

Remy Blank  added the comment:

There's still a typo in the docstring of TestResult.addSkipped() (tuble
-> tuple).

___
Python tracker 

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



[issue4489] shutil.rmtree is vulnerable to a symlink attack

2008-12-28 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> Using chdir() makes sense and it doesn't look like a too big problem to me:

It's a problem if another thread in the process is making file
operations using relative paths at the same time.

Since shutil functions have until now been safe against this
possibility, I don't think it's ok to make them unsafe in future
versions.

___
Python tracker 

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



[issue3700] test_bigmem broken

2008-12-28 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Here is a patch. Not only does it fix the str tests, but it also adds
similar tests for bytes and bytearray objects.

--
keywords: +patch
stage:  -> patch review
versions: +Python 3.1
Added file: http://bugs.python.org/file12480/bigmemtest.patch

___
Python tracker 

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



[issue4728] Endianness and universal builds problems

2008-12-28 Thread Ronald Oussoren

Ronald Oussoren  added the comment:

On 28 Dec, 2008, at 16:38, Benjamin Peterson wrote:

>
> Benjamin Peterson  added the comment:
>
> I applied the patch for #4060 in r67982.

I've backported that to 2.6-maint in r67987.
>
>
> I would still like to know what difference an Intel machine makes in  
> the
> installers, though.

It should make no difference at all. I haven't tested building on a  
PPC machine though, all 2.5.x installers were build on an intel box  
because that happens to be my main development machine.  A nice side- 
effect of building on an intel box is that you can test both  
architectures without switching to another machine (through Rosetta).

Ronald

Added file: http://bugs.python.org/file12481/smime.p7s

___
Python tracker 

___

smime.p7s
Description: S/MIME cryptographic signature
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4064] distutils.util.get_platform() is wrong for universal builds on macosx

2008-12-28 Thread Ronald Oussoren

Ronald Oussoren  added the comment:

I've committed the patch with some documentation in r67988, with a 
backport to 2.6.x in r67989.  r67990 (not backported) is a minor update
of the patch, it adds explicit support code for all three variants that
are configurable through the configure script.

I don't think it is useful to worry about architectures that are not 
supported by current releases of MacOSX.

--
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



[issue4763] PyErr_GivenExceptionMatches documentation out of date

2008-12-28 Thread garcia

New submission from garcia :

The documentation for PyErr_GivenExceptionMatches states that "If given is 
NULL, a memory access violation will occur."  However, looking at the 
code, this is not the case:  the function returns 0 (read: false).
It appears, rather, that this function always succeeds.

--
assignee: georg.brandl
components: Documentation
messages: 78429
nosy: garcia, georg.brandl
severity: normal
status: open
title: PyErr_GivenExceptionMatches documentation out of date
versions: Python 2.5, Python 2.6, Python 3.0

___
Python tracker 

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



[issue4761] create Python wrappers for openat() and others

2008-12-28 Thread Martin v. Löwis

Martin v. Löwis  added the comment:

There is a tradition that any POSIX calls are added to the POSIX module
without much discussion, provided that
a) there is an autoconf test testing for their presence, and
b) they expose the API as-is, i.e. without second-guessing the designers
of the original API.

So contributions are welcome.

___
Python tracker 

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



[issue4761] create Python wrappers for openat() and others

2008-12-28 Thread Christian Heimes

Christian Heimes  added the comment:

The openat() functions sound useful indeed. However I'm concerned about
the file descriptor requirment for the *at() POSIX functions. In Python
file descriptors can lead to resource leaks because developers are used
to automatic garbage collection. os.open() is the only way to get a file
descriptor to a directory. The builtin open() doesn't open directories.
Developers may think that the file descriptor is closed when the integer
object gets out of scope.

I propose the addition of opendir() for the purpose of the *at()
functions. The opendir function should return a wrapper object around
the DIR* pointer returned by opendir(). A function fileno() exposed the
file descriptor of the DIR pointer via dirfd().

--
nosy: +christian.heimes

___
Python tracker 

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



[issue4763] PyErr_GivenExceptionMatches documentation out of date

2008-12-28 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

Thanks for the report! Fixed in r67995.

--
nosy: +benjamin.peterson
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



[issue4761] create Python wrappers for openat() and others

2008-12-28 Thread Martin v. Löwis

Martin v. Löwis  added the comment:

> Developers may think that the file descriptor is closed when the integer
> object gets out of scope.

I'm not concerned about that. When they use os.open, they will typically
understand what a file handle is, and how it relates to

> I propose the addition of opendir() for the purpose of the *at()
> functions. The opendir function should return a wrapper object around
> the DIR* pointer returned by opendir(). A function fileno() exposed the
> file descriptor of the DIR pointer via dirfd().

-1. This is exactly the second-guessing kind of thing that the POSIX
module should avoid. openat(2) doesn't expect DIR objects, and neither
should posix.openat.

If desired, a layer can be added on top of this that makes it more
"safe", e.g. in the os module; such a layer should then try to make it
cross-platform before trying to make it safe.

___
Python tracker 

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



[issue4617] SyntaxError when free variable name is also an exception target

2008-12-28 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

I think being able to delete free variables is reasonable and brings
more consistency as well as solving corner cases like this.

--
nosy: +benjamin.peterson

___
Python tracker 

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



[issue1886] Permit to easily use distutils "--formats=tar, gztar, bztar" on all systems

2008-12-28 Thread anatoly techtonik

anatoly techtonik  added the comment:

Roumen, could you be more specific about what are you trying to say with
this 200kB piece of code? Was it the intention to post a link to man or
another piece of spec?

___
Python tracker 

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



[issue4685] IDLE will not open (2.6.1 on WinXP pro)

2008-12-28 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

I would like to see the complete list of messages.
Looks like a broken python installation...

___
Python tracker 

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



[issue4449] AssertionError in Doc/includes/mp_benchmarks.py

2008-12-28 Thread Amaury Forgeot d'Arc

Changes by Amaury Forgeot d'Arc :


--
keywords: +needs review
stage: needs patch -> patch review

___
Python tracker 

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



[issue4764] open('existing_dir') -> IOError instance's attr filename is None

2008-12-28 Thread Jan Kaliszewski

New submission from Jan Kaliszewski :

Py2.4 and 2.5 (and probably other 2.x releases too):
>>> try: f=open('existing_dir')
... except IOError, exc: print exc.filename
...
None
(expected result: "existing_dir")

Py3.0 (and possibly 3.1 too):
>>> try: f=open('existing_dir')
... except IOError as exc: print(exc.filename)
...
None
(expected result: "existing_dir")

But no problems with:
open('existing_dir', 'w')
=> exc.filename=='existing_dir'
open('not_existing_file') 
=> exc.filename=='not_existing_file'

Guess:
It may be similar to issue #599163

Platform/system info:
[GCC 4.1.2 (Gentoo 4.1.2 p1.0.2)] on linux2
Linux 2.6.25-gentoo-r9 i686 Intel(R) Pentium(R) 4 CPU 2.40GHz
* Py2.4 == Python 2.4.4 (#1, Oct  7 2008, 13:16:18)
* Py2.5 == Python 2.5.2 (r252:60911, Sep 15 2008, 12:11:51)
* Py3.0 == Python 3.0 (r30:67503, Dec 29 2008, 01:15:48)

--
components: Library (Lib)
messages: 78437
nosy: zuo
severity: normal
status: open
title: open('existing_dir') -> IOError instance's attr filename is None
type: behavior
versions: Python 2.4, Python 2.5, Python 3.0

___
Python tracker 

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



[issue4732] Object allocation stress leads to segfault on RHEL

2008-12-28 Thread Andrew

Andrew  added the comment:

Cannot reproduce this on RHEL 4.  So far only RHEL 5.x seems to be affected.

___
Python tracker 

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



[issue4765] IDLE fails to "Delete Custom Key Set" properly

2008-12-28 Thread Alex Fainshtein

New submission from Alex Fainshtein :

How to reproduce:
1. Start IDLE -> "Python Shell" window opens.
2. Open Options|"Configure Idle...".
3. In "idle" dialog select "Keys" tab.
4. Click "Set as New Custom Key Set" button.
5  In "New Custom Key Set" dialog, type a name, click "Ok".
4. Click "Apply". Then notice that in the folder

   C:\Documents and Settings\\.idlerc,

   two new files appear, config-keys.cfg and config-main.cfg. The
contents of the latter is

[Keys]
default = 0
name = 

SO FAR ALL IS OK.

5. Now go back to "idle" dialog, click "Delete Custom Key Set", then
"Apply". Notice that config-keys.cfg file disappeared, but
config-main.cfg neither disappeared nor changed. My guess, THIS IS THE BUG.

6. Now click "Ok" - no reaction. Click "Cancel" - crash: the Python
windows disappear. Try to restart IDLE - it WOULD NOT START until
config-main.cfg is manually deleted.

--
components: IDLE
messages: 78439
nosy: alex_fainshtein
severity: normal
status: open
title: IDLE fails to "Delete Custom Key Set" properly
type: crash
versions: Python 3.0

___
Python tracker 

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