[issue9077] argparse does not handle arguments correctly after --

2010-06-29 Thread Georg Brandl

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

No, this is not intentional.  Look at the docs for these attributes:

parser.largs
the current list of leftover arguments, ie. arguments that have been 
consumed but are neither options nor option arguments. Feel free to modify 
parser.largs, e.g. by adding more arguments to it. (This list will become args, 
the second return value of parse_args().)
parser.rargs
the current list of remaining arguments, ie. with opt_str and value (if 
applicable) removed, and only the arguments following them still there. Feel 
free to modify parser.rargs, e.g. by consuming more arguments.


In short, they are used *while* parsing options, and have no meaning 
afterwards; that the OptionParser stops moving items from rargs to largs after 
the -- is an implementation detail.

--

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



[issue4925] Improve error message of subprocess when cannot open

2010-06-29 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc amaur...@gmail.com added the comment:

in PC/_subprocess.c, it should be enough to use 
PyErr_SetFromWindowsErrWithFilename() instead of PyErr_SetFromWindowsErr()

--
keywords: +easy
nosy: +amaury.forgeotdarc

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



[issue9112] argparse missing documentation for error() method

2010-06-29 Thread Mark Summerfield

New submission from Mark Summerfield m...@qtrac.eu:

The argparse module's ArgumentParser class has an error() method that appears 
to have the same behavior as the optparse error() method, but this method is 
not mentioned in the documentation.

--
assignee: d...@python
components: Documentation
messages: 108896
nosy: d...@python, mark
priority: normal
severity: normal
status: open
title: argparse missing documentation for error() method
versions: Python 2.7, Python 3.2

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



[issue5180] 3.1 cannot unpickle 2.7-created pickle

2010-06-29 Thread Antoine Pitrou

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

 Well, this is not so obviously wrong as you make it sound.  If you
 look closer at object_new(), you will see that in sane situations it
 reduces to type-tp_alloc(type, 0) call.

Today, yes. But tomorrow it may entail additional operations.

 If such sanity check is necessary, I would rather check the flag
 explicitly in _pickle.c rather than having to generate dummy args and
 kwds to satisfy tp_new signature.

I find it better to generate dummy args and kwds to satisfy tp_new
signature. I see no point in a partial inlining of an internal function
when we could call it instead.

  So, IMO, the right thing to do would be to choose the first base
  type that isn't a Python-defined class and use its tp_new:
 
 staticbase = subtype;
 while (staticbase  (staticbase-tp_flags  Py_TPFLAGS_HEAPTYPE))
 staticbase = staticbase-tp_base;
 
  (these two lines are from tp_new_wrapper() in typeobject.c)
 
 
 This looks like overengineering to me.  I think 3.x should simply
 refuse to unpickle old style class instances into anything that is not
 subclassed in python directly from object.

Right, but it would lead to almost the same code... Since you have to
find the first non-Python base type and check that it is object.

 It would be helpful at this point if you could provide a test case
 where tp_alloc logic does not work.

I'll try to find one.

 PPS: What is you opinion on the pickle.py trick of monkey patching
 __class__ on an instance of an empty class?  Do you think this can be
 fooled?

I don't think so.

--

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



[issue9106] remove numbers from 3-.. level entries in docs toc

2010-06-29 Thread Georg Brandl

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

This should be taken to the Sphinx tracker, as the feature needs to be 
implemented first.

--
nosy: +georg.brandl
status: open - closed

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



[issue8799] Hang in lib/test/test_threading.py

2010-06-29 Thread Zsolt Cserna

Changes by Zsolt Cserna zsolt.cse...@morganstanley.com:


--
nosy: +csernazs

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



[issue9106] remove numbers from 3-.. level entries in docs toc

2010-06-29 Thread anatoly techtonik

anatoly techtonik techto...@gmail.com added the comment:

http://bitbucket.org/birkenfeld/sphinx/issue/460/strip-section-numbers-from-toc-menu

--

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



[issue9113] Tools/msi still uses string exceptions

2010-06-29 Thread Matthias Klose

New submission from Matthias Klose d...@debian.org:

string exceptions still used in a couple of places:

Tools/msi/msi.py:354
Tools/msi/msi.py:368
Tools/msi/msilib.py:238

--
components: Demos and Tools
messages: 108900
nosy: doko
priority: normal
severity: normal
status: open
title: Tools/msi still uses string exceptions
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2

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



[issue3823] ssl.wrap_socket() is incompatible with servers that drop privileges, due to keyfile requirement

2010-06-29 Thread Matt Joiner

Matt Joiner anacro...@gmail.com added the comment:

I take it this is out for 2.7, will it be in 3.2?

--
nosy: +anacrolix

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



[issue9114] br string literals don't appear to be documented

2010-06-29 Thread Mark Summerfield

New submission from Mark Summerfield m...@qtrac.eu:

It appears that br (raw bytes) isn't documented, at least not along with 
string and bytes literals:
http://docs.python.org/py3k/reference/lexical_analysis.html#literals

Yet they are supported:
http://mail.python.org/pipermail/python-ideas/2010-June/007529.html

--
assignee: d...@python
components: Documentation
messages: 108902
nosy: d...@python, mark
priority: normal
severity: normal
status: open
title: br string literals don't appear to be documented
versions: Python 3.1, Python 3.2

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



[issue9114] br string literals don't appear to be documented

2010-06-29 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
nosy: +ezio.melotti

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



[issue9113] Tools/msi still uses string exceptions

2010-06-29 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
nosy: +ezio.melotti

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



[issue2504] Add gettext.pgettext() and variants support

2010-06-29 Thread Éric Araujo

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


--
resolution:  - accepted
stage:  - needs patch

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



[issue1288056] pygettext: provide comments to help translators

2010-06-29 Thread Éric Araujo

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

It appears that I had mistaken comments in the source and comments in the 
pot/po files:

 /* TRANSLATORS: The placeholder indicates etc. */
 printf (_(Something.\n));

These will be extracted by ‘xgettext’, leading to a .pot file that contains 
this:

 #. TRANSLATORS: The placeholder indicates etc.
 #: src/hello.c:178
 #, c-format
 msgid Report bugs to %s.\n
 msgstr 


(From http://www.gnu.org/software/gettext/manual/gettext.html)

--
stage:  - needs patch
title: pygettext - provide comments to help translators - pygettext: provide 
comments to help translators
versions: +Python 3.2 -Python 2.6

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



[issue1288056] pygettext: extract translators comments

2010-06-29 Thread Éric Araujo

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


--
title: pygettext: provide comments to help translators - pygettext: extract 
translators comments

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



[issue3428] httplib.HTTPMessage undocumented

2010-06-29 Thread Senthil Kumaran

Senthil Kumaran orsent...@gmail.com added the comment:

On Mon, Jun 28, 2010 at 08:51:58PM +, ThomasH wrote:
 But the urllib.rst documentation is still flawed:

Fixed now in the r82363. Did a find and grep on all instances of
HTTPMessage and verified that it is only at proper places now.

Thanks for pointing out.

--

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



[issue9112] argparse missing documentation for error() method

2010-06-29 Thread R. David Murray

Changes by R. David Murray rdmur...@bitdance.com:


--
nosy: +bethard

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



[issue9106] remove numbers from 3-.. level entries in docs toc

2010-06-29 Thread R. David Murray

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

If the change is confined to the left menu bar only, I'd be happy to have the 
numbers go away entirely.  But only putting in partial numbers strikes me as an 
invitation to confusion.  If other people prefer your scheme that's fine with 
me.  Almost the only time I look at the left menu bar (except on the front page 
of docs) is when I want to find the 'show source' link.

--
versions: +Python 3.1

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



[issue9110] contextlib.ContextDecorator

2010-06-29 Thread Nick Coghlan

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

Looks pretty good to me, but you may want to doublecheck some of your test 
criteria.

Firstly, the two *_with_exception checks don't look quite right to me. I 
would have expected to see something like the following for both of them: 

  self.assertIsNotNone(context.exc)
  self.assertIs(context.exc[0], NameError).

Secondly, I can't even begin to guess what the method decoration test is 
currently trying to show. Why 3 instantiations? Why check the instance 
assignments rather than the context manager behaviour? Either I'm completely 
missing something, or this currently isn't testing what you meant to test :)

Finally, you may as well include a second typo test to cover the __enter__ 
misspelling case.

--

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



[issue9110] contextlib.ContextDecorator

2010-06-29 Thread Michael Foord

Michael Foord mich...@voidspace.org.uk added the comment:

Hey Nick,

The tests are pretty much just copied from the previous version, so they aren't 
all appropriate. In fact I think that the first two tests (and even the typo 
tests) can just go as they really just test Python semantics and not the 
ContextDecorator itself.

The method tests are testing that the arguments (including keyword arguments) 
are properly passed through to the decorated function. I started to write a 
comment to that effect as I realised it wasn't obvious, but forgot to finish 
the comment... Separate instantiations just mean we don't need to worry about 
previous values.

(I did them as methods as I was *starting* to write a test for general 
descriptor decorating - but the general case for that is very hard to solve so 
people just have to use their decorators in the right order instead. 
Nonetheless it is nice to have a test that decorates a method as well as the 
other function decorating tests.)

Your improvement to the exceptions tests are good.

--

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



[issue9106] remove numbers from 3-.. level entries in docs toc

2010-06-29 Thread Éric Araujo

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

+1 for removing numbers.

--
nosy: +merwok

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



[issue9103] API keyword

2010-06-29 Thread Éric Araujo

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


--
stage:  - committed/rejected

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



[issue9095] patchcheck should handle extraneous whitespace in .rst files

2010-06-29 Thread Éric Araujo

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

Feel free to assign patchcheck bugs to me. I’ll write a patch and then assign 
to you for review.

--
nosy: +merwok
resolution:  - accepted

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



[issue9115] test_site: support for systems without unsetenv

2010-06-29 Thread Zsolt Cserna

New submission from Zsolt Cserna zsolt.cse...@morganstanley.com:

On systems where there's no unsetenv function (for example solaris 8), 
test_site fails because the PYTHONUSERBASE environment variable remains set to 
xoxo (set in the previous tests).

This results a failed test_s_option test.

--
components: Tests
files: test_site.py.diff
keywords: patch
messages: 108910
nosy: csernazs
priority: normal
severity: normal
status: open
title: test_site: support for systems without unsetenv
type: behavior
versions: Python 2.7
Added file: http://bugs.python.org/file17799/test_site.py.diff

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



[issue9110] contextlib.ContextDecorator

2010-06-29 Thread Nick Coghlan

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

On Wed, Jun 30, 2010 at 12:13 AM, Michael Foord rep...@bugs.python.org wrote:

 Michael Foord mich...@voidspace.org.uk added the comment:

 Hey Nick,

 The tests are pretty much just copied from the previous version, so they 
 aren't all appropriate. In fact I think that the first two tests (and even 
 the typo tests) can just go as they really just test Python semantics and not 
 the ContextDecorator itself.

Ah, yep, I can see how they would have been more important with the
old 2.4 compatible implementation. However, it's still useful to keep
them as a sanity check that the test context manager isn't doing
anything silly (i.e. if they pass and the decorator tests fail,
ContextDecorator is obviously at fault, whereas without these first
two tests the bug could be in the test context manager).

 The method tests are testing that the arguments (including keyword arguments) 
 are properly passed through to the decorated function. I started to write a 
 comment to that effect as I realised it wasn't obvious, but forgot to finish 
 the comment... Separate instantiations just mean we don't need to worry about 
 previous values.

 (I did them as methods as I was *starting* to write a test for general 
 descriptor decorating - but the general case for that is very hard to solve 
 so people just have to use their decorators in the right order instead. 
 Nonetheless it is nice to have a test that decorates a method as well as the 
 other function decorating tests.)

That makes sense, but a comment to that effect would be *very* helpful :)

Comments on the docs patch (I neglected to look at that initially):

For the @contextmanager updates, I would move the description of the
effect into an extra paragraph in the main body of the description,
then just use the versionadded tag to when the change was made.

For the ContextDecorator description itself, you may want to write the
last part of the first example (i.e. just the with statement) in a
doctest layout so you can show the expected output.

--

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



[issue1581183] pickle protocol 2 failure on int subclass

2010-06-29 Thread Alexander Belopolsky

Alexander Belopolsky belopol...@users.sourceforge.net added the comment:

At least part of the problem has nothing to do with subclassing from int and 
instead is related to pickling objects with circular references.

I am attaching a patch that demonstrates the problem.  In 
issue1581183-test.diff, I modified memoize so that it does nothing rather than 
fails an assert if object is already in the memo.  This makes python and C 
implementations behave the same, but still fail to produce correct results. 
Pickling with protocol 2 break circular reference and instead creates two 
independent objects.

--
assignee:  - belopolsky
keywords: +patch
Added file: http://bugs.python.org/file17800/issue1581183-test.diff

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



[issue9114] br string literals don't appear to be documented

2010-06-29 Thread Benjamin Peterson

Benjamin Peterson benja...@python.org added the comment:

Fixed in r82373.

--
nosy: +benjamin.peterson
resolution:  - fixed
status: open - closed

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



[issue9116] test_capi.test_no_FatalError_infinite_loop crash on Windows

2010-06-29 Thread Brian Curtin

New submission from Brian Curtin cur...@acm.org:

Debug and Release builds of py3k both throw up a Visual Studio debugger prompt 
when running this test on Windows. I don't have much time at the moment to 
investigate, but I find it odd that this isn't occurring on the two Windows 
py3k buildbots.



Output of the release build after selecting not to debug:

C:\python-dev\py3kPCbuild\amd64\python.exe -m test.regrtest test_capi
test_capi
test test_capi failed -- Traceback (most recent call last):
  File C:\python-dev\py3k\lib\test\test_capi.py, line 50, in 
test_no_FatalError_infinite_loop
b'Fatal Python error:'
AssertionError: bFatal Python error: PyThreadState_Get: no current thread\r\n\r
\nThis application has requested the Runtime to terminate it in an unusual way.\
nPlease contact the application's support team for more information. != b'Fatal
 Python error: PyThreadState_Get: no current thread'

1 test failed:
test_capi

--
components: Interpreter Core, Tests
messages: 108914
nosy: brian.curtin
priority: normal
severity: normal
status: open
title: test_capi.test_no_FatalError_infinite_loop crash on Windows
type: crash
versions: Python 3.2

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



[issue9116] test_capi.test_no_FatalError_infinite_loop crash on Windows

2010-06-29 Thread Brian Curtin

Brian Curtin cur...@acm.org added the comment:

I should also note that this doesn't appear to happen on release31-maint or 
trunk.

--

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



[issue1581183] pickle protocol 2 failure on int subclass

2010-06-29 Thread Alexander Belopolsky

Changes by Alexander Belopolsky belopol...@users.sourceforge.net:


Removed file: http://bugs.python.org/file17800/issue1581183-test.diff

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



[issue1581183] pickle protocol 2 failure on int subclass

2010-06-29 Thread Alexander Belopolsky

Changes by Alexander Belopolsky belopol...@users.sourceforge.net:


Added file: http://bugs.python.org/file17801/issue1581183-test.diff

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



[issue9114] br string literals don't appear to be documented

2010-06-29 Thread Éric Araujo

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


--
stage:  - committed/rejected

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



[issue3823] ssl.wrap_socket() is incompatible with servers that drop privileges, due to keyfile requirement

2010-06-29 Thread Antoine Pitrou

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

 I take it this is out for 2.7, will it be in 3.2?

The patch for issue8550 has been committed. The SSLContext API should solve 
this issue:
http://docs.python.org/dev/py3k/library/ssl.html#ssl.SSLContext.wrap_socket

If it doesn't, please explain why.

--
resolution: accepted - fixed
status: open - closed

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



[issue9117] class syntax not fully documented in reference manual

2010-06-29 Thread Mark Dickinson

New submission from Mark Dickinson dicki...@gmail.com:

Looking at:

http://docs.python.org/dev/py3k/reference/compound_stmts.html#class-definitions

I see:

classdef::=  [decorators] class classname [inheritance] : suite
inheritance ::=  ( [expression_list] )
classname   ::=  identifier

this seems to be missing the keyword arguments that are now possible in a 
classdef (e.g. for specifying a metaclass).  I believe that *args and **kwargs 
are now also syntactically accepted in a class definition.

--
assignee: d...@python
components: Documentation
messages: 108917
nosy: d...@python, mark.dickinson
priority: normal
severity: normal
status: open
title: class syntax not fully documented in reference manual
versions: Python 3.1, Python 3.2

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



[issue9117] class syntax not fully documented in reference manual

2010-06-29 Thread Mark Dickinson

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

Am working on a patch.

--

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



[issue1581183] pickle protocol 2 failure on int subclass

2010-06-29 Thread Alexander Belopolsky

Alexander Belopolsky belopol...@users.sourceforge.net added the comment:

Upon further investigation, I conclude that the problem is in the user code.  I 
am attaching int_subclass_pickle_problem_fixed.py which fixes the user code as 
follows:

 def __getnewargs__(self):
-return (int(self), self.an_enum)
+return (int(self), None)

Note that with this change, the object is pickled correctly because 
__setstate__ takes care of resetting self.an_enum.

The problem is that self-referential state should not be passed via 
__getnewargs__ mechanism.  This is because when pickler starts writing newargs, 
it is already committed to creating a new object (otherwise it would not need 
to serialize newargs in the first place.)  If the newargs contain the object 
that is being pickled, it will be serialized twice unless this situation is 
caught in memoize.

What can be improved, is the diagnostic and possibly documentation.  If after 
saving newargs, memo contains the object that is being pickled, an exception 
should be raised explaining that __getnewargs__() should not contain 
self-references.

--
keywords:  -patch
priority: normal - low

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



[issue9117] class syntax not fully documented in reference manual

2010-06-29 Thread Alexander Belopolsky

Alexander Belopolsky belopol...@users.sourceforge.net added the comment:

 I believe that *args and **kwargs are now also syntactically
 accepted in a class definition.

Indeed:

 class a: pass
 class b: pass
 bases = (a, b)
 class c(*bases): pass
 kwds = {'metaclass':type}
 class c(*bases, **kwds): pass

works!

--
nosy: +belopolsky

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



[issue8998] add crypto routines to stdlib

2010-06-29 Thread Marc-Andre Lemburg

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

Apart from the question of API, please also include a section on the legal 
implications this move would have on Python in the PEP.

We currently only include OpenSSL in the Windows installers and (for some 
reason) don't pay much attention to the implications this has (the fact is not 
mentioned on the download page and the Windows installer doesn't show the 
required OpenSSL old-style BSD attribution).

If we are to require OpenSSL or some other crypto lib, possibly even our own 
(e.g. pycrypto) for all platforms, then we could no longer just ignore the fact 
that crypto code is subject to strong legislation in many countries of the 
world.

--
nosy: +lemburg

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



[issue6827] deepcopy erroneously doesn't call __setstate__ if __getstate__ returns empty dict

2010-06-29 Thread Alexander Belopolsky

Alexander Belopolsky belopol...@users.sourceforge.net added the comment:

I see the following under 
http://docs.python.org/dev/py3k/library/pickle.html#pickling-class-instances:

Note If __getstate__() returns a false value, the __setstate__() method will 
not be called.  That was added in r62216 and highlighted in r67045.

Is there anything else that needs to be done here?

--
assignee:  - belopolsky
nosy: +belopolsky
status: open - pending

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



[issue8998] add crypto routines to stdlib

2010-06-29 Thread Antoine Pitrou

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

 If we are to require OpenSSL or some other crypto lib,

We already depend on OpenSSL for both hashlib and ssl, this proposal
wouldn't change anything in this regard.

--

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



[issue9117] class syntax not fully documented in reference manual

2010-06-29 Thread Mark Dickinson

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

It looks like fixing the production list is the easy part (see attached patch): 
 as far as I can tell, the *syntax* for class definitions is pretty much 
identical to that for function calls.  (The semantics are different, of 
course.)  It would be good if someone could check this patch for sanity, though.

The description in that section still needs updating.

--
keywords: +patch
Added file: http://bugs.python.org/file17802/issue9117.patch

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



[issue9095] patchcheck should handle extraneous whitespace in .rst files

2010-06-29 Thread Brett Cannon

Brett Cannon br...@python.org added the comment:

Knock yourself out!

--
assignee:  - merwok

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



[issue8998] add crypto routines to stdlib

2010-06-29 Thread Marc-Andre Lemburg

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

Antoine Pitrou wrote:
 
 Antoine Pitrou pit...@free.fr added the comment:
 
 If we are to require OpenSSL or some other crypto lib,
 
 We already depend on OpenSSL for both hashlib and ssl, this proposal
 wouldn't change anything in this regard.

hashlib can still works without OpenSSL and hash algorithms don't
fall under crypto laws. ssl doesn't work without OpenSSL, but also
doesn't require adding any crypto code to the stdlib.

The main point that needs to be addressed is shipping Python
with crypto code. If OpenSSL is optionally used, we're fine,
but if we start shipping crypto code, things are more contrived.

See http://rechten.uvt.nl/koops/cryptolaw/ for a survey.

We're hosting the Python software on servers in The Netherlands,
so have to follow the Wassenaar Arrangement if we include
crypto code. Fortunately, that agreement includes a clause which
pretty much exempts open source crypto code from export regulations.

However, users of Python downloading installers with crypto software
would import and use it in their resp. countries and that may get
them into trouble, so they need to be warned if we decide to
ship crypto code with Python.

They way I understand Geremy's suggestion is to just include a
wrapper for OpenSSL, so that's fine. The PEP should include a
mention of the above to argue against putting e.g. pycrypto
into the stdlib (not because it's poor software, much to the
contrary, only because it causes lots of problems for our
users and the developers).

--

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



[issue9071] TarFile doesn't support member files with a leading ./

2010-06-29 Thread Gustavo Niemeyer

Gustavo Niemeyer gust...@niemeyer.net added the comment:

Indeed, nice use of the time machine! :-)

Thanks Lars!

--

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



[issue9118] help() on a property descriptor launches interactive help

2010-06-29 Thread Jack Diederich

New submission from Jack Diederich jackd...@gmail.com:

ython 2.7b2+ (trunk:81337, May 19 2010, 12:16:22) 
[GCC 4.4.3] on linux2
Type help, copyright, credits or license for more information.
 class X(object):
...   @property
...   def foo(self): pass
... 
 help(X.foo.fset)

Welcome to Python 2.7!  This is the online help utility.

If this is your first time using Python, you should definitely check out
the tutorial on the Internet at http://docs.python.org/tutorial/.

Enter the name of any module, keyword, or topic to get help on writing
Python programs and using Python modules.  To quit this help utility and
return to the interpreter, just type quit.

To get a list of available modules, keywords, or topics, type modules,
keywords, or topics.  Each module also comes with a one-line summary
of what it does; to list the modules whose summaries contain a given word
such as spam, type modules spam.

help ^D
You are now leaving help and returning to the Python interpreter.
If you want to ask for help on a particular object directly from the
interpreter, you can type help(object).  Executing help('string')
has the same effect as typing a particular string at the help prompt.


--
components: Library (Lib)
messages: 108928
nosy: jackdied
priority: low
severity: normal
stage: needs patch
status: open
title: help() on a property descriptor launches interactive help
type: behavior
versions: Python 2.6, Python 2.7

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



[issue9119] Python download page needs to mention crypto code in Windows installer

2010-06-29 Thread Marc-Andre Lemburg

New submission from Marc-Andre Lemburg m...@egenix.com:

This needs to be done to protect our users (importing crypto code or using it 
may be illegal in their home country, see 
http://rechten.uvt.nl/koops/cryptolaw/ for a survey) and to satisfy an 
attribution requirement in the OpenSSL license and code base:


This product includes cryptographic software written by Eric Young 
(e...@cryptsoft.com). This product includes software written by Tim Hudson 
(t...@cryptsoft.com). This product includes software developed by the OpenSSL 
Project for use in the OpenSSL Toolkit. (http://www.openssl.org/)


--
assignee: d...@python
components: Build, Documentation
messages: 108929
nosy: d...@python, lemburg
priority: normal
severity: normal
status: open
title: Python download page needs to mention crypto code in Windows installer
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3

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



[issue9119] Python download page needs to mention crypto code in Windows installer

2010-06-29 Thread Marc-Andre Lemburg

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

See the OpenSSL license for details on the notice requirement:

http://www.openssl.org/source/license.html

--

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



[issue8998] add crypto routines to stdlib

2010-06-29 Thread Marc-Andre Lemburg

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

Marc-Andre Lemburg wrote:
 
 We currently only include OpenSSL in the Windows installers and (for some 
 reason) don't pay much attention to the implications this has (the fact is 
 not mentioned on the download page and the Windows installer doesn't show the 
 required OpenSSL old-style BSD attribution).

I've opened issue9119 to address this part.

--

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



[issue9119] Python download page needs to mention crypto code in Windows installer

2010-06-29 Thread geremy condra

Changes by geremy condra debat...@gmail.com:


--
nosy: +debatem1

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



[issue9117] class syntax not fully documented in reference manual

2010-06-29 Thread Alexander Belopolsky

Alexander Belopolsky belopol...@users.sourceforge.net added the comment:

The production looks right to me, but I think it should be broken in two or 
more lines.  Since it is rendered pre-formatted, long line results in a 
horizontal scroll bar unless the browser window is extremely wide.

--

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



[issue7673] audioop: check that length is a multiple of the size

2010-06-29 Thread Mark Dickinson

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

The patch looks fine to me.

- Please could you add some tests, to exercise the 'not a whole number of 
frames' errors?

- The patch obviously predates the grand reindenting, so its indentation needs 
fixing up

PEP 7 nits:

 - Please don't put spaces just inside the parens in an 'if' statement:  i.e., 
use if (size != 1 ...), not if ( size != 1 ...)  (I notice that the if ( x 
== NULL ) style is already prevalent, though not universal, in the module, 
though.)

 - the 'else' clause of an if should be at the start of the line (i.e.,
on a new line below the closing brace of the 'if', if present)

Is there any particular reason that Python 3.1 is not included in the versions?

--
nosy: +mark.dickinson

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



[issue4963] mimetypes.guess_extension result changes after mimetypes.init()

2010-06-29 Thread R. David Murray

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

It must be that the different key order only happens on the one platform 
because of the quirky nature of dictionary construction.  That is, there is 
*something* on that platform that is changing where things get hashed when the 
dictionary is recreated.

The problem with fixing this is that any fix is going to change the behavior, 
unless we go to the lengths of recording the order of the initializations in 
add_type and replay it when init is called a second time.  That solution is 
pretty much a non-starter :)

The mimetypes docs say that init can be called more than once,  They say that a 
MimeTypes object starts out with the same database as provided by the rest of 
the module.  The docs explain how the initial database state is created.

What the docs don't do is say what *happens* when you call init more than once. 
 There are two possibilities: either we (1) restart from the initial state, or 
we (2) start from the current (possibly modified) state of the database and 
then add whatever is specified in the init call.  (Actually, there's a third 
possibility: we could also add back in anything from the default init that was 
deleted; but this halfway version is unlikely to be anyone's intent or 
expectation.)

The actual implementation of the mimetypes module does (2) if and only if you 
pass init a list of files.  If you don't then it does something that isn't even 
the third way above: it reloads *just* the data from the system files it 
managed to find, without reloading the data from the internal tables.

Clearly this behavior isodd.  When no files are passed, init should do one 
of two things: either nothing, or reset the global db state to its initial 
value.

It's not so clear what the behavior should be when you pass init one or more 
files.  It is possible, even highly probable, that there is code out there that 
depends on the fact that doing so is additive.

Given this analysis, I think that the best fix would be implement (and 
document) the following behavior for init:

  If called with no arguments, it rebuilds the module database from scratch

  If called with a list of files, it adds the contents of those files to the 
module database

The second is a backward compatibility hack.  Ideally it would be deprecated in 
favor of some sort of load_mime_files method.

It is possible that the first will also break code, but I think it is less 
likely, and probably an acceptable risk in a new major release.  But I'd be 
prepared to change it to 'init does nothing' if breakage showed up during RC 
testing.

The problem with this fix is that it does not, in fact, address the root 
cause of the OP's bug report.  The specific behavior he observes when calling 
init() would be fixed, but the underlying problem remains.  If he were to 
instead instantiate a new MimeTypes db, then when it copies the module 
database, it will build its own database by running the old database in key 
order, and once again the results returned by guess_extension might mutate.  
This means that the new db is *not* a copy of the old db when it starts.

That problem could be fixed by having MimeTypes.__init__ do a copy of the 
types_map and types_map_inv data structures instead of rebuilding them from 
scratch.  This would mean shifting the initialization of these structures out 
of MimeTypes and in to init (in the 'reinitialize' code path) or perhaps into 
_default_mime_types, but I don't see that as a big problem, once init is doing 
a full reinitialization by default.  (There is also the question of whether it 
should be a 'deep copy', but I don't think that is needed since a user would 
need to be doing something pretty hackish to run afoul of a 
shallow-copy-induced problem.)

Can anyone see flaws in this analysis and proposed solution?  I've marked the 
fix as easy since a python hacker should be able to knock out a solution in a 
day, but it isn't trivial.  And I have no clue how to write a unit test for the 
MimeTypes.__init__ order-shifting bug.

I'm also resetting the priority to normal since I consider the ambiguity of 
what calling init twice actually does to be a bigger issue than it sometimes 
changing the results of a function with 'guess' in its name :)

I've attached a patch with a unit test for the 'init doesn't re-init' behavior.

(By the way, it also appears to me from reading the code that read_mime_types 
is buggy in that it actually returns a merge of the loaded file with the 
current module DB state, but I haven't checked that observation.)

--
keywords: +easy, patch
priority: low - normal
resolution: works for me - 
Added file: http://bugs.python.org/file17803/mimetypes-init-test.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4963
___
___
Python-bugs-list mailing list
Unsubscribe: 

[issue8998] add crypto routines to stdlib

2010-06-29 Thread geremy condra

geremy condra debat...@gmail.com added the comment:

On Tue, Jun 29, 2010 at 2:25 PM, Marc-Andre Lemburg
rep...@bugs.python.org wrote:

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

 Antoine Pitrou wrote:

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

 If we are to require OpenSSL or some other crypto lib,

 We already depend on OpenSSL for both hashlib and ssl, this proposal
 wouldn't change anything in this regard.

 hashlib can still works without OpenSSL and hash algorithms don't
 fall under crypto laws. ssl doesn't work without OpenSSL, but also
 doesn't require adding any crypto code to the stdlib.

This won't change the status quo, as my code simply leverages OpenSSL
rather than being an independent implementation.

 The main point that needs to be addressed is shipping Python
 with crypto code. If OpenSSL is optionally used, we're fine,
 but if we start shipping crypto code, things are more contrived.

As I say, we're doing things exactly how they're already done. Python
would not be shipping any more crypto code with this module than it
already does.

 See http://rechten.uvt.nl/koops/cryptolaw/ for a survey.

I've looked over it before and didn't notice anything glaringly
applicable, outside of the Windows situation. IANAL, though.

 We're hosting the Python software on servers in The Netherlands,
 so have to follow the Wassenaar Arrangement if we include
 crypto code. Fortunately, that agreement includes a clause which
 pretty much exempts open source crypto code from export regulations.

Again, this seems to me something more relevant to the OpenSSL folks than to us.

 However, users of Python downloading installers with crypto software
 would import and use it in their resp. countries and that may get
 them into trouble, so they need to be warned if we decide to
 ship crypto code with Python.

Your suggestion about a warning for Windows downloads seems
appropriate. I'm not sure how much more than that needs to be done,
though.

 They way I understand Geremy's suggestion is to just include a
 wrapper for OpenSSL, so that's fine. The PEP should include a
 mention of the above to argue against putting e.g. pycrypto
 into the stdlib (not because it's poor software, much to the
 contrary, only because it causes lots of problems for our
 users and the developers).

I'll add mention of the concern over export laws, but it's probably
not feasible to get similar security properties out of any
reimplementation that could be crafted in a reasonable time anyway.

As a note, I intend to have prototype code ready at approximately the
same time as the PEP, so, time permitting, you should be able to play
with this before too long.

Geremy Condra

--

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



[issue9117] class syntax not fully documented in reference manual

2010-06-29 Thread Mark Dickinson

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

Yes, good plan.  I'll do that.

I'm also not sure about the 'comprehension' bit;  it's true that a 
comprehension is syntactically valid here (e.g., class A(x for x in 
range(3))), but it's also entirely useless:  it has to be the sole argument, 
so there can't be a metaclass argument, so the metaclass would have to be type. 
 But type (quite sensibly) won't accept a generator as a base class.

Oh well;  I suppose it doesn't *have* to make sense to be valid syntax...

This still leaves the hard part, which is distilling the essence of PEP 3115 
and adding it to the reference manual.

--

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



[issue9120] Reduce pickle size for an empty set

2010-06-29 Thread Alexander Belopolsky

New submission from Alexander Belopolsky belopol...@users.sourceforge.net:

Empty sets are pickled as set([]).  The pickle contains serialization of an 
empty list that is passed to set constructor during unpickling:

 dis(dumps(set()))
0: \x80 PROTO  3
2: cGLOBAL 'builtins set'
   16: qBINPUT 0
   18: ]EMPTY_LIST
   19: qBINPUT 1
   21: \x85 TUPLE1
   22: qBINPUT 2
   24: RREDUCE
   25: qBINPUT 3
   27: .STOP

The proposed patch pickles empty set as set() instead:


 dis(dumps(set()))
0: \x80 PROTO  3
2: cGLOBAL 'builtins set'
   16: qBINPUT 0
   18: )EMPTY_TUPLE
   19: RREDUCE
   20: qBINPUT 1
   22: .STOP

--
components: Interpreter Core
files: empty-set-pickle.diff
keywords: patch
messages: 108937
nosy: alexandre.vassalotti, belopolsky, pitrou
priority: normal
severity: normal
stage: patch review
status: open
title: Reduce pickle size for an empty set
type: feature request
versions: Python 3.2
Added file: http://bugs.python.org/file17804/empty-set-pickle.diff

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



[issue9117] class syntax not fully documented in reference manual

2010-06-29 Thread Mark Dickinson

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

Updated patch.  I've reorganized that documentation section a bit, and added a 
link to PEP 3115.  This isn't ideal, but it's better than nothing.

--
Added file: http://bugs.python.org/file17805/issue9117_v2.patch

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



[issue9117] class syntax not fully documented in reference manual

2010-06-29 Thread Mark Dickinson

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

And the same patch, but this time *without* the irrelevant audioop changes. :)

--
Added file: http://bugs.python.org/file17806/issue9117_v2.patch

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



[issue9117] class syntax not fully documented in reference manual

2010-06-29 Thread Mark Dickinson

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


Removed file: http://bugs.python.org/file17805/issue9117_v2.patch

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



[issue9120] Reduce pickle size for an empty set

2010-06-29 Thread Mark Dickinson

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

This seems a bit like premature (space) optimization to me.  Is it really worth 
special-casing this?

--
nosy: +mark.dickinson

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



[issue9104] test_exceptions does not test pickling with pickle.py

2010-06-29 Thread Alexander Belopolsky

Alexander Belopolsky belopol...@users.sourceforge.net added the comment:

 An explicit dictionary to map the Python and C implementations may be a 
 better approach.


Do you mean a global 

optimized_module = {'pickle': '_pickle'}

in test/support.py?


I don't think I like this idea.  Even with an explicit dictionary like that,  
support.import_module_implementations() will not support all possible ways that 
alternative implementations of a given module may be provided in cpython.  It 
works for pickle/_pickle and heapq/_heapq, but won't work for io/_io/_pyio.  I 
would like import_module_implementations() to promote uniformity in the way 
parallel pure/native modules are designed.  Test suites for modules that want 
more flexibility can always call import_fresh_module() directly.

--

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



[issue9079] Make gettimeofday available in time module

2010-06-29 Thread Mark Dickinson

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

To keep things clean, would it be possible to separate this into two patches, 
one containing the refactoring and one for the newly exposed gettimeofday?

--

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



[issue6827] deepcopy erroneously doesn't call __setstate__ if __getstate__ returns empty dict

2010-06-29 Thread R. David Murray

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

Given that the API is what is, then it looks like the needed doc improvements 
have been done.

--
stage:  - committed/rejected
status: pending - closed

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



[issue8947] Provide as_integer_ratio() method to Decimal

2010-06-29 Thread Mark Dickinson

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

After discussions on IRC, I'm going to close this as rejected.  Convergence of 
the float and Decimal APIs is a nice idea, but in this case it's not clear that 
it really works.  In particular, for duck typing to be sensible, int and 
Fraction would also have to grow an as_integer_ratio method.  And that seems a 
superfluous when those two types already have the same functionality in the 
form of .numerator and .denominator attributes.

I also agree with Raymond that we shouldn't be fattening the decimal API 
without good reason.

Alexander:  wouldn't conversion to Fraction solve the issue in this case?  The 
Fraction constructor accepts floats, Decimal instances and ints directly.

--
resolution:  - rejected
status: open - closed

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



[issue9120] Reduce pickle size for an empty set

2010-06-29 Thread Alexander Belopolsky

Alexander Belopolsky belopol...@users.sourceforge.net added the comment:

It is both space and time optimization.

Fred was a proponent of small pickle sizes in the past, so I am adding him to 
the nosy list.

I am not too keen on this to happen, though.  It just seemed more natural to me 
not to create an empty list to unpickle an empty set.

By the same logic, allowing set() as an alternative to set([]) in python code 
is premature optimization.

The patched code is a bit cleaner than the original without goto's and 
unnecessary XDECREFs.  (I am not sure what the latest word on redundant 
initializations is, so I kept =NULLs intact.)

On the other hand collections.deque does not optimize empty case either.

--
nosy: +fdrake
priority: normal - low

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



[issue1789] assumption about unsigned long byte size in struct module usage

2010-06-29 Thread Mark Dickinson

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

Doc patch committed in revisions r82379 through r82382.

--
status: open - closed

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



[issue9079] Make gettimeofday available in time module

2010-06-29 Thread Alexander Belopolsky

Alexander Belopolsky belopol...@users.sourceforge.net added the comment:

The original patch, gettimeofday.diff was just refactoring.  I unlinked it to 
keep the file list clean, but it is still available:

http://bugs.python.org/file17766/gettimeofday.diff

I decided to expose time.gettimeofday() in the same patch mostly in order to be 
able to better explain the consequences of the change such as date.today() now 
being equivalent to date.fromtimestamp(time.gettimeofday()[0]) rather than 
date.fromtimestamp(time.time()).

--

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



[issue9113] Tools/msi still uses string exceptions

2010-06-29 Thread Martin v . Löwis

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

This is not a problem. Tools/msi is being used with Python 2.5 only.

--
nosy: +loewis
resolution:  - wont fix
status: open - closed
versions:  -Python 3.1, Python 3.2

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



[issue9121] Glossary entry for nested scope incorrect

2010-06-29 Thread Ethan Furman

New submission from Ethan Furman et...@stoneleaf.us:

It currently states Note that nested scopes work only for reference and not 
for assignment which will always write to the innermost scope.

This should be updated to read, e.g. Note that unless the new nonlocal keyword 
is used nested scopes work only for reference and not for assignment which will 
otherwise write to the innermost scope.

--
assignee: d...@python
components: Documentation
messages: 108949
nosy: d...@python, stoneleaf
priority: normal
severity: normal
status: open
title: Glossary entry for nested scope incorrect
versions: Python 3.1

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



[issue9121] Glossary entry for nested scope incorrect

2010-06-29 Thread Benjamin Peterson

Benjamin Peterson benja...@python.org added the comment:

Already fixed.

--
nosy: +benjamin.peterson
resolution:  - out of date
status: open - closed

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



[issue1749662] New byte packing format for the struct module

2010-06-29 Thread Mark Dickinson

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


--
status: pending - closed

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



[issue9120] Reduce pickle size for an empty set

2010-06-29 Thread Raymond Hettinger

Raymond Hettinger rhettin...@users.sourceforge.net added the comment:

Will think about this one for a while.  Initial reaction is that the case isn't 
common enough to care about, and that the 5 byte savings isn't worth the extra 
code path.

 By the same logic, allowing set() as an alternative 
 to set([]) in python code is premature optimization.

That wasn't an optimization -- it was needed for API 
consistency with other types (i.e. list(), dict(), etc).
The zero argument form supports a use case for
polymorphic creation of an empty container regardless
of type.

--
assignee:  - rhettinger
nosy: +rhettinger

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



[issue9106] remove numbers from 3-.. level entries in docs toc

2010-06-29 Thread anatoly techtonik

anatoly techtonik techto...@gmail.com added the comment:

That just proves that side menu is not very useful. When I need to jump to a 
sibling paragraph I usually click the rightmost entry in top bar. It takes two 
clicks to get there and one page reload instead of one.

Perhaps the ToC menu could be expanded using JS and some keyboard shortcut for 
convenience.

--

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



[issue9122] Problems with multiprocessing, Python embedding and Windows

2010-06-29 Thread Alexander Myodov

New submission from Alexander Myodov amyo...@gmail.com:

Hello,

I am using Python 2.6.5 and Cython (to embed the Python interpreter) to create 
a simple launcher.exe launcher which then imports and uses the remaining logic 
from the other modules, conveniently stored in a single modules.zip file (i.e. 
importing from inside zip file). Such setup causes some issues when it comes to 
the multiprocessing.

First of all, the __main__ module is built as a binary (via Cython-mingw), but 
the stuff like freeze is not used. In multiprocessing/forking.py, when it comes 
to determination of the primary path, there is a WINEXE variable which affects 
the further processing. In its assignment, getattr(sys, 'frozen', False) 
obviously results in False, causing the WINEXE variable be False too (though in 
my case it is obviously wrong, the stuff like imp.is_builtin(__main__) shows 
that the main module is indeed builtin). This is the first problem which 
probably could be solved by adding an additional check for something like 
imp.is_builtin(__main__) to WINEXE assignment.
Further, as the WINEXE is wrongly False, it causes the if not WINEXE: branch 
to be processed, and adds the 'main_path' to the data, containing the name of 
the .exe file. 
On the forked side, d['main_path'] is received and parsed, and the name of the 
.exe file is split out of its extension, and such name is attempted to be 
imported, using imp.find_module/imp.load_module. The import fails, as there is 
indeed no such files wildly lying around in the installation; on the other 
hand, to get a quick fix of the problem, I thought of adding the appropriate 
launcher.py(.pyo/.pyc) files into the modules.zip, so that they still could be 
externally imported by the launcher name, even though it is already builtin 
under the __main__ name; but the second problem is that the 
imp.find_module/imp.load_module functions do not find the module inside the zip 
files, like the import statement does.

--
components: Extension Modules, Windows
messages: 108953
nosy: honeyman
priority: normal
severity: normal
status: open
title: Problems with multiprocessing, Python embedding and Windows
versions: Python 2.6

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



[issue1692335] Fix exception pickling: Move initial args assignment to BaseException.__new__

2010-06-29 Thread Alexander Belopolsky

Alexander Belopolsky belopol...@users.sourceforge.net added the comment:

The case in msg76028 are probably not pointing to a bug.  If subclass' __init__ 
passes its args to the base class __init__ (as it probably should), pickling 
works: 

class E(Exception):
Extension with values, init called with args.
def __init__(self, foo):
self.foo = foo
Exception.__init__(self, foo)

 from pickle import *
 loads(dumps(E(1)))
E(1,)
 _.foo
1

What would be a use case for not setting args?  Even if there was a valid use 
case for it, it would be easy to simply provide custom __getinitargs__ or 
__reduce__ to support it.

Note that with msg76028 definitions, eval(repr(C('foo'))) also raises a 
TypeError, so properly supporting args hiding in exception subclasses would 
probably involve overriding __repr__ as well.

--
nosy: +belopolsky

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



[issue6589] smtpd.SMTPServer can cause asyncore.loop to enter infinite event loop

2010-06-29 Thread Casey McGinty

Casey McGinty casey.mcgi...@gmail.com added the comment:

I attached a simple script that reproduces the report issue. I hope it helps.

--
Added file: http://bugs.python.org/file17807/smtp_test.py

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



[issue9106] remove numbers from 3-.. level entries in docs toc

2010-06-29 Thread R. David Murray

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

No, it just proves that I don't use the side menu.  I use google and the 'find' 
function of my browser :)

--

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



[issue6477] Pickling of NoneType raises PicklingError

2010-06-29 Thread Alexander Belopolsky

Alexander Belopolsky belopol...@users.sourceforge.net added the comment:

Ellipsis and NotImplemented are different from None because they are not 
pickleable themselves.  The None situation is more similar to that of say 
module level functions:


 def f(): pass
... 
 dumps(f)  # works
b'\x80\x03c__main__\nf\nq\x00.'
 dumps(type(f))  # does not work
Traceback (most recent call last):
  ..
_pickle.PicklingError: Can't pickle class 'function': attribute lookup 
builtins.function failed


I think documentation at 
http://docs.python.org/dev/py3k/library/pickle.html#what-can-be-pickled-and-unpickled

Can be improved in two ways:

1. s/types/objects/ in The following types can be pickled

2. Add a note that type(x) can be pickled does not follow from x can be 
pickled.  The object type(x) must itself fall into one on the listed 
categories.

3. built-in functions defined at the top level of a module should probably be 
built-in classes or functions defined at the top level of the builtins module

4. instances of such classes should be instances of picklable classes

5. __setstate__() is picklable should be output of __getstate__() is 
picklable

--
nosy: +belopolsky

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



[issue9120] Reduce pickle size for an empty set

2010-06-29 Thread Fred L. Drake, Jr.

Fred L. Drake, Jr. fdr...@acm.org added the comment:

 Fred was a proponent of small pickle sizes in the past,
 so I am adding him to the nosy list.

Thanks!

I am a proponent of small pickle sizes, in cases where it
matters.  I'm not convinced this is such a case.

The case for a small pickle size for datetime objects is
that they're very common in pickle-based persistent object
stores, such as ZODB.

Set objects are much less common in this environment; this
extends to most of Python's mutable data structures.  There
are three cases worth noting:

1. A separate persistent object is used to provide an API
   around the core Python data type, with an identical or
   similar API.  This is done to take care of noting
   changes, so the need to update the stored object is
   tracked.  In these cases, minor changes in the pickled
   size of the core object are swamped by the reference to
   the wrapper class.

2. An immutable object is used instead, and updates simply
   replace the value.  This allows the referring object to
   be responsible for change tracking, but means that types
   like the set, list, and dictionary aren't frequently
   used (though they may be used by other objects are part
   of their pickled representations).

3. Application objects may use mutable objects as part of
   their stored data value, but keep careful track of
   updates themselves.  This is most often the case when
   we want to avoid multiple round-trips to the storage
   server, and the size of the pickle isn't particularly
   interesting.

This isn't an argument that the change shouldn't be made,
but experiences with ZODB-like storages don't necessarily
suggest that all pickle sizes need be minimized.

--

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



[issue9075] ssl module sets debug flag on SSL struct

2010-06-29 Thread Sridhar Ratnakumar

Changes by Sridhar Ratnakumar sridh...@activestate.com:


--
nosy: +srid

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



[issue1643370] recursive urlparse

2010-06-29 Thread Senthil Kumaran

Senthil Kumaran orsent...@gmail.com added the comment:

This is already handled via namedtuple in the urlparse. All the parts of the 
url are available by parsing.

--
resolution:  - out of date
stage: unit test needed - committed/rejected
status: open - closed

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



[issue1692335] Fix exception pickling: Move initial args assignment to BaseException.__new__

2010-06-29 Thread Eric Huss

Eric Huss e...@huss.org added the comment:

Alexander, the use case I was involved with was an RPC system which allowed 
exceptions to propagate over the connection.  In this case, you do not have 
absolute control over which exceptions may be raised, or who wrote the code 
that is raising the exception.  There are many cases, even in the standard 
library, where people do not pass all arguments to the base exception class.  
Some of these are probably mistakes, but in general pickle shouldn't fail on 
otherwise legitimate objects.

There are other cases where passing all arguments up is not wanted, or at least 
cumbersome.  If you have multiple levels of inheritance, and subclasses add 
additional arguments to the init, they wouldn't have a way to include those 
arguments to the base class unless all classes were written with *args in the 
init function, which many people would not know or remember to do.

--

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



[issue9106] remove numbers from 3-.. level entries in docs toc

2010-06-29 Thread anatoly techtonik

anatoly techtonik techto...@gmail.com added the comment:

PHP site have a very convenient feature that if you enter 
http://php.net/some_func - it automatically executes function lookup for you or 
shows corresponding doc page, i.e. http://php.net/sort

--

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



[issue1643370] recursive urlparse

2010-06-29 Thread anatoly techtonik

anatoly techtonik techto...@gmail.com added the comment:

Senthil, please read the proposals more attentively. From the docs of urlparse 
at http://docs.python.org/library/urlparse.html

The components are not broken up in smaller parts (for example, the network 
location is a single string), and % escapes are not expanded.

--
status: closed - open

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1643370
___
___
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

2010-06-29 Thread Zooko O'Whielacronx

New submission from Zooko O'Whielacronx zo...@zooko.com:

os.urandom() on VMS invokes OpenSSL's RAND_pseudo_bytes(). That is documented 
on:

http://www.openssl.org/docs/crypto/RAND_bytes.html

as being predictable and therefore unsuitable for many cryptographic purposes. 
This is inconsistent with the documentation of os.urandom():


urandom(n) - str\n\n\
Return a string of n random bytes suitable for cryptographic use.


This probably means that users of Python on VMS are vulnerable to attack based 
on the predictability of the results they get from os.urandom().

Honestly, I would have guessed that there *were* no users of Python on VMS when 
I started this bug report, but look--apparently there are:

http://www.vmspython.org

To fix this, change the call from RAND_pseudo_bytes() to RAND_bytes(). It has 
the same type signature and actually does what os.urandom() needs.

--
messages: 108963
nosy: zooko
priority: normal
severity: normal
status: open
title: insecure os.urandom on VMS

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9123
___
___
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

2010-06-29 Thread Zooko O'Whielacronx

Zooko O'Whielacronx zo...@zooko.com added the comment:

HACK Zooko-Ofsimplegeos-MacBook-Pro:~/playground/python/release27-trunk$ svn 
diff
Index: Modules/posixmodule.c
===
--- Modules/posixmodule.c   (revision 82382)
+++ Modules/posixmodule.c   (working copy)
@@ -8481,7 +8481,7 @@
 result = PyString_FromStringAndSize(NULL, howMany);
 if (result != NULL) {
 /* Get random data */
-if (RAND_pseudo_bytes((unsigned char*)
+if (RAND_bytes((unsigned char*)
   PyString_AS_STRING(result),
   howMany)  0) {
 Py_DECREF(result);

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9123
___
___
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

2010-06-29 Thread Zooko O'Whielacronx

Zooko O'Whielacronx zo...@zooko.com added the comment:

This issue is a security vulnerability.

--

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



[issue9097] os.chdir(path) to return current dir

2010-06-29 Thread anatoly techtonik

anatoly techtonik techto...@gmail.com added the comment:

Even though I think that crossplatform language should normalize underlying 
platform behaviour, you've convinced me. Unneeded extra code execution decides. 
I also found that in another scenario it is better to return wrapper for target 
directory to implement chained API similar to string handling.

--
status: open - closed

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