[issue18444] IDLE: Mac OS X pressing ctrl-A in Python shell moved cursor before the prompt, which then makes the keyboard unresponsive.

2013-07-16 Thread Ronald Oussoren

Ronald Oussoren added the comment:

Raymond: good to hear that using fn+F5 is not a problem for new users

--

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



[issue18393] Gestalt() is deprecated on OSX 10.8, remove support?

2013-07-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 7272ef213b7c by Ronald Oussoren in branch 'default':
Also remove a (broken) leaker test for the code removed in issue #18393.
http://hg.python.org/cpython/rev/7272ef213b7c

--

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



[issue9033] cmd module tab misbehavior

2013-07-16 Thread Ronald Oussoren

Ronald Oussoren added the comment:

I no longer particularly like my patch, although something needs to be done. 
The easiest way forward is likely a (private) helper function in the readline 
module that can translate simple readline configuration strings to something 
that libedit understands and use that in the stdlib where readline bindings are 
replaced (but of course not for reading ~/.inputrc).

Comparing the libedit http://linux.die.net/man/5/editrc and readline 
http://cnswww.cns.cwru.edu/php/chet/readline/readline.html#SEC9 configuration 
languages makes is clear that it is not possible to fully translate a readline 
configuration in a libedit one, but basic conifguration like setting up 
key-bindings should be easy enough.

--
versions: +Python 3.3, Python 3.4 -Python 3.2

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



[issue18211] -Werror=statement-after-declaration problem

2013-07-16 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@gmail.com:


--
nosy: +haypo

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



[issue18211] -Werror=statement-after-declaration problem

2013-07-16 Thread STINNER Victor

STINNER Victor added the comment:

By the way, I don't think that Python should pass the optimization level (-O0 
or -O3) to extensions, except for builtin extensions (of the stdlib).

--

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



[issue18472] PEP 8 updates - internal interfaces and import *

2013-07-16 Thread Nick Coghlan

New submission from Nick Coghlan:

A home for a couple of proposed PEP 8 updates (as per the thread starting at 
http://mail.python.org/pipermail/python-dev/2013-July/127284.html)

--
messages: 193159
nosy: ncoghlan
priority: normal
severity: normal
status: open
title: PEP 8 updates - internal interfaces and import *
type: enhancement

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



[issue18473] some objects pickled by Python 3.x are not unpicklable in Python 2.x because of incorrect REVERSE_IMPORT_MAPPING

2013-07-16 Thread Mikhail Korobov

New submission from Mikhail Korobov:

I think REVERSE_IMPORT_MAPPING is wrong (see 
http://hg.python.org/cpython/file/7272ef213b7c/Lib/_compat_pickle.py#l80 ). It 
relies on dictionary items order and maps 'collections' module to either 
UserString or UserList. This makes it impossible to unpickle collections module 
classes pickled by Python 3.x when using Python 2.x.

 import collections
 dct = collections.defaultdict()
 pickle.dumps(dct, protocol=1)
b'cUserString\ndefaultdict\nq\x00)Rq\x01.'
 pickle.dumps(dct, protocol=2, fix_imports=False)
b'ccollections\ndefaultdict\nq\x00)Rq\x01.'

I think pickling of instances of classes from other modules could also suffer. 
I don't think it is a good idea to map io to cStringIO or StringIO, or to map 
http.server to either BaseHTTPServer, SimpleHTTPServer or CGIHTTPServer.

Originally found this issue here: 
https://github.com/nltk/nltk/pull/441/files#L2R67

--
components: Library (Lib)
messages: 193160
nosy: kmike
priority: normal
severity: normal
status: open
title: some objects pickled by Python 3.x are not unpicklable in Python 2.x 
because of incorrect REVERSE_IMPORT_MAPPING
versions: Python 3.3

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



[issue18473] some objects pickled by Python 3.x are not unpicklable in Python 2.x because of incorrect REVERSE_IMPORT_MAPPING

2013-07-16 Thread Mikhail Korobov

Mikhail Korobov added the comment:

my copy-paste went wrong, last statement in the example should be

 pickle.dumps(dct, protocol=1, fix_imports=False)
b'ccollections\ndefaultdict\nq\x00)Rq\x01.'

--

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



[issue18448] Tools/demo/eiffel.py fails to run tests.

2013-07-16 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
type:  - behavior
versions: +Python 3.3, Python 3.4

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



[issue18472] PEP 8 updates - internal interfaces and import *

2013-07-16 Thread Nick Coghlan

Nick Coghlan added the comment:

Attached diff has 5 changes:

* Explicit note that this is a living document that evolves over time
* Adds another explicit reason for not complying with the style guide (i.e. the 
code is old but still works and there's no other reason to change it)
* Fixed outdated info in the Tabs  Spaces section (Python 3 doesn't allow 
mixing them at all)
* Added an admonishment to avoid import *
* Added a new Public and internal interfaces section, that leans more heavily 
on documentation and __all__ than any of the proposals posted to python-dev

Some other oddities I noticed:

- given PEP 352, the admonishment to avoid string exceptions seems old and 
outdated. Can we just drop that?
- given PEP 3151, the suggestion to create a domain specific base class for 
the module also seems ill-advised. Perhaps we should remove that too?
- I've never understood the rationale for favouring absolute imports over 
explicit relative ones, so I had forgotten that suggestion was even in here. 
I've raised that one on python-dev, since I recall it being controversial, 
although I've never been able to fathom why. Explicit relative imports are just 
*better* in every way whenever they're applicable.

--
keywords: +patch
Added file: http://bugs.python.org/file30936/issue18472_pep_8_update.diff

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



[issue18472] PEP 8 updates - internal interfaces and import *

2013-07-16 Thread Nick Coghlan

Nick Coghlan added the comment:

Thomas Wouters made a couple of good points regarding absolute vs explicit 
relative imports, so I've improved the rationale in the PEP accordingly.

--
Added file: http://bugs.python.org/file30937/issue18472_pep_8_update2.diff

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



[issue18472] PEP 8 updates - internal interfaces and import *

2013-07-16 Thread Nick Coghlan

Nick Coghlan added the comment:

Tweaked the wording in the introduction to cover removal of obsolete 
conventions along with adding new ones.

--
Added file: http://bugs.python.org/file30938/issue18472_pep_8_update3.diff

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



[issue13266] Add inspect.unwrap(f) to easily unravel __wrapped__ chains

2013-07-16 Thread Aaron Iles

Aaron Iles added the comment:

My +1 is for the callback based approach. The brevity of the search loop for 
finding the innermost function is (in my opinion at least) non-obvious, relying 
on for loops not having their own scope as it does.

If a generator based API was adopted instead, I propose a convenience function 
(unwrap_all?) to help developers avoid writing code like:

inner = None
for inner in functools.unwrap(outer):
pass
if inner is None:
inner = outer

Which combines a misunderstanding of the API with for loop scope shortcut.

--

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



[issue18472] PEP 8 updates - internal interfaces and import *

2013-07-16 Thread Barry A. Warsaw

Changes by Barry A. Warsaw ba...@python.org:


--
nosy: +barry

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



[issue18474] Lambda assigned to object does not automatically get self

2013-07-16 Thread James Lu

New submission from James Lu:

if you assign a lambda to a object and call it,you get this:
Traceback (most recent call last):
  File pyshell#21, line 1, in module
n.__div__(3)
TypeError: lambda() takes exactly 2 arguments (1 given)
The full test is here:
 n = num()
 n.__div__
function lambda at 0x040B2DF0
 n/3
Traceback (most recent call last):
  File pyshell#20, line 1, in module
n/3
TypeError: unsupported operand type(s) for /: 'num' and 'int'
 n.__div__(3)
Traceback (most recent call last):
  File pyshell#21, line 1, in module
n.__div__(3)
TypeError: lambda() takes exactly 2 arguments (1 given)

--
messages: 193166
nosy: James.Lu
priority: normal
severity: normal
status: open
title: Lambda assigned to object does not automatically get self

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



[issue18474] Lambda assigned to object does not automatically get self

2013-07-16 Thread James Lu

Changes by James Lu jam...@gmail.com:


--
type:  - behavior

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



[issue18474] Lambda assigned to object does not automatically get self

2013-07-16 Thread Brett Cannon

Brett Cannon added the comment:

What version of Python is this and did you assign the lambda to an instance or 
class (and if this is Python 2, new-style or classic class)?

--
nosy: +brett.cannon

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



[issue18474] Lambda assigned to object does not automatically get self

2013-07-16 Thread James Lu

James Lu added the comment:

2.5,new-style

--

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



[issue18474] Lambda assigned to object does not automatically get self

2013-07-16 Thread James Lu

James Lu added the comment:

instance,assinged during __init__

--

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



[issue18475] No unittest.main in Lib/test/test_email/test_inversion.py

2013-07-16 Thread Vajrasky Kok

New submission from Vajrasky Kok:

There is no unittest.main in Lib/test/test_email/test_inversion.py.

In other word, you can not execute the test by doing something like this:

[abcdef@localhost cpython]$ ./python Lib/test/test_email/test_inversion.py

Attached the menial fix.

--
components: Tests
files: add_unittest_main_to_test_inversion.txt
messages: 193168
nosy: r.david.murray, vajrasky
priority: normal
severity: normal
status: open
title: No unittest.main in Lib/test/test_email/test_inversion.py
versions: Python 3.4
Added file: 
http://bugs.python.org/file30939/add_unittest_main_to_test_inversion.txt

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



[issue18474] Lambda assigned to object does not automatically get self

2013-07-16 Thread James Lu

James Lu added the comment:

Also,there were some bugs, but after I fixed them, it would only work if I did 
this:
n.__div__(n,3)

--

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



[issue18476] No way to pass custom arguments for loggers and formatters.

2013-07-16 Thread Piotr Dobrogost

New submission from Piotr Dobrogost:

It seems there's no way to pass custom arguments for loggers 
(http://hg.python.org/cpython/file/d9893d13c628/Lib/logging/__init__.py#l) 
and formatters 
(http://hg.python.org/cpython/file/d9893d13c628/Lib/logging/config.py#l117) the 
same way they are being passed to handlers 
(http://hg.python.org/cpython/file/d9893d13c628/Lib/logging/config.py#l139).

The problem came out when we tried to create base formatter which would read 
prefix from configuration of formatter to be prepended to all subsequent lines 
of every multi line message.

--
components: Library (Lib)
messages: 193172
nosy: piotr.dobrogost, vinay.sajip
priority: normal
severity: normal
status: open
title: No way to pass custom arguments for loggers and formatters.
type: enhancement
versions: Python 3.3

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



[issue18474] Lambda assigned to object does not automatically get self

2013-07-16 Thread Eric V. Smith

Eric V. Smith added the comment:

Could you provide an entire example, showing the class num and how you assign 
__div__?

--
nosy: +eric.smith

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



[issue17778] Fix test discovery for test_multiprocessing.py

2013-07-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 8a922b28b97d by Richard Oudkerk in branch '3.3':
Issue #17778: Fix test discovery for test_multiprocessing. (Patch by
http://hg.python.org/cpython/rev/8a922b28b97d

New changeset c704735487ae by Richard Oudkerk in branch 'default':
Issue #17778: Fix test discovery for test_multiprocessing. (Patch by
http://hg.python.org/cpython/rev/c704735487ae

--
nosy: +python-dev

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



[issue18474] Lambda assigned to object does not automatically get self

2013-07-16 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

This is expected. When you assign to n.__div__ a function which takes two 
parameters, you have to call it with two parameters:

aFunction = lambda x, y: (x, y)
n.__div__ = aFunction
aFunction(1, 2)
n.__div__(1, 2)

After all, aFunction and n.__div__ are the same object.
Now, it would be different if you had attached the function to the *class* 
instead:

n.__class__.__div__ = aFunction
n.__div__(2)   # returns (n, 2)

In this second example, n.__div__ is a bound method; the first parameter 
(usually named self) is already filled, and only the second one is required.

--
nosy: +amaury.forgeotdarc
resolution:  - invalid
status: open - closed

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



[issue18476] No way to pass custom arguments for loggers and formatters.

2013-07-16 Thread Vinay Sajip

Vinay Sajip added the comment:

I would prefer not to extend the functionality of fileConfig(), as dictConfig() 
is the preferred configuration approach. It's much more general than 
fileConfig() can be (without doing significant work on fileConfig(), which I'd 
like to not develop any further).

--
resolution:  - wont fix
status: open - pending

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



[issue18475] No unittest.main in Lib/test/test_email/test_inversion.py

2013-07-16 Thread Brett Cannon

Changes by Brett Cannon br...@python.org:


--
nosy: +zach.ware

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



[issue17778] Fix test discovery for test_multiprocessing.py

2013-07-16 Thread Richard Oudkerk

Richard Oudkerk added the comment:

Thanks for the patches!

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

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



[issue18475] No unittest.main in Lib/test/test_email/test_inversion.py

2013-07-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset b92db0aebc42 by R David Murray in branch '3.3':
Closes #18475: add unittest.main() to test_email/test_inversions.
http://hg.python.org/cpython/rev/b92db0aebc42

New changeset 48f27b745519 by R David Murray in branch 'default':
Merge: Closes #18475: add unittest.main() to test_email/test_inversions.
http://hg.python.org/cpython/rev/48f27b745519

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

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



[issue18448] Tools/demo/eiffel.py fails to run tests.

2013-07-16 Thread Févry Thibault

Févry Thibault added the comment:

One more update. When it fails, it sometimes fails with :

==
ERROR: testEiffelMetaClass1 (__main__.Tests)
--
Traceback (most recent call last):
  File ./Tools/demo/eiffel.py, line 102, in testEiffelMetaClass1
self._test(EiffelMetaClass1)
  File ./Tools/demo/eiffel.py, line 112, in _test
class Test(Eiffel):
  File ./Tools/demo/eiffel.py, line 17, in __new__
meta, name, bases, dict)
TypeError: type __qualname__ must be a str, not function

==
ERROR: testEiffelMetaClass2 (__main__.Tests)
--
Traceback (most recent call last):
  File ./Tools/demo/eiffel.py, line 105, in testEiffelMetaClass2
self._test(EiffelMetaClass2)
  File ./Tools/demo/eiffel.py, line 112, in _test
class Test(Eiffel):
  File ./Tools/demo/eiffel.py, line 17, in __new__
meta, name, bases, dict)
TypeError: type __qualname__ must be a str, not EiffelDescriptor

--
Ran 2 tests in 0.004s

As I have no experience with metaclasses and all that stuff, I won't be able to 
fix it/find what's wrong.

--

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



[issue5476] datetime: timedelta(minutes = i) silently fails with numpy.int32 input

2013-07-16 Thread Yury V. Zaytsev

Yury V. Zaytsev added the comment:

NumPy no longer uses the Trac for issues, the tracking has been moved to 
GitHub. I hope that the problem will be finally solved in NumPy by 
https://github.com/numpy/numpy/pull/3526 .

--
nosy: +zaytsev

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



[issue2263] struct.pack() + numpy int raises SystemError

2013-07-16 Thread Yury V. Zaytsev

Yury V. Zaytsev added the comment:

As noted in issue5476, I've submitted a pull request for NumPy: 
ttps://github.com/numpy/numpy/pull/3526 .

I hope that this fixes this problem too: on Py2, I've added 
Py_TPFLAGS_INT_SUBCLASS, on Py3, NumPy doesn't inherit from int anymore, 
because it's not a fixed-width integer type.

I guess it makes sense to close this bug now.

--
nosy: +zaytsev

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



[issue18211] -Werror=statement-after-declaration problem

2013-07-16 Thread Benjamin Peterson

Benjamin Peterson added the comment:

Why not?

--

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



[issue17214] http.client.HTTPConnection.putrequest encode error

2013-07-16 Thread LDTech

LDTech added the comment:

This problem still exist in Python 3.3.2. The following code gives you an 
example:

import urllib.request
url = http://www.libon.it/libon/search/isbn/3499155443;
req = urllib.request.Request(url)
response = urllib.request.urlopen(req, timeout=30)
the_page = response.read().decode('utf-8')
print(the_page)


Traceback (most recent call last):
  File C:\X\webpy.py, line 4, in module
response = urllib.request.urlopen(req, timeout=30)
  File C:\Python33\lib\urllib\request.py, line 156, in urlopen
return opener.open(url, data, timeout)
  File C:\Python33\lib\urllib\request.py, line 475, in open
response = meth(req, response)
  File C:\Python33\lib\urllib\request.py, line 587, in http_response
'http', request, response, code, msg, hdrs)
  File C:\Python33\lib\urllib\request.py, line 507, in error
result = self._call_chain(*args)
  File C:\Python33\lib\urllib\request.py, line 447, in _call_chain
result = func(*args)
  File C:\Python33\lib\urllib\request.py, line 692, in http_error_302
return self.parent.open(new, timeout=req.timeout)
  File C:\Python33\lib\urllib\request.py, line 469, in open
response = self._open(req, data)
  File C:\Python33\lib\urllib\request.py, line 487, in _open
'_open', req)
  File C:\Python33\lib\urllib\request.py, line 447, in _call_chain
result = func(*args)
  File C:\Python33\lib\urllib\request.py, line 1268, in http_open
return self.do_open(http.client.HTTPConnection, req)
  File C:\Python33\lib\urllib\request.py, line 1248, in do_open
h.request(req.get_method(), req.selector, req.data, headers)
  File C:\Python33\lib\http\client.py, line 1061, in request
self._send_request(method, url, body, headers)
  File C:\Python33\lib\http\client.py, line 1089, in _send_request
self.putrequest(method, url, **skips)
  File C:\Python33\lib\http\client.py, line 953, in putrequest
self._output(request.encode('ascii'))
UnicodeEncodeError: 'ascii' codec can't encode characters in position 78-79: 
ordinal not in range(128)

--
nosy: +LDTech

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



[issue10984] argparse add_mutually_exclusive_group should accept existing arguments to register conflicts

2013-07-16 Thread paul j3

paul j3 added the comment:

This patch produces the same usage as before, but I have rewritten 
_format_actions_usage() for both HelpFormatter and MultiGroupFormater.

The original HelpFormatter._format_actions_usage() formats the actions, splices 
in group markings, cleans up the text, if needed, tries to break it down into 
parts.  But this is fragile, as shown here and in issues 11874, 18349).

Now _format_group_usage() and _format_just_actions_usage() format groups and 
actions directly, without the splice and divide steps.  _format_actions_usage() 
for both classes call these to build a list of usage parts.

This change also solves http://bugs.python.org/issue11874 and 
http://bugs.python.org/issue18349, since it does not have to break up a 
formatted text line (and in the process get confused by [] and ()).

--
Added file: http://bugs.python.org/file30940/multigroup_4.patch

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



[issue18457] Fix and cleanup the ss1.py demo

2013-07-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 9098a4ad4d3e by Serhiy Storchaka in branch '3.3':
Issue #18457: Fixed saving of formulas and complex numbers in Tools/demo/ss1.py.
http://hg.python.org/cpython/rev/9098a4ad4d3e

New changeset c6b91d894577 by Serhiy Storchaka in branch 'default':
Issue #18457: Fixed saving of formulas and complex numbers in Tools/demo/ss1.py.
http://hg.python.org/cpython/rev/c6b91d894577

--
nosy: +python-dev

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



[issue18448] Tools/demo/eiffel.py fails to run tests.

2013-07-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset a9f7c2d49149 by Serhiy Storchaka in branch '2.7':
Issue #18448: Fix a typo in Demo/newmetaclasses/Eiffel.py.
http://hg.python.org/cpython/rev/a9f7c2d49149

New changeset 6e8ad6071100 by Serhiy Storchaka in branch '3.3':
Issue #18448: Fix a typo in Tools/demo/eiffel.py.
http://hg.python.org/cpython/rev/6e8ad6071100

New changeset 128618d2589c by Serhiy Storchaka in branch 'default':
Issue #18448: Fix a typo in Tools/demo/eiffel.py.
http://hg.python.org/cpython/rev/128618d2589c

--
nosy: +python-dev

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



[issue18448] Tools/demo/eiffel.py fails to run tests.

2013-07-16 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
assignee:  - serhiy.storchaka
resolution:  - fixed
stage:  - committed/rejected
status: open - closed

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



[issue18448] Tools/demo/eiffel.py fails to run tests.

2013-07-16 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
versions: +Python 2.7

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



[issue18457] Fix and cleanup the ss1.py demo

2013-07-16 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


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

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



[issue11874] argparse assertion failure with brackets in metavars

2013-07-16 Thread paul j3

paul j3 added the comment:

Here's a patch that takes a different approach - rewrite 
_format_actions_usage() so it formats groups (and unattached actions) directly. 
 

It uses the same logic to determine when to format a group, but then it calls 
_format_group_usage() to format the group, without the error prone insert and 
cleanup business.  And by keeping a list of the parts, it avoids the 
complications of parsing the text.  The only cleanup regex removes () from 
single element groups.

In the nested get_lines function, I added 'line and' to 

   if line and line_len + 1 + len(part)  text_width:

so it does not create a blank line before an extra long entry (e.g. 'c'*76).

I'm using the _format_group_usage() and _format_just_actions_usage() in the 
Issue 10984 MultiGroupFormatter, just rearranging the logic in its 
_format_actions_usage() method.  That patch could be rewritten to depend on 
this one.

This patch also fixes http://bugs.python.org/issue18349, since the metavar is 
never parsed.

--
Added file: http://bugs.python.org/file30941/format_usage.patch

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



[issue18349] argparse usage should preserve () in metavars such as range(20)

2013-07-16 Thread paul j3

paul j3 added the comment:

I just submitted at patch to http://bugs.python.org/issue11874 that takes care 
of this issue as well.

I rewrote _format_actions_usage() so it formats the parts directly, so there is 
no need cleanup or parse the full text string.

--

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



[issue16468] argparse only supports iterable choices

2013-07-16 Thread paul j3

paul j3 added the comment:

I just submitted a patch to http://bugs.python.org/issue11874 which rewrites 
_format_actions_usage().  It now formats the groups and actions directly, 
keeping a list of these parts.  It no longer has to cleanup or split a usage 
line into parts.  So it is not sensitive to special characters (space, [] or () 
 ) in the choices metavar.

--

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



[issue8704] cgitb sends a bogus HTTP header if the app crashes before finishing headers

2013-07-16 Thread p0lar_bear

p0lar_bear added the comment:

I get similar results if my CGI script sends a Content-Type header of anything 
besides text/html, e.g. print('Content-Type: text/json').

--
nosy: +p0lar_bear

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



[issue8704] cgitb sends a bogus HTTP header if the app crashes before finishing headers

2013-07-16 Thread p0lar_bear

Changes by p0lar_bear t3hp0larb...@gmail.com:


--
versions: +Python 3.3

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



[issue17890] argparse: mutually exclusive groups full of suppressed args can cause AssertionErrors

2013-07-16 Thread paul j3

paul j3 added the comment:

I just submitted a patch to http://bugs.python.org/issue11874 that 
substantially rewrites _format_actions_usage().  It generates the group and 
action parts separately, and does not do the kind of cleanup that produces this 
issue.

--

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



[issue18408] Fixes crashes found by pyfailmalloc

2013-07-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 533eb9ab895a by Victor Stinner in branch 'default':
Issue #18408: Fix fileio_read() on _PyBytes_Resize() failure
http://hg.python.org/cpython/rev/533eb9ab895a

New changeset f0efd7ea1627 by Victor Stinner in branch 'default':
Issue #18408: Fix cjkcodecs decoders, add a new MBERR_EXCEPTION constant to
http://hg.python.org/cpython/rev/f0efd7ea1627

New changeset 395e67f348e7 by Victor Stinner in branch 'default':
Issue #18408: Fix list.extend(), handle list_resize() failure
http://hg.python.org/cpython/rev/395e67f348e7

New changeset ac4e8e6a7436 by Victor Stinner in branch 'default':
Issue #18408: Fix PyDict_GetItemString(), suppress PyUnicode_FromString() error
http://hg.python.org/cpython/rev/ac4e8e6a7436

New changeset b7c6d203c9fb by Victor Stinner in branch 'default':
Issue #18408: dict_new() now fails on new_keys_object() error
http://hg.python.org/cpython/rev/b7c6d203c9fb

New changeset 28ff7ac91477 by Victor Stinner in branch 'default':
Issue #18408: Py_ReprLeave() now saves/restores the current exception,
http://hg.python.org/cpython/rev/28ff7ac91477

New changeset 6bd01a59762a by Victor Stinner in branch 'default':
Issue #18408: handle PySys_GetObject() failure, raise a RuntimeError
http://hg.python.org/cpython/rev/6bd01a59762a

--

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



[issue18477] fix_import (2to3 fixer) is not case-sensitive

2013-07-16 Thread ProgVal

New submission from ProgVal:

In a project, I have a package with a module named Socket.py, and the 
__init__.py imports the socket module (from the standard Python lib).
However, when fix_import went over it _on Windows_, it converted import 
socket to from . import Socket.
I also had this issue from a package containing a subpackage named Math, and 
a __init__.py importing math (from the standard Python lib).

This issue is caused by using os.path.exists(), which is case-insensitive on 
Windows. However, PEP 235 says imports are case-sensitive.

I'm including a patch I have wrote for this.

--
components: 2to3 (2.x to 3.x conversion tool), Windows
files: fix_case-sensitivity_of_fix-import.patch
keywords: patch
messages: 193193
nosy: Valentin.Lorentz
priority: normal
severity: normal
status: open
title: fix_import (2to3 fixer) is not case-sensitive
type: behavior
versions: Python 3.3
Added file: 
http://bugs.python.org/file30942/fix_case-sensitivity_of_fix-import.patch

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



[issue18477] fix_import (2to3 fixer) is not case-sensitive

2013-07-16 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@gmail.com:


--
nosy: +benjamin.peterson

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



[issue18467] argparse - problematic 'default' behavior

2013-07-16 Thread paul j3

Changes by paul j3 ajipa...@gmail.com:


--
nosy: +paul.j3

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



[issue18472] PEP 8 updates - internal interfaces and import *

2013-07-16 Thread Terry J. Reedy

Changes by Terry J. Reedy tjre...@udel.edu:


--
nosy: +terry.reedy

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



[issue18036] How do I create a .pyc file? FAQ entry is out of date

2013-07-16 Thread A Kaptur

A Kaptur added the comment:

Here is a suggestion for updated documentation in this section. I've added the 
description of __pycache__, included a very short description of what a .pyc 
file is, and moved the troubleshooting to the end of the section.  I'm not sure 
whether the description (a byte code cache file) is desirable here, but my 
sense is that people asking how to generate .pyc files are generally confused 
beginners.

--
keywords: +patch
nosy: +akaptur
Added file: http://bugs.python.org/file30943/better_pyc_doc_akaptur.patch

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



[issue18472] PEP 8 updates - internal interfaces and import *

2013-07-16 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Is the scope of this issue just what is in the title, the whole PEP, or 
something in between;-?

For instance, Guido once approved (on pydev) adding an admonition to 
Programming Recommendations something like the following.

* Use a def statement instead of an assignment with a lambda expression.
Yes:
def f(x): return 2*x
No:
f = lambda s: 2*x
The (only) difference between these is that the name attribute of the resulting 
function object is specifically 'f' instead of the generic 'lambda'. This is 
more useful for tracebacks and string representations in general.

The entry could point out that a separate statement that binds the function to 
a name negates the two reasons that justify using lambda, but that is probably 
unnecessary.

This is from a discussion at least 2 years ago, perhaps 3 or more, before I 
would have been comfortable or perhaps even eligible to push a patch, and no 
one else picked up on it either.

--

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



[issue18408] Fixes crashes found by pyfailmalloc

2013-07-16 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

You are great!

--
assignee:  - haypo
nosy: +serhiy.storchaka

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



[issue18289] python.org Interactive interpreter linked with libedit can segfault on future OS X

2013-07-16 Thread Ned Deily

Changes by Ned Deily n...@acm.org:


--
resolution: wont fix - duplicate
stage:  - committed/rejected
superseder:  - libedit history offset workaround

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



[issue18289] python.org Interactive interpreter linked with libedit can segfault on future OS X

2013-07-16 Thread Ned Deily

Ned Deily added the comment:

Issue18458 has been opened to track this problem.

--

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



[issue18408] Fixes crashes found by pyfailmalloc

2013-07-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset c8696ee49291 by Victor Stinner in branch 'default':
Issue #18408: Fix typo in build_node_tree() of the parser module
http://hg.python.org/cpython/rev/c8696ee49291

New changeset cf8f42eadbd0 by Victor Stinner in branch 'default':
Issue #18408: Fix Python-ast.c: handle init_types() failure (ex: MemoryError)
http://hg.python.org/cpython/rev/cf8f42eadbd0

New changeset a685f4c6e0b6 by Victor Stinner in branch 'default':
Issue #18408: Fix PyErr_NormalizeException(), handle PyObject_IsSubclass() 
failure
http://hg.python.org/cpython/rev/a685f4c6e0b6

New changeset 7fe4a0c0e905 by Victor Stinner in branch 'default':
Issue #18408: Fix locale.localeconv(), handle PyDict_SetItemString() failure
http://hg.python.org/cpython/rev/7fe4a0c0e905

New changeset 8c1ca6720246 by Victor Stinner in branch 'default':
Issue #18408: Handle PyArena_AddPyObject() failure in ast.c
http://hg.python.org/cpython/rev/8c1ca6720246

--

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



[issue18408] Fixes crashes found by pyfailmalloc

2013-07-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 1872555a2f4e by Victor Stinner in branch 'default':
Issue #18408: Mention changes in Misc/NEWS
http://hg.python.org/cpython/rev/1872555a2f4e

--

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



[issue18408] Fixes crashes found by pyfailmalloc

2013-07-16 Thread STINNER Victor

STINNER Victor added the comment:

@Serhiy: Would like to review attached patches listpop.patch (msg193130) and 
frame_fasttolocals.patch (msg193131)? (Other are already commited)

--

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



[issue18472] PEP 8 updates - internal interfaces and import *

2013-07-16 Thread Nick Coghlan

Nick Coghlan added the comment:

Sure, I think it makes sense to put that in. I'll be running the whole
patch by python-dev, enumerating the reasons for each change before I
commit anything.

--

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



[issue18408] Fixes crashes found by pyfailmalloc

2013-07-16 Thread STINNER Victor

STINNER Victor added the comment:

Oops.

@Serhiy: Would *you* like to review attached patches ...

--

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



[issue18472] PEP 8 updates - internal interfaces and import *

2013-07-16 Thread Terry J. Reedy

Terry J. Reedy added the comment:

The public versus internal part of this issue is related to #10434 Document the 
rules for public names, which contains among other things a suggested rewrite 
for PEP 8.

--

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



[issue18469] PyStructSequence does not handle exceptions correctly

2013-07-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset af18829a7754 by Victor Stinner in branch 'default':
Close #18469: Replace PyDict_GetItemString() with _PyDict_GetItemId() in 
structseq.c
http://hg.python.org/cpython/rev/af18829a7754

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

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



[issue18478] Class bodies: when does a name become local?

2013-07-16 Thread Terry J. Reedy

New submission from Terry J. Reedy:

http://docs.python.org/3/reference/executionmodel.html#naming-and-binding
says The following are blocks: ... a class definition. and 

If a name binding operation occurs anywhere within a code block, all uses of 
the name within the block are treated as references to the current block. This 
can lead to errors when a name is used within a block before it is bound. ... 

This is definitely true for functions, but not for classes:

foo = 'bar'
class C:
foo = foo

print(C().foo)
#
bar

This is the same for 3.3 and 2.7 with and without '(object)' added. Unless the 
code is considered to be buggy (probably since forever), the doc should be 
modified to change 'code block' to 'function code block' or maybe 'module or 
function code block'. (At near as I can think, the statement is true for 
modules, but only because globals() == locals(), so that part of the issue does 
not arise.)

--
assignee: docs@python
components: Documentation
messages: 193205
nosy: docs@python, terry.reedy
priority: normal
severity: normal
stage: needs patch
status: open
title: Class bodies: when does a name become local?
type: behavior
versions: Python 2.7, Python 3.3, Python 3.4

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



[issue18478] Class bodies: when does a name become local?

2013-07-16 Thread Ezio Melotti

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


--
nosy: +ezio.melotti

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



[issue10434] Document the rules for public names

2013-07-16 Thread Barry A. Warsaw

Changes by Barry A. Warsaw ba...@python.org:


--
nosy: +barry

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



[issue18467] argparse - problematic 'default' behavior

2013-07-16 Thread paul j3

paul j3 added the comment:

I think this example illustrates your issue:

class FooAction(argparse.Action):
def __call__(self, parser, namespace, values, 
option_string = None):
if values=='Q':
setattr(namespace, self.dest, 
{'type':values, 'quick':True, 'slow':False})
else:
setattr(namespace, self.dest, 
{'type':values, 'quick':False, 'slow':True})

def bar(string):
return string.upper()[0]

parser = argparse.ArgumentParser()
parser.add_argument('-a','--algorithm', choices=['Q','S'],
default='s', action=FooAction, type=bar)
parser.add_argument('foo', choices=['Q','S'],
default='s', action=FooAction, nargs='?', type=bar)
print(parser.parse_args([]))
# Namespace(algorithm='S',
#   foo={'slow': True, 'type': 'S', 'quick': False})

For both the optional and positional, the lower case default is converted into 
an upper case letter.

For the positional with nargs='?', the action is called with the converted 
default value.

But for the optional, the converted default is assigned to the dest
   algorithm='S'
but action is not called, which would have assigned
   algorithm={'type': 'S', 'quick': False, 'slow': True}

That is consistent with what I remember from the code.  A next function 
'take_action' is called only if there is an appropriate argument string.  For 
this optional that would be '-a' (or the likes).  For the '?' positional and 
empty argument list enough.

There is a relatively recent change that delayed when a default was converted 
by type (so a filetype wouldn't be opened unnecessarily).  But I can't think 
anyway that the action would be invoked on the default in the absence of '-a'.

In this example, would it be possible shift code from the custom action to the 
custom type?

--
Added file: http://bugs.python.org/file30944/issue18467.py

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



[issue18404] Memory leak in gdbmmodule

2013-07-16 Thread Jesús Cea Avión

Changes by Jesús Cea Avión j...@jcea.es:


--
nosy: +jcea

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



[issue18159] ConfigParser getters not available on SectionProxy

2013-07-16 Thread João Bernardo

João Bernardo added the comment:

Was the patch accepted yet? Looks good to me

--

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



[issue3158] Doctest fails to find doctests in extension modules

2013-07-16 Thread Zachary Ware

Zachary Ware added the comment:

In looking at test_decimal for issue16748, I discovered that not all of the 
doctests for _decimal are being tested.  So, I fixed it (or at least tried to 
:).

This patch does the following:

- Replace most inspect.isfunction checks in DocTestFinder with inspect.isroutine

- Add a check to DocTestFinder._from_module for method_descriptors

- Correct a doctest on float.fromhex (which is incorrect back to 2.7) due to 
the new float repr

- Add a couple doctests to the builtins module because previously there were no 
functions in builtins with docstrings for testing against.  I chose to add to 
bin(), hex(), and oct(); I believe those three can benefit from having the 
docstring show the format of the output string.  I'm not terribly attached to 
those, though, so if anyone has a better suggestion for testing, I'm all ears.

- Add tests using the builtins module (since it's a C module that's definitely 
going to be available).

- Add doctests to test_builtin (because the tests aren't actually run in 
test_doctest, just found). While at it, convert test_builtin to 
unittest.main().  I believe test_builtin should grow doctest running even if 
the doctests I added to bin, hex, and oct aren't kept; float and int have some 
doctests that should be kept up to date.

- Add notes to the docs.

--
keywords: +patch
nosy: +zach.ware
type:  - enhancement
versions: +Python 3.4 -Python 2.7, Python 3.1, Python 3.2
Added file: http://bugs.python.org/file30945/issue3158.diff

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