[issue15203] Accepting of os functions of (path, dir_fd) pair as argument

2012-06-28 Thread Nick Coghlan

Nick Coghlan  added the comment:

Correctly avoiding symlink attacks, which is the whole reason the POSIX *at 
variants and the dir_fd parameters were added, is not trivial in general. 
os.fwalk and shutil.rmtree went through many iterations before reaching a state 
where they should successfully avoid the problem.

Simply passing a (path, dir_fd) 2-tuple instead of a string and calling it done 
is highly unlikely to produce a secure result, thus rather missing the point of 
the exercise.

--
nosy: +ncoghlan
resolution:  -> rejected
stage:  -> committed/rejected
status: open -> closed

___
Python tracker 

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



[issue7475] codecs missing: base64 bz2 hex zlib hex_codec ...

2012-06-28 Thread Nick Coghlan

Nick Coghlan  added the comment:

My current opinion is that this should be a PEP for 3.4, to make sure we flush 
out all the corner cases and other details correctly.

--
versions: +Python 3.4 -Python 3.3

___
Python tracker 

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



[issue7475] codecs missing: base64 bz2 hex zlib hex_codec ...

2012-06-28 Thread Nick Coghlan

Nick Coghlan  added the comment:

For that matter, with the relevant codecs restored in 3.2, a transform() helper 
could probably be added to six (or a new project on PyPI) to prototype the 
approach.

--

___
Python tracker 

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



[issue15215] socket module setblocking and settimeout problem

2012-06-28 Thread Frank Ling

New submission from Frank Ling :

i use socket such as :
self.socket.setblocking(1)
self.socket.settimeout(1)
but this socket is no-block ,i find socketmodule.c sock_settimeout

s->sock_timeout = timeout;
internal_setblocking(s, timeout < 0.0);

if timeout >0, so internal_setblocking(s,false=0),so socket is no-block

by the way:
  in sock_settimeout,call internal_setblocking params have error?

init_sockobject:
if (defaulttimeout >= 0.0)
internal_setblocking(s, 0);

--
messages: 164225
nosy: Frank.Ling
priority: normal
severity: normal
status: open
title: socket module setblocking and settimeout problem
type: behavior
versions: Python 2.7

___
Python tracker 

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



[issue11959] smtpd cannot be used without affecting global state

2012-06-28 Thread Vinay Sajip

Changes by Vinay Sajip :


--
versions: +Python 3.4 -Python 3.3

___
Python tracker 

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



[issue15202] followlinks/follow_symlinks/symlinks flags unification

2012-06-28 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Here is updated patches. The type of exception thrown when specifying
mutually exclusive arguments changed from ValueError to TypeError (in
accordance with the raised in similar conflicts exceptions). Slightly
modified documentation. Taken into account some of Larry's comments.

Only os.walk had followlinks and shutil.copytree had symlinks before
3.3. So these are the only functions preserved the old arguments.
os.fwalk and another five public functions from shutil got a new
argument only in 3.3, for them it just renamed (may be to make them
keyword-only?). Larry worrying, isn't it too late? But it would be
strange to have in 3.3 new and immediately obsolete arguments. Moreover
the support for the two arguments complicate and slow down the code. If
you postpone it to 3.4, there will not be another solution, but now we
can do less mess.

--
Added file: 
http://bugs.python.org/file26194/followlinks-to-follow_symlinks-2.patch
Added file: http://bugs.python.org/file26195/symlinks-to-follow_symlinks-2.patch

___
Python tracker 

___diff -r d0f775432705 Doc/library/os.rst
--- a/Doc/library/os.rstThu Jun 28 01:45:48 2012 +0200
+++ b/Doc/library/os.rstThu Jun 28 11:02:52 2012 +0300
@@ -2128,7 +2128,8 @@
   and the *dir_fd*, *follow_symlinks*, and *ns* parameters.
 
 
-.. function:: walk(top, topdown=True, onerror=None, followlinks=False)
+.. function:: walk(top, topdown=True, onerror=None, followlinks=False, *,
+   follow_symlinks=False)
 
.. index::
   single: directory; walking
@@ -2168,12 +2169,12 @@
is available as the ``filename`` attribute of the exception object.
 
By default, :func:`walk` will not walk down into symbolic links that 
resolve to
-   directories. Set *followlinks* to ``True`` to visit directories pointed to 
by
+   directories. Set *follow_symlinks* to ``True`` to visit directories pointed 
to by
symlinks, on systems that support them.
 
.. note::
 
-  Be aware that setting *followlinks* to ``True`` can lead to infinite
+  Be aware that setting *follow_symlinks* to ``True`` can lead to infinite
   recursion if a link points to a parent directory of itself. :func:`walk`
   does not keep track of the directories it visited already.
 
@@ -2210,8 +2211,13 @@
   for name in dirs:
   os.rmdir(os.path.join(root, name))
 
-
-.. function:: fwalk(top='.', topdown=True, onerror=None, followlinks=False, *, 
dir_fd=None)
+   .. versionchanged:: 3.3
+  Added  *follow_symlinks* as alias to *followlinks*. *followlinks* should
+  not be used in new code. A :exc:`TypeError` is raised if both
+  *followlinks* and *follow_symlinks* are specified.
+
+
+.. function:: fwalk(top='.', topdown=True, onerror=None, 
follow_symlinks=False, *, dir_fd=None)
 
.. index::
   single: directory; walking
diff -r d0f775432705 Lib/os.py
--- a/Lib/os.py Thu Jun 28 01:45:48 2012 +0200
+++ b/Lib/os.py Thu Jun 28 11:02:52 2012 +0300
@@ -331,7 +331,9 @@
 
 __all__.extend(["makedirs", "removedirs", "renames"])
 
-def walk(top, topdown=True, onerror=None, followlinks=False):
+_sentry = object()
+
+def walk(top, topdown=True, onerror=None, followlinks=_sentry, *, 
follow_symlinks=_sentry):
 """Directory tree generator.
 
 For each directory in the directory tree rooted at top (including top
@@ -369,7 +371,7 @@
 
 By default, os.walk does not follow symbolic links to subdirectories on
 systems that support them.  In order to get this functionality, set the
-optional argument 'followlinks' to true.
+optional argument 'follow_symlinks' to True.
 
 Caution:  if you pass a relative pathname for top, don't change the
 current working directory between resumptions of walk.  walk never
@@ -387,7 +389,15 @@
 if 'CVS' in dirs:
 dirs.remove('CVS')  # don't visit CVS directories
 """
+if follow_symlinks is _sentry:
+follow_symlinks = followlinks is not _sentry and followlinks
+elif followlinks is not _sentry:
+raise TypeError("walk() got values for both 'follow_symlinks' and"
+" 'followlinks' arguments")
 
+yield from _walk(top, topdown, onerror, follow_symlinks)
+
+def _walk(top, topdown, onerror, follow_symlinks):
 islink, join, isdir = path.islink, path.join, path.isdir
 
 # We may not have read permission for top, in which case we can't
@@ -415,8 +425,8 @@
 yield top, dirs, nondirs
 for name in dirs:
 new_path = join(top, name)
-if followlinks or not islink(new_path):
-yield from walk(new_path, topdown, onerror, followlinks)
+if follow_symlinks or not islink(new_path):
+yield from walk(new_path, topdown, onerror, follow_symlinks)
 if not topdown:
 yield top, dirs, nondirs
 
@@ -424,7 +434,7 @@
 

[issue14814] Implement PEP 3144 (the ipaddress module)

2012-06-28 Thread Hynek Schlawack

Hynek Schlawack  added the comment:

Try running the test like:

./python[.exe] -bb -Wd -m test test_ipaddress

--

___
Python tracker 

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



[issue14133] improved PEP 409 implementation

2012-06-28 Thread Patrick Westerhoff

Patrick Westerhoff  added the comment:

Hey, I just saw the release notes for 3.3 and would like a quick confirmation: 
This is included in 3.3, right? ^^

--

___
Python tracker 

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



[issue15206] uuid module falls back to unsuitable RNG

2012-06-28 Thread Christian Heimes

Christian Heimes  added the comment:

Am 28.06.2012 07:54, schrieb Martin v. Löwis:
> 
> Martin v. Löwis  added the comment:
> 
>> a) my patch handles the fork() issue correctly
> 
> If the system has urandom, yes.

That's the easy and trivial case. It also handles fork() by storing the
PID and comparing it to os.getpid() whenever the RNG is acquired.

--

___
Python tracker 

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



[issue15206] uuid module falls back to unsuitable RNG

2012-06-28 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

+except Exception:

I don't think that's a good idea. You should list the specific exceptions here 
(NotImplementedError, OSError perhaps?).

--

___
Python tracker 

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



[issue15204] Deprecate the 'U' open mode

2012-06-28 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

> Unless there are places where it is actually broken, I don't think there is a 
> good reason to have step 3.5, though.  Just add the deprecation warning and 
> remove it in 4.0.

Well. In any case, the 'U' mode in most cases has no effect, and the
code, where it has an effect (in zipfile), is very rarely used (and it
is actually complicated and broken).

Here are the patches for the first (documentation) and the second stage
(warnings).

--

___
Python tracker 

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



[issue1677] Ctrl-C will exit out of Python interpreter in Windows

2012-06-28 Thread Tim Golden

Tim Golden  added the comment:

Attached is a patch against Python 2.7. It checks in a loop for SIGINT and, if 
it still hasn't fired, assumed Ctrl-Z was pressed which generates the same 
error.

--
assignee:  -> tim.golden
keywords: +patch
Added file: http://bugs.python.org/file26196/issue1677-python27.patch

___
Python tracker 

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



[issue15204] Deprecate the 'U' open mode

2012-06-28 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
keywords: +patch
Added file: http://bugs.python.org/file26197/deprecate-U-mode-stage1.patch

___
Python tracker 

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



[issue15204] Deprecate the 'U' open mode

2012-06-28 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


Added file: http://bugs.python.org/file26198/deprecate-U-mode-stage2.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

2012-06-28 Thread Hynek Schlawack

Hynek Schlawack  added the comment:

Thanks you for catching that! It seems we did something really stupid: followed 
symlinks.

I’ve fixed that and added regression tests. This one is a facepalm gentlepeople.

--

___
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

2012-06-28 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset f9f798f1421e by Hynek Schlawack in branch 'default':
#4489: Don't follow ever symlinks in rmtree
http://hg.python.org/cpython/rev/f9f798f1421e

--

___
Python tracker 

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



[issue15215] socket module setblocking and settimeout problem

2012-06-28 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Yes, this is normal. Timeout sockets use a non-blocking fd internally:
http://docs.python.org/dev/library/socket.html#notes-on-socket-timeouts

This won't be visible to you if you only use the socket object, but it will if 
you call fileno() and use the file descriptor directly.

--
nosy: +pitrou
resolution:  -> wont fix
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

2012-06-28 Thread Hynek Schlawack

Changes by Hynek Schlawack :


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

___
Python tracker 

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



[issue7475] codecs missing: base64 bz2 hex zlib hex_codec ...

2012-06-28 Thread Nick Coghlan

Nick Coghlan  added the comment:

Setting as a release blocker for 3.4 - this is important.

--
priority: normal -> release blocker
stage: commit review -> 

___
Python tracker 

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



[issue14469] Python 3 documentation links

2012-06-28 Thread Senthil Kumaran

Senthil Kumaran  added the comment:

Right now, I do not see the problem mentioned in this report.

http://www.python.org/doc/ point to a page which has reference docs to both 2.7 
and 3.0. 
The left hand side, Other Resources Link are generic too.

docs.python.org pointing to py2.7 is a python-dev decision and outside scope of 
this bug.

I am closing this one as works for me.

--
nosy: +orsenthil
resolution:  -> works for me
stage:  -> committed/rejected
status: open -> closed

___
Python tracker 

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



[issue15216] Support setting the encoding on a text stream after creation

2012-06-28 Thread Nick Coghlan

New submission from Nick Coghlan :

As discussed on python-ideas, swapping out the sys.std* streams can be fraught 
with peril. This can make writing code that wants to support an "--encoding" 
option for pipeline processing difficult.

The proposal [1] is that TextIOWrapper support a set_encoding() method that is 
only supported between creation of the stream and the first read or write 
operation. Once the stream is "dirty", you can no longer change the encoding - 
you must replace the stream (e.g. by passing stream.fileNo() to open())

[1] http://mail.python.org/pipermail/python-ideas/2012-June/015535.html

--
messages: 164239
nosy: ncoghlan
priority: release blocker
severity: normal
stage: needs patch
status: open
title: Support setting the encoding on a text stream after creation
type: enhancement
versions: Python 3.4

___
Python tracker 

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



[issue9559] mailbox.mbox creates new file when adding message to mbox

2012-06-28 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset c37cb11b546f by Petri Lehtinen in branch '2.7':
#9559: Append data to single-file mailbox files if messages are only added
http://hg.python.org/cpython/rev/c37cb11b546f

New changeset 5f447a005d67 by Petri Lehtinen in branch '3.2':
#9559: Append data to single-file mailbox files if messages are only added
http://hg.python.org/cpython/rev/5f447a005d67

New changeset 0bacbab678ed by Petri Lehtinen in branch 'default':
#9559: Append data to single-file mailbox files if messages are only added
http://hg.python.org/cpython/rev/0bacbab678ed

--
nosy: +python-dev

___
Python tracker 

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



[issue9559] mailbox.mbox creates new file when adding message to mbox

2012-06-28 Thread Petri Lehtinen

Petri Lehtinen  added the comment:

Fixed. I removed the extra newlines.

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



[issue9559] mailbox.mbox creates new file when adding message to mbox

2012-06-28 Thread Petri Lehtinen

Petri Lehtinen  added the comment:

See #15122 for always modifying single-file mailboxes in-place.

--

___
Python tracker 

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



[issue10571] "setup.py upload --sign" broken: TypeError: 'str' does not support the buffer interface

2012-06-28 Thread Hynek Schlawack

Changes by Hynek Schlawack :


--
nosy: +hynek
versions: +Python 3.4 -Python 3.1

___
Python tracker 

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



[issue1677] Ctrl-C will exit out of Python interpreter in Windows

2012-06-28 Thread Kristján Valur Jónsson

Kristján Valur Jónsson  added the comment:

Shouldn't we be using a proper synchronization primitive?  What about waiting 
for an event?

--
nosy: +kristjan.jonsson

___
Python tracker 

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



[issue1677] Ctrl-C will exit out of Python interpreter in Windows

2012-06-28 Thread Kristján Valur Jónsson

Kristján Valur Jónsson  added the comment:

In fact, there is _PyOS_SigintEvent at the end of signalmodule.c

--

___
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

2012-06-28 Thread Larry Hastings

Larry Hastings  added the comment:

I'm not a security guy, but: shouldn't the os.unlink call when it isn't a 
directory specify follow_symlinks=False?  And wouldn't it be safer if the 
os.rmdir() call also used dir_fd=?


Additionally, I think you missed some stuff for shutil._use_fd_functions.  
Assuming I'm right on both of the above, you should also check:
* os.listdir in os.supports_dir_fd
* os.rmdir in os.supports_dir_fd
* os.stat in os.supports_dir_fd
* os.stat in os.supports_follow_symlinks
* os.unlink in os.supports_follow_symlinks

I'd spell that
_use_fd_functions = ({os.listdir, os.open, os.rmdir, os.stat, os.unlink} < 
os.supports_dir_fd and
{os.stat, os.unlink} <= os.supports_follow_symlinks)


Finally, up to you, but I'd be tempted to change the "lstat" "and "fstat" calls 
to "stat" calls using the relevant parameters.

--

___
Python tracker 

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



[issue1677] Ctrl-C will exit out of Python interpreter in Windows

2012-06-28 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

Is the ERROR_OPERATION_ABORTED set when Ctrl-Z is hit?

--

___
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

2012-06-28 Thread Hynek Schlawack

Hynek Schlawack  added the comment:

> I'm not a security guy, but: shouldn't the os.unlink call when it isn't a 
> directory specify follow_symlinks=False? 

os.unlink has no follow_symlinks argument. Imagine what would happen if
you‘d do a os.unlink() on a link and it would just remove the link
destination. :)

> And wouldn't it be safer if the os.rmdir() call also used dir_fd=?

Unfortunately, os.rmdir('.', dir_fd=topfd) doesn’t work. As in the worst
case it could delete only an empty directory, I think it’s fine.

> Additionally, I think you missed some stuff for shutil._use_fd_functions.  
> Assuming I'm right on both of the above, you should also check:
> * os.listdir in os.supports_dir_fd
> * os.rmdir in os.supports_dir_fd
> * os.stat in os.supports_dir_fd
> * os.stat in os.supports_follow_symlinks
> * os.unlink in os.supports_follow_symlinks

Interestingly, os.listdir is not in os.supports_dir_fd although it works:

False

Will you fix it right away or shall I open a ticket?

> I'd spell that
> _use_fd_functions = ({os.listdir, os.open, os.rmdir, os.stat, os.unlink} < 
> os.supports_dir_fd and
> {os.stat, os.unlink} <= os.supports_follow_symlinks)

It would be:

_use_fd_functions = ({os.listdir, os.open, os.stat, os.unlink} <=
 os.supports_dir_fd and
 os.stat in os.supports_follow_symlinks)

But currently can’t do.

> Finally, up to you, but I'd be tempted to change the "lstat" "and "fstat" 
> calls to "stat" calls using the relevant parameters.

That's not 3.3 fodder IMHO, feel free to open an enhancement ticket.

--

___
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

2012-06-28 Thread Larry Hastings

Larry Hastings  added the comment:

I'm pretty busy right now, please open a ticket for listdir.

_rmtree_safe_fd could remove the directory just after the recursive step using 
the parent's dirfd.  Of course you'd also have to add a rmdir for the 
very-tippy-top after the original call in shutil.rmtree too.  But this would 
prevent the malicious user from even removing empty directories.

--

___
Python tracker 

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



[issue15217] os.listdir is missing in os.supports_dir_fd

2012-06-28 Thread Hynek Schlawack

New submission from Hynek Schlawack :

>>> n = os.open('/tmp', os.O_RDONLY)
>>> l = os.listdir(n)
>>> os.listdir in os.supports_dir_fd
False

--
assignee: larry
components: Library (Lib)
messages: 164249
nosy: hynek, larry
priority: release blocker
severity: normal
stage: needs patch
status: open
title: os.listdir is missing in os.supports_dir_fd
type: behavior
versions: Python 3.3

___
Python tracker 

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



[issue1677] Ctrl-C will exit out of Python interpreter in Windows

2012-06-28 Thread Tim Golden

Tim Golden  added the comment:

Yep.

--

___
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

2012-06-28 Thread Hynek Schlawack

Hynek Schlawack  added the comment:

> I'm pretty busy right now, please open a ticket for listdir.

done

> _rmtree_safe_fd could remove the directory just after the recursive step 
> using the parent's dirfd.  Of course you'd also have to add a rmdir for the 
> very-tippy-top after the original call in shutil.rmtree too.  But this would 
> prevent the malicious user from even removing empty directories.

Okay I looked into it and it seems okay. IIRC, when Martin wrote the
code (and I the fwalk version before), there was no known fd-based rmdir
function.

--

___
Python tracker 

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



[issue1677] Ctrl-C will exit out of Python interpreter in Windows

2012-06-28 Thread Tim Golden

Tim Golden  added the comment:

To be clear: ERROR_OPERATION_ABORTED is set when Ctrl-Z is hit as the
only thing on a line. If it's just an extra character then it operates
like any other keypress.

--

___
Python tracker 

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



[issue13886] readline-related test_builtin failure

2012-06-28 Thread Petri Lehtinen

Petri Lehtinen  added the comment:

I had exactly the same error on 3.3b1 when running the test suite with 
randomized order.

--
nosy: +petri.lehtinen

___
Python tracker 

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



[issue9559] mailbox.mbox creates new file when adding message to mbox

2012-06-28 Thread Petri Lehtinen

Petri Lehtinen  added the comment:

The _pre_mailbox_hook may be called twice, like this:

babyl = mailbox.Babyl('new_file')
babyl.add('foo\n')
babyl.remove(0)
babyl.add('bar\n')

This only affects Babyl, that writes the mailbox header in _pre_mailbox_hook. 
The mailbox is corrupted on disk until flush() is called.

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

___
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

2012-06-28 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 9134bb4d0578 by Hynek Schlawack in branch 'default':
#4489: Use dir_fd in rmdir in _rmtree_safe_fd()
http://hg.python.org/cpython/rev/9134bb4d0578

--

___
Python tracker 

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



[issue15216] Support setting the encoding on a text stream after creation

2012-06-28 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

> The proposal [1] is that TextIOWrapper support a set_encoding() method that 
> is only supported between creation of the stream and the first read or write 
> operation.

IMHO "encoding", "errors", "buffering", "line_buffering" and "newline" should 
be writable properties (unless first read/write).

--
nosy: +storchaka

___
Python tracker 

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



[issue15108] ERROR: SystemError: ./../Objects/tupleobject.c:118: bad argument to internal function

2012-06-28 Thread Pankaj D

Pankaj D  added the comment:

I believe I have found the root-cause for this issue.   

It  is occurring due to the use of the garbage collector in another 
“memMonitor” thread (we run it periodically to get stats on objects, track mem 
leaks, etc).  Since _pysqlite_fetch_one_row() releases the GIL before calling 
PyTuple_SetItem(),  if the  memMonitor is scheduled to run and, say, calls 
gc.get_objects(), it increments the refcount on all tracked objects (via 
append_objects()->PyList_Append()->app1()->PY_INCREF()).I have stack traces 
to confirm.   This seems to rule out the use of gc methods (such as 
get_objects(), get_referrers/referents()) in multi-threaded programs or have 
them handle SystemError arising from such usage.  Agree?

--

___
Python tracker 

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



[issue15217] os.listdir is missing in os.supports_dir_fd

2012-06-28 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +storchaka

___
Python tracker 

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



[issue12142] Reference cycle when importing ctypes

2012-06-28 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

Meador, can we close this issue?

--
nosy: +amaury.forgeotdarc

___
Python tracker 

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



[issue15218] Check for all necessary dir_fd and follow_symlinks functions

2012-06-28 Thread Hynek Schlawack

New submission from Hynek Schlawack :

Currently not all functions are checked. As soon as #15217 is fixed, we have to 
add the rest.

--
assignee: hynek
components: Library (Lib)
files: fd-protection.diff
keywords: patch
messages: 164259
nosy: hynek
priority: release blocker
severity: normal
status: open
title: Check for all necessary dir_fd and follow_symlinks functions
type: behavior
versions: Python 3.3
Added file: http://bugs.python.org/file26199/fd-protection.diff

___
Python tracker 

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



[issue15218] Check for all necessary dir_fd and follow_symlinks functions

2012-06-28 Thread Hynek Schlawack

Changes by Hynek Schlawack :


--
dependencies: +os.listdir is missing in os.supports_dir_fd

___
Python tracker 

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



[issue15209] Re-raising exceptions from an expression

2012-06-28 Thread Tyler Crompton

Tyler Crompton  added the comment:

I'm in a little over my head as I can't conceptualize __cause__, so I may be 
looking over things.

First, you, Ethan, said the following:

>It's also not difficult to work around if you really want to toss the extra 
>info:
>
>except NameError:
>try:
>fallback_module.getch()
>except Exception as exc:
>raise exc from None
>
>A total of three more words to get the desired behavior (and small ones at 
>that).

Counter-argument: if it's just three words, then why was the shorthand without 
the from clause implemented in the first place?

My use case was primarily based on the idea that the unavailability of the 
windows module (from the example) is irrelevant information to, say, Unix 
users. When an exception is raised, the user shouldn't have to see any 
Windows-related exceptions (that is if there is an alternate solution).

One could fix this with a little bit of refactoring, though:

import sys as _sys

def getch(prompt=''):
'''Get and return a character (similar to `input()`).'''

print(prompt, end='')
if 'windows_module' in _sys.modules:
return windows_module.getch()
else:
try:
return fallback_module.getch()
except Exception:
raise from None

But it's EAFP. Heck, one could even do the following:

def getch(prompt=''):
'''Get and return a character (similar to `input()`).'''

print(prompt, end='')
try:
return windows_module.getch()
except NameError:
pass

try:
return fallback_module.getch()
except Exception:
raise

But that's not really ideal. I've played around with the traceback module a 
little and (very) briefly played with the exceptions themselves. Is there not 
an easier way to suppress a portion of an exception? Like I said, such 
information is irrelevant to non-Windows users.

--

___
Python tracker 

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



[issue1677] Ctrl-C will exit out of Python interpreter in Windows

2012-06-28 Thread Tim Golden

Tim Golden  added the comment:

This patch is for 2.7 and does enough to solve the issue without a major
rework. The signal module onthe default branch has had a lot of love
recently and I'll definitely make use of that for a 3.x patch.

--

___
Python tracker 

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



[issue12142] Reference cycle when importing ctypes

2012-06-28 Thread Meador Inge

Meador Inge  added the comment:

> Meador, can we close this issue?

I wanted to keep it open until the 'long double' problem is fixed as well.

--

___
Python tracker 

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



[issue15218] Check for all necessary dir_fd and follow_symlinks functions

2012-06-28 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +storchaka

___
Python tracker 

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



[issue15108] ERROR: SystemError: ./../Objects/tupleobject.c:118: bad argument to internal function

2012-06-28 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

Thanks for the analysis!
This is quite similar to issue793822: gc.get_referrers() can access unfinished 
tuples.  The difference here is that what breaks is not the monitoring tool, 
but the "main" program!

Here is a simple script inspired from the original bug; PySequence_Tuple() uses 
PyTuple_SET_ITEM() which is a macro without the ob_refcnt check, but we can 
make it call _PyTuple_Resize() and fail there.  All versions of CPython are 
affected:


import gc
TAG = object()

def monitor():
lst = [x for x in gc.get_referrers(TAG)
   if isinstance(x, tuple)]
t = lst[0]   # this *is* the result tuple
print(t) # full of nulls !
return t # Keep it alive for some time

def my_iter():
yield TAG# 'tag' gets stored in the result tuple
t = monitor()
for x in range(10):
yield x  # SystemError when the tuple needs to be resized

tuple(my_iter())

--
nosy: +amaury.forgeotdarc, arigo

___
Python tracker 

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



[issue1677] Ctrl-C will exit out of Python interpreter in Windows

2012-06-28 Thread Kristján Valur Jónsson

Kristján Valur Jónsson  added the comment:

Hm, I wonder if the test for the SIGINT event is required at all.
Could it be sufficient to simply check for the EOF state?  EOF would indicate 
ctrl z and distinguish it thus from ctrl-c.

--

___
Python tracker 

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



[issue15030] PyPycLoader can't read cached .pyc files

2012-06-28 Thread Marc Abramowitz

Marc Abramowitz  added the comment:

I don't know if I'll have time soon to do the tweaks to Ronan's test (and maybe 
he wants to do them himself anyway?), but here's the correction of the size 
calculation in the header (from size of bytecode to size of source -- thanks, 
Brett!)

--
Added file: http://bugs.python.org/file26200/cpython-issue-15030.patch

___
Python tracker 

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



[issue14133] improved PEP 409 implementation

2012-06-28 Thread Nick Coghlan

Nick Coghlan  added the comment:

Yep - note that PEP 409 was updated to say that the the implementation 
discussion has been superceded by PEP 415. It may be worth making that note 
more prominent, though...

--

___
Python tracker 

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



[issue1251] ssl module doesn't support non-blocking handshakes

2012-06-28 Thread Michael Gundlach

Michael Gundlach  added the comment:

I recently started getting what appears to be this bug in 2.6.6 and 2.7.3 when 
connecting to Google.

My script does this:

  while True:
get an IMAP connection to Google, if our old one timed out
fetch unread messages.  if any:
  make an SMTP connection to Google and send some emails 
  mark the unread messages as read
sleep 10 seconds

It used to run fine on 2.6.  I'm assuming something changed at Google, because 
it started hanging, whether in 2.6 or 2.7.  Here's the stack trace when I 
eventually press Ctrl-C:

 File "./main.py", line 21, in loop
the_emails = list(emails.messages('(UNSEEN)'))
  File "./emails.py", line 129, in messages
for chunk in chunks_of_length(32, messages):
  File "./chunks.py", line 9, in chunks_of_length
for item in iterable:
  File "./emails.py", line 90, in email_messages
m = open_mailbox(label, readonly=True)
  File "./emails.py", line 30, in open_mailbox
m = imaplib.IMAP4_SSL('imap.gmail.com', 993)
  File "/usr/lib64/python2.6/imaplib.py", line 1138, in __init__
IMAP4.__init__(self, host, port)
  File "/usr/lib64/python2.6/imaplib.py", line 163, in __init__
self.open(host, port)
  File "/usr/lib64/python2.6/imaplib.py", line 1150, in open
self.sslobj = ssl.wrap_socket(self.sock, self.keyfile, self.certfile)
  File "/usr/lib64/python2.6/ssl.py", line 338, in wrap_socket
suppress_ragged_eofs=suppress_ragged_eofs)
  File "/usr/lib64/python2.6/ssl.py", line 120, in __init__
self.do_handshake()
  File "/usr/lib64/python2.6/ssl.py", line 279, in do_handshake
self._sslobj.do_handshake()
KeyboardInterrupt

FWIW, for the last couple of days my script is *not* hanging, so perhaps Google 
changed something on their end, avoiding the Python bug.

Should this Issue be reopened or should I file a new Issue?

--
nosy: +gundlach

___
Python tracker 

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



[issue15209] Re-raising exceptions from an expression

2012-06-28 Thread Nick Coghlan

Nick Coghlan  added the comment:

If you don't want the exception context set *at all*, just use a pass statement 
to get out of the exception before trying the fallback.

try:
return windows_module.getch()
except NameError:
pass # No exception chaining
fallback_module.getch()

--

___
Python tracker 

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



[issue15209] Re-raising exceptions from an expression

2012-06-28 Thread Nick Coghlan

Nick Coghlan  added the comment:

Correction, your try block is overbroad and will suppress errors in the getch 
implementation. This is better:

try:
_getch = windows_module.getch
except NameError:
_ getch = fallback_module.getch
_getch()

So I'm sticking with my perspective that wanting to do this is a sign of 
something else being wrong with the exception handling setup.

--

___
Python tracker 

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



[issue1251] ssl module doesn't support non-blocking handshakes

2012-06-28 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

[...]
> 
> Should this Issue be reopened or should I file a new Issue?

I would prefer a new issue to be filed (assuming the error happens
again).

--

___
Python tracker 

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



[issue15209] Re-raising exceptions from an expression

2012-06-28 Thread Ethan Furman

Ethan Furman  added the comment:

Tyler Crompton wrote:
> I'm in a little over my head as I can't conceptualize __cause__, so I may be 
> looking over things.
> 
> First, you, Ethan, said the following:
> 
>> It's also not difficult to work around if you really want to toss the extra 
>> info:
>>
>>except NameError:
>>try:
>>fallback_module.getch()
>>except Exception as exc:
>>raise exc from None
>>
>> A total of three more words to get the desired behavior (and small ones at 
>> that).
> 
> Counter-argument: if it's just three words, then why was the shorthand 
> without the from clause implemented in the first place?

I'm not sure I understand the question -- do you mean why can we do 
'raise' by itself to re-raise an exception?  'from' is new, and was 
added in Py3k (see below).  'raise', as a shortcut, is there to allow 
clean-up (or whatever) in the except clause before re-raising the same 
exception.

In 3.0 exceptions were enhanced to include a link to previous 
exceptions.  So if you are handling exception A and exception B occurs, 
exception B will be raised and will have a link to A.  That link is kept 
in __context__.  This complete chain will then be printed if the last 
exception raised is uncaught.

However, there are times when you may want to add more exception 
information yourself, so we have the `from` clause, which store the 
extra exception in __cause__.

And, there are times when you are changing from one exception to another 
and do not want the previous one displayed -- so we now have 'from None' 
(which sets __suppress_context__ to True).  So if some underlying 
function raises ValueError, but you want to transform that to an 
XyzError, your can do:

 try:
 some_function()
 except ValueError:
 raise XyzError from None

and then, if the exception is uncaught and printed, only the XyzError 
will be displayed (barring custom print handlers).

> My use case was primarily based on the idea that the unavailability of the 
> windows module (from the example) is irrelevant information to, say, Unix 
> users. When an exception is raised, the user shouldn't have to see any 
> Windows-related exceptions (that is if there is an alternate solution).

So you are using the absence of the Windows based module as evidence 
that you are not running on Windows... but what if you are on Windows 
and there is some other problem with that module?

The usual way to code for possible different modules is:

 try:
 import windows_module as utils  # or whatever name
 except ImportError:
 import fallback_module as utils

--

___
Python tracker 

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



[issue15209] Re-raising exceptions from an expression

2012-06-28 Thread Ethan Furman

Ethan Furman  added the comment:

Removed sample code from doc patch as it was not robust, nor recommended 
practice.  New patch is effectively:

 
Note:  Because using :keyword:`from` can throw away valuable debugging 
information, its use with a bare :keyword:`raise` is not supported.

--
Added file: http://bugs.python.org/file26201/raise_from_doc_update_v2.diff

___
Python tracker 

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



[issue15108] ERROR: SystemError: ./../Objects/tupleobject.c:118: bad argument to internal function

2012-06-28 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

I wonder why _pysqlite_fetch_one_row() releases the GIL around 
sqlite3_column_type(). By its name, it doesn't sound like an expensive function.

Another workaround would be to call PyTuple_SET_ITEM instead of PyTuple_SetItem.

--
components: +Extension Modules
nosy: +ghaering, pitrou
versions: +Python 2.7, Python 3.2, Python 3.3 -Python 2.6

___
Python tracker 

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



[issue15219] Leak in "_hashlib.new()" if argument is not a string

2012-06-28 Thread Michael Fötsch

New submission from Michael Fötsch :

If the "name" argument to "_hashlib.new()" is not a string, the reference count 
for the "string" argument is not decremented.

In the file "Modules/_hashopenssl.c", function "EVP_new()", a call to 
"PyBuffer_Release()" is missing:

  if (!PyArg_Parse(name_obj, "s", &name)) {
+ PyBuffer_Release(&view);
  PyErr_SetString(PyExc_TypeError, "name must be a string");
  return NULL;
  }

--
components: Library (Lib)
messages: 164274
nosy: mfoetsch
priority: normal
severity: normal
status: open
title: Leak in "_hashlib.new()" if argument is not a string
type: resource usage
versions: Python 2.7

___
Python tracker 

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



[issue1677] Ctrl-C will exit out of Python interpreter in Windows

2012-06-28 Thread Tim Golden

Tim Golden  added the comment:

Nope. Ctrl-C also sets EOF

--

___
Python tracker 

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



[issue15219] Leak in "_hashlib.new()" if argument is not a string

2012-06-28 Thread Michael Fötsch

Michael Fötsch  added the comment:

The change is against the 2.7 branch. The 3.2 branch is not affected.

--

___
Python tracker 

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



[issue15219] Leak in "_hashlib.new()" if argument is not a string

2012-06-28 Thread Jesús Cea Avión

Jesús Cea Avión  added the comment:

Could you possibly provide a testcase?.

--
nosy: +jcea

___
Python tracker 

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



[issue1677] Ctrl-C will exit out of Python interpreter in Windows

2012-06-28 Thread Tim Golden

Tim Golden  added the comment:

And here's a patch for the default branch, using the new sigint event as 
Kristan suggested.

--
Added file: http://bugs.python.org/file26202/issue1677-python3x.patch

___
Python tracker 

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



[issue5765] stack overflow evaluating eval("()" * 30000)

2012-06-28 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Terry, try a large constant. I can reproduce it on all versions from 2.6 to 3.3 
with eval("()" * 30).

--
nosy: +storchaka
versions: +Python 2.6, Python 3.1, Python 3.2, Python 3.3, Python 3.4

___
Python tracker 

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



[issue15077] Regexp match goes into infinite loop

2012-06-28 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

I think it's a bug. The issue can be closed.

--

___
Python tracker 

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



[issue15077] Regexp match goes into infinite loop

2012-06-28 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

I think it's *not* a bug. The issue can be closed.

--

___
Python tracker 

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



[issue15077] Regexp match goes into infinite loop

2012-06-28 Thread Matthew Barnett

Matthew Barnett  added the comment:

It's not a bug, it's a pathological regex (i.e. it causes catastrophic 
backtracking).

It also works correctly in the "regex" module.

--

___
Python tracker 

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



[issue15108] ERROR: SystemError: ./../Objects/tupleobject.c:118: bad argument to internal function

2012-06-28 Thread Pankaj D

Pankaj D  added the comment:

Wondering the same thing myself, and yes sqlite3_column_type() by itself 
doesn't seem expensive.   I assumed in general it was to allow more 
responsiveness for apps with huge number of columns (i.e. large tuple size).  
But we have about 20-25 columns and so I was going to try removing it and 
seeing the
results. In any case, it seems, fewer GIL acquire/releases  will help with 
throughput.  
Are there any guidelines on when GIL should be released?

Re PyTuple_SET_ITEM...yes that's also a possibility but it would then hide 
genuine bugs.

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

___
Python tracker 

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



[issue15219] Leak in "_hashlib.new()" if argument is not a string

2012-06-28 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

Here is a test, which fails when I run regrtest with leak detection:
./python -m test.regrtest -R:: test_hashlib

--
keywords: +patch
nosy: +amaury.forgeotdarc
Added file: http://bugs.python.org/file26203/hashlib-leak.patch

___
Python tracker 

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



[issue15108] ERROR: SystemError: ./../Objects/tupleobject.c:118: bad argument to internal function

2012-06-28 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> Are there any guidelines on when GIL should be released?

The GIL should be released:
- for CPU-heavy external functions (e.g. compression, cryptography)
- for external functions which wait for I/O

> Re PyTuple_SET_ITEM...yes that's also a possibility but it would then
> hide genuine bugs.

Well, as long as your monitor only increfs the tuple and doesn't mutate
it, there shouldn't be any problem. We use PyTuple_SET_ITEM in many
other places.

--

___
Python tracker 

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



[issue13532] In IDLE, sys.stdout.write and sys.stderr can write any pickleable object

2012-06-28 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

> Does anyone know a good way to make the exception render as: "must be str, 
> not int" instead of "must be str, not " ?

raise TypeError('must be str, not %s' % type(s).__name__)

--
nosy: +storchaka

___
Python tracker 

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



[issue13532] In IDLE, sys.stdout.write and sys.stderr can write any pickleable object

2012-06-28 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

> The following code prevents another prompt from appearing:

And this a more serious issue concerns 3.3.

--
versions: +Python 3.3

___
Python tracker 

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



[issue15217] os.listdir is missing in os.supports_dir_fd

2012-06-28 Thread Arfrever Frehtes Taifersar Arahesis

Changes by Arfrever Frehtes Taifersar Arahesis :


--
nosy: +Arfrever

___
Python tracker 

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



[issue15216] Support setting the encoding on a text stream after creation

2012-06-28 Thread Arfrever Frehtes Taifersar Arahesis

Changes by Arfrever Frehtes Taifersar Arahesis :


--
nosy: +Arfrever

___
Python tracker 

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



[issue15218] Check for all necessary dir_fd and follow_symlinks functions

2012-06-28 Thread Arfrever Frehtes Taifersar Arahesis

Changes by Arfrever Frehtes Taifersar Arahesis :


--
nosy: +Arfrever

___
Python tracker 

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



[issue5765] stack overflow evaluating eval("()" * 30000)

2012-06-28 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

In 3.3.3a4 and b1, with original 3, I no longer get TypeError, but box 
"python(w).exe has stopped working". So either Win7, 64 bit, on machine with 
much more memory makes a diffence, or something in code reverted. Is this 
really a security issue? (If so, up priority?)

--

___
Python tracker 

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



[issue5765] stack overflow evaluating eval("()" * 30000)

2012-06-28 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

I don't think that eval is used in security context.

--

___
Python tracker 

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



[issue15217] os.listdir is missing in os.supports_dir_fd

2012-06-28 Thread Larry Hastings

Larry Hastings  added the comment:

I want to mark this as wontfix.

>>> os.listdir in os.supports_fd
True

The concept we're struggling with here: is the "fd" you pass in to os.listdir a 
"dir_fd"?  I claim that it isn't.  I'm trying to enforce the concept, in both 
the documentation and the code, that "dir_fd" is a directory fd *accompanying a 
path*.  With listdir, it isn't accompanied by a path, it replaces the path.  So 
I suggest it's not a "dir_fd", it's just an "fd" which by sheer coincidence 
happens to reference a directory.

I proposed making os.listdir accept dir_fd, and internally use open and listdir 
to emulate the behavior.  But someone (Antoine?) rightly pointed out, this 
would break the guideline that POSIX os.* functions on Unix-y OSes are atomic.

I might go so far as to say this needs a documentation fix.  But I won't 
condone any sort of code fix (like adding os.listdir to os.supports_dir_fd).

--

___
Python tracker 

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



[issue15217] os.listdir is missing in os.supports_dir_fd

2012-06-28 Thread Hynek Schlawack

Hynek Schlawack  added the comment:

I don't really care about the name but I'd really like some way to check 
whether listdir supports fds.

--

___
Python tracker 

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



[issue15217] os.listdir is missing in os.supports_dir_fd

2012-06-28 Thread Larry Hastings

Larry Hastings  added the comment:

Like I said: use os.supports_fd.

--

___
Python tracker 

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



[issue14133] improved PEP 409 implementation

2012-06-28 Thread Patrick Westerhoff

Patrick Westerhoff  added the comment:

Alright, thought so but wanted a confirmation anyway – thanks a lot :D

--

___
Python tracker 

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



[issue15217] os.listdir is missing in os.supports_dir_fd

2012-06-28 Thread Hynek Schlawack

Hynek Schlawack  added the comment:

Ah sorry, that wasn't in the mail (stupid >>>).

--

___
Python tracker 

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



[issue15220] Reduce parsing overhead in email.feedparser.BufferedSubFile

2012-06-28 Thread R. David Murray

New submission from R. David Murray :

The idea for the attached patch comes from the QNX development team.  In their 
measurements, replacing the re.split-plus-line-reassembly code in 
BufferedSubFile with str.splitlines provided a 30% reduction in email parsing 
time.  The code is also a lot more readable, which is a plus.

The patch is simple enough, and the improvement is large enough, that I'd like 
to apply this to all active branches.

--
components: email
files: feedparser_performance.patch
keywords: patch
messages: 164295
nosy: barry, r.david.murray
priority: normal
severity: normal
stage: patch review
status: open
title: Reduce parsing overhead in email.feedparser.BufferedSubFile
type: performance
versions: Python 2.7, Python 3.2, Python 3.3
Added file: http://bugs.python.org/file26204/feedparser_performance.patch

___
Python tracker 

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



[issue15204] Deprecate the 'U' open mode

2012-06-28 Thread Nadeem Vawda

Nadeem Vawda  added the comment:

+1 for the general idea of deprecating and eventually removing the "U"
modes.

But I agree with David, that it doesn't make sense to have separate steps
for 3.5 and 3.6/4.0. If you make the code raise an exception when "U" is
used, how is that different from what will happen when you remove the
code for processing it? Surely we want it to eventually be treated just
like any other invalid mode string?

--

___
Python tracker 

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



[issue10571] "setup.py upload --sign" broken: TypeError: 'str' does not support the buffer interface

2012-06-28 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
stage: test needed -> patch review
versions: +Python 2.7 -Python 3.4

___
Python tracker 

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



[issue10571] "setup.py upload --sign" broken: TypeError: 'str' does not support the buffer interface

2012-06-28 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
versions:  -Python 2.7

___
Python tracker 

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



[issue10571] "setup.py upload --sign" broken: TypeError: 'str' does not support the buffer interface

2012-06-28 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset ef16a3db4628 by Antoine Pitrou in branch '3.2':
Issue #10571: Fix the "--sign" option of distutils' upload command.
http://hg.python.org/cpython/rev/ef16a3db4628

New changeset b45f105dbdfb by Antoine Pitrou in branch 'default':
Issue #10571: Fix the "--sign" option of distutils' upload command.
http://hg.python.org/cpython/rev/b45f105dbdfb

--
nosy: +python-dev

___
Python tracker 

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



[issue10571] "setup.py upload --sign" broken: TypeError: 'str' does not support the buffer interface

2012-06-28 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Committed. Thank you Jakub!

--
nosy: +pitrou
resolution:  -> fixed
stage: patch review -> committed/rejected
status: open -> closed

___
Python tracker 

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



[issue15219] Leak in "_hashlib.new()" if argument is not a string

2012-06-28 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Looks good to me.

--
assignee:  -> amaury.forgeotdarc
nosy: +pitrou
stage:  -> commit review

___
Python tracker 

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



[issue15219] Leak in "_hashlib.new()" if argument is not a string

2012-06-28 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 49dee01d72f9 by Amaury Forgeot d'Arc in branch '2.7':
Issue #15219: Fix a reference leak when hashlib.new() is called with
http://hg.python.org/cpython/rev/49dee01d72f9

--
nosy: +python-dev

___
Python tracker 

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



[issue15217] os.listdir is missing in os.supports_dir_fd

2012-06-28 Thread Larry Hastings

Larry Hastings  added the comment:

I'm closing this.  os.listdir should not be listed in supports_dir_fd, because 
it has no dir_fd parameter.

For reference, we discussed all this previously in issue #15176.

--
resolution:  -> invalid
stage: needs patch -> committed/rejected
status: open -> closed

___
Python tracker 

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



[issue15219] Leak in "_hashlib.new()" if argument is not a string

2012-06-28 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset c974c99acdf5 by Amaury Forgeot d'Arc in branch 'default':
Port tests from Issue #15219, and verify we don't have a reference leak.
http://hg.python.org/cpython/rev/c974c99acdf5

--

___
Python tracker 

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



[issue15219] Leak in "_hashlib.new()" if argument is not a string

2012-06-28 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

Fixed in 2.7, and ported test to 3.3.
Thanks for the report and the fix!

--
resolution:  -> fixed
stage: commit review -> committed/rejected
status: open -> closed

___
Python tracker 

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



[issue5067] Error msg from using wrong quotes in JSON is unhelpful

2012-06-28 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 9854520c8200 by Antoine Pitrou in branch '3.2':
Issue #5067: improve some json error messages.
http://hg.python.org/cpython/rev/9854520c8200

New changeset 7523ab4e6e06 by Antoine Pitrou in branch 'default':
Issue #5067: improve some json error messages.
http://hg.python.org/cpython/rev/7523ab4e6e06

New changeset 7762816e3fcd by Antoine Pitrou in branch '2.7':
Issue #5067: improve some json error messages.
http://hg.python.org/cpython/rev/7762816e3fcd

--
nosy: +python-dev

___
Python tracker 

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



[issue5067] Error msg from using wrong quotes in JSON is unhelpful

2012-06-28 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Committed now. Thanks Serhiy for the patch!

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

___
Python tracker 

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



[issue15145] Faster *_find_max_char

2012-06-28 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
versions: +Python 3.4 -Python 3.3

___
Python tracker 

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



[issue13968] Support recursive globs

2012-06-28 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
versions: +Python 3.4 -Python 3.3

___
Python tracker 

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



[issue15071] TLS get keys and randoms

2012-06-28 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
versions: +Python 3.4 -Python 3.3

___
Python tracker 

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



[issue11943] Add TLS-SRP (RFC 5054) support to ssl, _ssl, http, and urllib

2012-06-28 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
versions: +Python 3.4 -Python 3.3

___
Python tracker 

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



  1   2   >