[issue14366] Supporting lzma compression in zip files

2012-05-01 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Here is the patch which adds support for lzma in zipfile. Later I'll
move `lzma_props_encode` and `lzma_props_decode` to lzma module.

--
Added file: http://bugs.python.org/file25430/lzma_in_zip.patch

___
Python tracker 

___diff -r 7bdac82c16ab Doc/library/zipfile.rst
--- a/Doc/library/zipfile.rst   Tue May 01 09:00:59 2012 +0200
+++ b/Doc/library/zipfile.rst   Tue May 01 11:29:44 2012 +0300
@@ -97,12 +97,20 @@
 
.. versionadded:: 3.3
 
+.. data:: ZIP_LZMA
+
+   The numeric constant for the LZMA compression method.  This requires the
+   lzma module.
+
+   .. versionadded:: 3.3
+
.. note::
 
   The ZIP file format specification has included support for bzip2 
compression
-  since 2001. However, some tools (including older Python releases) do not
-  support it, and may either refuse to process the ZIP file altogether, or
-  fail to extract individual files.
+  since 2001, and for LZMA compression since 2006. However, some tools
+  (including older Python releases) do not support these compression
+  methods, and may either refuse to process the ZIP file altogether,
+  or fail to extract individual files.
 
 
 .. seealso::
@@ -133,11 +141,11 @@
adding a ZIP archive to another file (such as :file:`python.exe`).  If
*mode* is ``a`` and the file does not exist at all, it is created.
*compression* is the ZIP compression method to use when writing the archive,
-   and should be :const:`ZIP_STORED`, :const:`ZIP_DEFLATED`; or
-   :const:`ZIP_DEFLATED`; unrecognized
-   values will cause :exc:`RuntimeError` to be raised.  If 
:const:`ZIP_DEFLATED` or
-   :const:`ZIP_BZIP2` is specified but the corresponded module
-   (:mod:`zlib` or :mod:`bz2`) is not available, :exc:`RuntimeError`
+   and should be :const:`ZIP_STORED`, :const:`ZIP_DEFLATED`,
+   :const:`ZIP_BZIP2` or :const:`ZIP_LZMA`; unrecognized
+   values will cause :exc:`RuntimeError` to be raised.  If 
:const:`ZIP_DEFLATED`,
+   :const:`ZIP_BZIP2` or :const:`ZIP_LZMA` is specified but the corresponded 
module
+   (:mod:`zlib`, :mod:`bz2` or :mod:`lzma`) is not available, 
:exc:`RuntimeError`
is also raised. The default is :const:`ZIP_STORED`.  If *allowZip64* is
``True`` zipfile will create ZIP files that use the ZIP64 extensions when
the zipfile is larger than 2 GB. If it is  false (the default) 
:mod:`zipfile`
@@ -161,7 +169,7 @@
   Added the ability to use :class:`ZipFile` as a context manager.
 
.. versionchanged:: 3.3
-  Added support for :mod:`bzip2` compression.
+  Added support for :mod:`bzip2` and :mod:`lzma` compression.
 
 
 .. method:: ZipFile.close()
diff -r 7bdac82c16ab Lib/test/support.py
--- a/Lib/test/support.py   Tue May 01 09:00:59 2012 +0200
+++ b/Lib/test/support.py   Tue May 01 11:29:44 2012 +0300
@@ -45,6 +45,11 @@
 except ImportError:
 bz2 = None
 
+try:
+import lzma
+except ImportError:
+lzma = None
+
 __all__ = [
 "Error", "TestFailed", "ResourceDenied", "import_module",
 "verbose", "use_resources", "max_memuse", "record_original_stdout",
@@ -62,7 +67,7 @@
 "get_attribute", "swap_item", "swap_attr", "requires_IEEE_754",
 "TestHandler", "Matcher", "can_symlink", "skip_unless_symlink",
 "import_fresh_module", "requires_zlib", "PIPE_MAX_SIZE", "failfast",
-"anticipate_failure", "run_with_tz", "requires_bz2"
+"anticipate_failure", "run_with_tz", "requires_bz2", "requires_lzma"
 ]
 
 class Error(Exception):
@@ -513,6 +518,8 @@
 
 requires_bz2 = unittest.skipUnless(bz2, 'requires bz2')
 
+requires_lzma = unittest.skipUnless(lzma, 'requires lzma')
+
 is_jython = sys.platform.startswith('java')
 
 # Filename used for testing
diff -r 7bdac82c16ab Lib/test/test_zipfile.py
--- a/Lib/test/test_zipfile.py  Tue May 01 09:00:59 2012 +0200
+++ b/Lib/test/test_zipfile.py  Tue May 01 11:29:44 2012 +0300
@@ -13,7 +13,7 @@
 from random import randint, random
 from unittest import skipUnless
 
-from test.support import TESTFN, run_unittest, findfile, unlink, 
requires_zlib, requires_bz2
+from test.support import TESTFN, run_unittest, findfile, unlink, 
requires_zlib, requires_bz2, requires_lzma
 
 TESTFN2 = TESTFN + "2"
 TESTFNDIR = TESTFN + "d"
@@ -361,6 +361,55 @@
 self.assertEqual(openobj.read(1), b'1')
 self.assertEqual(openobj.read(1), b'2')
 
+@requires_lzma
+def test_lzma(self):
+for f in (TESTFN2, TemporaryFile(), io.BytesIO()):
+self.zip_test(f, zipfile.ZIP_LZMA)
+
+@requires_lzma
+def test_open_lzma(self):
+for f in (TESTFN2, TemporaryFile(), io.BytesIO()):
+self.zip_open_test(f, zipfile.ZIP_LZMA)
+
+@requires_lzma
+def test_random_open_lzma(self):
+for f in (TESTFN2, TemporaryFile(), io.BytesIO()):
+self.zip_random_open_test(f, zipfile.ZIP_LZMA)
+

[issue14366] Supporting lzma compression in zip files

2012-05-01 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Note that the supporting of bzip2 increases the time of testing
test_zipfile in 1.5x, and lzma -- 2x (total 3x). May be not all tests
are needed?

--

___
Python tracker 

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



[issue14532] multiprocessing module performs a time-dependent hmac comparison

2012-05-01 Thread STINNER Victor

STINNER Victor  added the comment:

> However, this generally is not a security risk.

You should explain what you already said: it is not a risk because the
length of a HMAC is fixed.

--

___
Python tracker 

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



[issue14699] Calling a classmethod_descriptor directly raises a TypeError for wrong number of parameters.

2012-05-01 Thread Mark Shannon

Mark Shannon  added the comment:

New patch in response to review.

--
Added file: http://bugs.python.org/file25431/classmethoddescr_call.patch

___
Python tracker 

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



[issue14694] Option to show leading zeros for bin/hex/oct

2012-05-01 Thread Mark Dickinson

Mark Dickinson  added the comment:

I'm rejecting this: the functionality is already there in str.format, and 
there's little to be gained by adding another way to do it.

--
nosy: +eric.smith
resolution:  -> 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



[issue14694] Option to show leading zeros for bin/hex/oct

2012-05-01 Thread Eric V. Smith

Eric V. Smith  added the comment:

I agree with Mark.

This can also be done slightly more efficiently with plain format():

>>> format(324, "016b")
'000101000100'
>>> format(324, "016o")
'0504'
>>> format(324, "016x")
'0144'

And with either format() or str.format(), you can add the appropriate prefix:
>>> format(324, "#016b")
'0b0101000100'
>>> format(324, "#016o")
'0o000504'
>>> format(324, "#016x")
'0x000144'

I don't see ever adding all of the possible options to bin(), etc.

--

___
Python tracker 

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



[issue14082] shutil doesn't copy extended attributes

2012-05-01 Thread Hynek Schlawack

Hynek Schlawack  added the comment:

I have answered to the (two weeks old :-/) review. There are three open 
questions in there we'll have to figure out before I fix the patch:

- should copyxattr() remove xattrs in dst that aren't present in src? Make it 
an option like `remove_missing_xattr`?

- use "None" for `namespaces` in copyxattrs() to indicate we want to copy all 
of them?

- add a ignore_errors option?

ISTM, that "all namespaces" don't make much sense without ignore_errors as 
there seem to be some internal xattr etc. 

Suggestion: copyxattrs() has ignore_errors as default and returns a list of 
xattr it couldn't copy as (xattr, exception) tuples? Or an "on error" handler 
like in rmtree? I'd prefer the first one as ISTM that failures happen more 
often than not.

--
assignee:  -> hynek

___
Python tracker 

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



[issue14662] shutil.move doesn't handle ENOTSUP raised by chflags on OS X

2012-05-01 Thread Hynek Schlawack

Changes by Hynek Schlawack :


--
assignee:  -> hynek
title: shutil.move broken in 2.7.3 on OSX (chflags fails) -> shutil.move 
doesn't handle ENOTSUP raised by chflags on OS X

___
Python tracker 

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



[issue14669] test_multiprocessing failure on OS X Tiger

2012-05-01 Thread Charles-François Natali

Charles-François Natali  added the comment:

The buildbot seems happy, let's close!

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



[issue9400] multiprocessing.pool.AsyncResult.get() messes up exceptions

2012-05-01 Thread Richard Oudkerk

Richard Oudkerk  added the comment:

There are plenty of other "bad" exception classes apart from 
CalledProcessError, including TimeoutExpired in the same file.  In fact I 
suspect this is true of the majority of the exception classes in the stdlib 
which override __init__.  So I am not sure how much good it would do to fix 
just one example.

Python 3.x's Pool wraps bad exception instances in a MaybeEncodingError class 
which at least lets you see a stringification of the original exception.  I am 
not sure whether you would want to see a backport of this.  Even though 2.7 is 
in bug fix mode, I think a backport would still be appropriate since it stops a 
pickling error from killing a worker process, causing a hang.

--

___
Python tracker 

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



[issue13585] Add contextlib.ExitStack

2012-05-01 Thread Nick Coghlan

Nick Coghlan  added the comment:

Latest draft of API is here: 
http://contextlib2_dev.readthedocs.org/en/latest/index.html#contextlib2.ExitStack

An updated version of the "I forgot I could use multiple context managers in a 
with statement" example:

with ExitStack() as stack:
src = open(source)
stack.callback(src.close)
dest = open(destination, 'w')
stack.callback(dest.close)
copy(src, dest)

The example of opening a collection of files remains unchanged (aside from 
s/ContextStack/ExitStack/).

Also see: 
http://contextlib2_dev.readthedocs.org/en/latest/index.html#replacing-any-use-of-try-finally-and-flag-variables

--
assignee: rhettinger -> ncoghlan
resolution: later -> 
title: Add contextlib.CallbackStack -> Add contextlib.ExitStack

___
Python tracker 

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



[issue6759] zipfile.ZipExtFile.read() is missing universal newline support

2012-05-01 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

I know how to remove universal newline support, I know how after this
correct these functions (with issue14371 they partially corrected), but
I don't know how to deprecate universal newline support. What should be
done? Can you initiate a discussion in Python-Ideas or Python-Dev? Now
only zipfile trying to implement this PEP (and failed), io ignores 'U'
mode, gzip checks and raises.

With regard to this issue, I note that there are tests that check that
read() returns unmodified data (UniversalNewlineTests.read_test in
Lib/test/test_zipfile.py). It looks weird, but apparently, this behavior
is expected and deliberate.

--

___
Python tracker 

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



[issue14699] Calling a classmethod_descriptor directly raises a TypeError for wrong number of parameters.

2012-05-01 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset eab5120cc208 by Benjamin Peterson in branch '3.2':
fix calling the classmethod descriptor directly (closes #14699)
http://hg.python.org/cpython/rev/eab5120cc208

New changeset e1a200dfd5db by Benjamin Peterson in branch 'default':
merge 3.2 (#14699)
http://hg.python.org/cpython/rev/e1a200dfd5db

New changeset 6484f5a51285 by Benjamin Peterson in branch '2.7':
fix calling the classmethod descriptor directly (closes #14699)
http://hg.python.org/cpython/rev/6484f5a51285

--
nosy: +python-dev
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



[issue13959] Re-implement parts of imp in pure Python

2012-05-01 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

Windows is currently failing test_imp:

http://www.python.org/dev/buildbot/all/builders/x86%20XP-5%203.x/builds/214/steps/test/logs/stdio

--
nosy: +benjamin.peterson

___
Python tracker 

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



[issue13959] Re-implement parts of imp in pure Python

2012-05-01 Thread Brett Cannon

Brett Cannon  added the comment:

That test is going to stay intermittent until issue #14657 gets resolved else 
the exact reason for the failure is going to be hard to debug remotely.

--

___
Python tracker 

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



[issue14532] multiprocessing module performs a time-dependent hmac comparison

2012-05-01 Thread Jon Oberheide

Jon Oberheide  added the comment:

> You should explain what you already said: it is not a risk because the
> length of a HMAC is fixed.

Well, that's not entirely accurate. Exposing the length of the HMAC can expose 
what underlying hash is being used (eg. HMAC-SHA1 has different length than 
HMAC-MD5). It's generally not considered a risk since exposing the algorithm 
being used shouldn't impact your security (unless you're doing it very wrong).

--

___
Python tracker 

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



[issue1303434] Please include pdb with windows distribution

2012-05-01 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

All active branches use this now.

--
status: open -> closed

___
Python tracker 

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



[issue13183] pdb skips frames after hitting a breakpoint and running step

2012-05-01 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

The test fails on Windows. Whereas on Unix, the two step commands produce this 
output:

-> print('1')
(Pdb) step
1
--Return--
> /net/pao/export/home/staff/loewis/work/33/bar.py(2)bar()->None
-> print('1')
(Pdb) step
--Return--
> /net/pao/export/home/staff/loewis/work/33/main.py(5)foo()->None
-> bar()
(Pdb) quit

on Windows, they produce this output:

-> print('1')
(Pdb) step
--Call--
> c:\users\martin\33\python\lib\encodings\cp850.py(18)encode()
-> def encode(self, input, final=False):
(Pdb) step
> c:\users\martin\33\python\lib\encodings\cp850.py(19)encode()
-> return codecs.charmap_encode(input,self.errors,encoding_map)[0]
(Pdb) quit

I.e. the stepping enters the print, and breaks in the codec.

Reopening the issue.

--
nosy: +loewis
status: closed -> open

___
Python tracker 

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



[issue13183] pdb skips frames after hitting a breakpoint and running step

2012-05-01 Thread Xavier de Gaye

Xavier de Gaye  added the comment:

My fault :(
The call to print is useless for the test, so I suggest to replace it
with a plain 'pass' statement.

--

___
Python tracker 

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



[issue14468] Update cloning guidelines in devguide

2012-05-01 Thread Sandro Tosi

Sandro Tosi  added the comment:

+1

It is important to note that if you have a 'cpython' as a clone (which pulls 
and pushed to hg.python.org) and from it you clone '2.7' and '3.2' (as I think 
it's the most common setup) you first have to pull from cpython and then on the 
other 2.

Anyhow, is anyone up for preparing a patch? else I'll happily work on it in the 
coming days.

--
nosy: +sandro.tosi

___
Python tracker 

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



[issue14468] Update cloning guidelines in devguide

2012-05-01 Thread Éric Araujo

Changes by Éric Araujo :


--
assignee:  -> sandro.tosi

___
Python tracker 

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



[issue14704] NameError Issue in Multiprocessing

2012-05-01 Thread David M. Rogers

New submission from David M. Rogers :

Python Devs,

  There is an issue relating to variable lookup using exec from within 
multiprocessing's fork()-ed process.  I'm attempting to use the forked process 
as a generic remote python shell, but exec is unable to reach variables from 
within functions.  This issue makes it impossible to define a function which 
uses un-passed variables defined in the remote process.

  The simplest way to reproduce the error is:

--- err.py ---
from multiprocessing import Process, Pipe

def run_remote(con, name):
  my_name = name
  for i in range(2):
code = con.recv()
exec code

me, he = Pipe()
p = Process(target=run_remote,
args=(he, "Sono Inglese de Gerrards Cross."))
p.start()

me.send("print my_name") # works

me.send("""
def show_name():
  print my_name
show_name() # doesn't work
""")
--- end err.py ---

This program prints:
$ python2.6 err.py
Sono Inglese de Gerrards Cross.
Process Process-1:
Traceback (most recent call last):
  File "/sw/lib/python2.6/multiprocessing/process.py", line 232, in _bootstrap
self.run()
  File "/sw/lib/python2.6/multiprocessing/process.py", line 88, in run
self._target(*self._args, **self._kwargs)
  File "err.py", line 7, in run_remote
exec code
  File "", line 4, in 
  File "", line 3, in show_name
NameError: global name 'my_name' is not defined

I'm using Mac OSX (10.6.8) and
Python 2.6.5 (r265:79063, Sep 23 2010, 14:05:02) 
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin

The issue (with the same traceback) also occurs for:
Python 2.7 (r27:82500, Sep 29 2010, 15:34:46) 
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin


Using exactly the same set of exec calls locally results in the correct 
behavior.

--- noerr.py ---
my_name = "Sono Inglese de Gerrards Cross."
exec "print my_name"

exec """
def show_name():
  print my_name
show_name()
"""
--- end noerr.py ---

--
components: None
messages: 159764
nosy: frobnitzem
priority: normal
severity: normal
status: open
title: NameError Issue in Multiprocessing
versions: Python 2.6

___
Python tracker 

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



[issue13183] pdb skips frames after hitting a breakpoint and running step

2012-05-01 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

That indeed makes the test pass.

--

___
Python tracker 

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



[issue14704] NameError Issue in Multiprocessing

2012-05-01 Thread Mark Dickinson

Mark Dickinson  added the comment:

Thanks for the report.

This is expected behaviour.  It isn't actually anything to do with 
multiprocessing;  it's to do with invoking exec from within a function scope.  
You can see the same effect with code like this:


code = """\
def show_name():
print my_name
show_name()
"""

def run():
my_name = "me"
exec code

run()


See

http://docs.python.org/reference/executionmodel.html#interaction-with-dynamic-features

for more explanation.

--
nosy: +mark.dickinson
resolution:  -> invalid
status: open -> closed

___
Python tracker 

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



[issue10376] ZipFile unzip is unbuffered

2012-05-01 Thread James Hutchison

James Hutchison  added the comment:

See attached, which will open a zipfile that contains one file and reads it a 
bunch of times using unbuffered and buffered idioms. This was tested on windows 
using python 3.2

You're in charge of coming up with a file to test it on. Sorry.

Example output:

Enter filename: test.zip
Timing unbuffered read, 5 bytes at a time. 10 loops
took 6.67131335449
Timing buffered read, 5 bytes at a time (4000 byte buffer). 10 loops
took 0.7350001335144043

--
Added file: http://bugs.python.org/file25432/zipfiletest.py

___
Python tracker 

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



[issue14687] Optimize str%tuple for the PEP 393

2012-05-01 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 4b98ce6ef95e by Victor Stinner in branch 'default':
Issue #14687: Optimize str%args
http://hg.python.org/cpython/rev/4b98ce6ef95e

New changeset a966f9311ebb by Victor Stinner in branch 'default':
Issue #14687: Cleanup PyUnicode_Format()
http://hg.python.org/cpython/rev/a966f9311ebb

--

___
Python tracker 

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



[issue13183] pdb skips frames after hitting a breakpoint and running step

2012-05-01 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 3b2aa777b725 by Senthil Kumaran in branch '2.7':
fix windows test failure - issue13183
http://hg.python.org/cpython/rev/3b2aa777b725

New changeset d17ecee3f752 by Senthil Kumaran in branch '3.2':
fix windows test failure - issue13183
http://hg.python.org/cpython/rev/d17ecee3f752

New changeset 0269c592c8b1 by Senthil Kumaran in branch 'default':
fix closes issue13183 - windows test failure
http://hg.python.org/cpython/rev/0269c592c8b1

--
status: open -> closed

___
Python tracker 

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



[issue14632] Race condition in WatchedFileHandler leads to unhandled exception

2012-05-01 Thread Brian Curtin

Brian Curtin  added the comment:

The test for this issue seems to fail about half of the time on Windows.


==
ERROR: test_race (test.test_logging.HandlerTest)
--
Traceback (most recent call last):
  File "c:\python-dev\cpython-main\lib\test\test_logging.py", line 605, in 
test_race
h = logging.handlers.WatchedFileHandler(fn, delay=delay)
  File "c:\python-dev\cpython-main\lib\logging\handlers.py", line 421, in 
__init__
logging.FileHandler.__init__(self, filename, mode, encoding, delay)
  File "c:\python-dev\cpython-main\lib\logging\__init__.py", line 965, in 
__init__
StreamHandler.__init__(self, self._open())
  File "c:\python-dev\cpython-main\lib\logging\__init__.py", line 987, in _open
return open(self.baseFilename, self.mode, encoding=self.encoding)
PermissionError: [Errno 13] Permission denied: 
'c:\\users\\brian\\appdata\\local\\temp\\test_logging-3-lxjo5t.log'


I also get this failure when running in the VS2010 branch:

==
ERROR: test_race (test.test_logging.HandlerTest)
--
Traceback (most recent call last):
  File "c:\python-dev\porting\cpython\lib\test\test_logging.py", line 600, in 
cleanup
os.unlink(fn)
PermissionError: [Error 32] The process cannot access the file because it is 
being used by
 another process: 
'c:\\users\\brian\\appdata\\local\\temp\\test_logging3-6ujeil.log'

--
nosy: +brian.curtin

___
Python tracker 

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



[issue13183] pdb skips frames after hitting a breakpoint and running step

2012-05-01 Thread Senthil Kumaran

Senthil Kumaran  added the comment:

Fixed again with replacing print with pass.

But it is strange behavior that "stepping through" enters print in Windows and 
does not so in Unix. What's the difference in windows that could cause this? 
Not sure if this was expected behavior.

--

___
Python tracker 

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



[issue14626] os module: use keyword-only arguments for dir_fd and nofollow to reduce function count

2012-05-01 Thread Larry Hastings

Larry Hastings  added the comment:

> I personally think that offering mere wrappers around syscalls doesn't
> make much sense: Python is a very-high level language, and so should
> its library be.

I very much agree.  I suggest anyone who thinks the os module is a thin
veneer over syscalls needs to examine the Win32 implementation of os.stat.


> - *at() syscalls are not portable: if it's not supported, what's
> remove(path='toto', dir_fd=fd) supposed to do? Throw an exception?

NotImplementedError.


> - it's not clear how one's supposed to check that the functions are
> available: right now, one can do [a hasattr check]
> How would that work with dir_fd argument?

try/except.  If someone (maybe even me) championed PEP 362 (Function
Signature Object, introspection on functions) then we could LBYL,
but that's only a theory right now.


>   stat(path, *, followlinks=True, dirfd=None)
> is backwards, it should be
>   stat(dirfd, path, *, followlinks=True)
> since, `path` is relative to `dirfd`.

You could hypothetically rearrange all the arguments
at the call site by using 100% keyword arguments:
  stat(dir_fd=whatever, path=thingy, follow_symlinks=True)

I admit it's unlikely anyone will bother.


> Actually, the proper way to do this would be to use overloading, but
> Python doesn't support it (and even if it did, I think overloading
> would probably be a bad idea anyway).

Speaking *purely hypothetically*, we could actually overload it.  It'd
be at runtime, as what in Python is not.  Since stat is implemented in
C it would look like:

  if (-1 == PyArg_ParseTupleAndKeyword(arguments-with-dir_fd)) {
PyErr_Clear();
if (-1 == PyArg_ParseTupleAndKeyword(arguments-without-dir_fd)) {
  /* etc. */

However, Python doesn't have overloading because we shouldn't do it.
I'm against overloading here, for the same reason that I'm against
argument polymorphism (fold faccess into access by allowing the first
argument to be either an int or a string).  This sort of polymorphism
leads to lack of clarity and awkward problems.


> I'll probably have to think some time to understand what the hell is
> the last dir_fd argument. Renaming, removing a file is simple and
> direct, so should the API be.

I counter with TOOWWTDI.  There are currently four chmod functions in
os: chmod, fchmod, fchmodat, and lchmod.  If you want to change the
mode of a file, which do you use?

You may also face the problem that you don't want chmod to follow
symbolic links, yet you've never heard of lchmod.

I feel the sad truth of the situation is, it is desirable that Python
support all this functionality, but there is no simple and
obviously-right way to do so.  So which alternative is less undesirable:
a combinatoric explosion of functions, or a combinatoric explosion of
arguments to existing functions?  I suggest the latter is less
undesirable because it is marginally clearer: at least you always
know which function to call, and the documentation on how to use it
in its multiple forms will be all in one place.

(Though this would not help the hapless programmer who suspected maybe
there *was* a second function somewhere, searching forever for a
function that doesn't actually exist.)

Also, I suggest that the programmer reading the documentation for os
would see the same parameters (dir_fd, follow_symlinks) as part of many
different functions and would quickly learn their semantics.


> - finally, although useful, the *at() family is a really poor and
> confusing API, which will likely be used by less than 0.1% of the
> overall Python users. Complicating the whole posix module API just
> to shave off a few functions is IMHO a bad idea.

I understand your critique.  In defense of the proposal, I will say that
when Guido asked me to connect with the storchaka and try to shepherd
the process, he specifically cited the *at() functions as examples of
new functions that could be obviated by folding the functionality
into the existing APIs.

Not that I claim this gives me carte blanche to check an implementation
in.  Simply that I believe Guido liked the idea in the abstract.  It
could be that he wouldn't like the result, or that my proposal (which
purposely carried out the idea to its logical extreme) goes too far.

In the absence of a BDFL ruling on the proposal, I think I should
produce a patch implementing the full proposal, then bring it up in
c.l.p-d and get a community vote.  How's that sound?

--

___
Python tracker 

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



[issue13210] Support Visual Studio 2010

2012-05-01 Thread Brian Curtin

Brian Curtin  added the comment:

As of a40f47cc7691, Richard's idea is now the implementation, which seems to 
work well and has simplified the changes quite well. Attached is 
code_changes.diff which shows all of the necessary code changes as of now.

The test_import failure you were originally seeing has gone away (it was on 
default as well, I guess it has been fixed). test_email fails on the default 
branch as well so nothing new there.

--
Added file: http://bugs.python.org/file25433/code_changes.diff

___
Python tracker 

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



[issue13183] pdb skips frames after hitting a breakpoint and running step

2012-05-01 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

> But it is strange behavior that "stepping through" enters print in
> Windows and does not so in Unix. What's the difference in windows
> that could cause this? Not sure if this was expected behavior.

On Unix, the codec most likely is UTF-8, which is directly written
in C, i.e. doesn't support Python single-stepping.

--

___
Python tracker 

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



[issue13183] pdb skips frames after hitting a breakpoint and running step

2012-05-01 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 6c9ce7e34511 by Martin v. Löwis in branch 'default':
Issue #13183: Revert 0b53b70a40a0 (reenable test on windows)
http://hg.python.org/cpython/rev/6c9ce7e34511

--

___
Python tracker 

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



[issue9377] socket, PEP 383: Mishandling of non-ASCII bytes in host/domain names

2012-05-01 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

For Windows versions that support it, we could use GetNameInfoW, available on 
XPSP2+, W2k3+ and Vista+.

The questions then are: what to do about gethostbyaddr, and what to do about 
the general case?

Since the problem appears to be specific to Windows, it might be appropriate to 
find a solution to just the Windows case, and ignore the general issue. For 
gethostbyaddr, decoding would then use CP_ACP.

--

___
Python tracker 

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



[issue9123] insecure os.urandom on VMS

2012-05-01 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

I'm closing this as "won't fix". Unless somebody is able to report that they 
actually tested the proposed change successfully, there is no point in adding 
it. Most likely, Python won't even build on VMS, in which case this is not a 
security issue at all.

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



[issue14530] distutils's build_wininst command fails to correctly interpret the data_files argument

2012-05-01 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

Mario: would you like to work on a patch?

--

___
Python tracker 

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



[issue14529] distutils's build_msi command ignores the data_files argument

2012-05-01 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

Mario: would you like to work on a patch?

--

___
Python tracker 

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



[issue14656] Add a macro for unreachable code

2012-05-01 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

Sorry, I missed the patch. I still fail to see the problem that this solves: 
what compiler produces "control reaches end of non-void function without 
return" for the current code? ISTM that your patch has the potential of 
*introducing* such a warning on some compilers, since you are removing the 
return statement (and the compiler may not be smart enough to determine that 
Py_FatalError does not return).

--

___
Python tracker 

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