[issue14993] GCC error when using unicodeobject.h

2012-06-03 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +storchaka

___
Python tracker 

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



[issue14999] ctypes ArgumentError lists arguments from 1, not 0

2012-06-03 Thread Timothy Pederick

New submission from Timothy Pederick :

The ctypes ArgumentError exception indicates the location of the problem by 
argument number. It counts arguments starting from 1, not 0 as is typical in 
Python.

Observed

An example (anonymised) traceback:
Traceback (most recent call last):
...
foreign_function(a, b, c, d)
ctypes.ArgumentError: argument 2: : wrong type

The error here was with the argument "b".

Expected

Standard, zero-indexed Python counting would suggest that argument 2 should 
mean "c", and "b" would be argument 1.

Rationale
-
This may be as intended, but for me it violates the principle of least surprise.

I *think* this is the vicinity of the bug:
http://hg.python.org/cpython/file/696d3631a4a1/Modules/_ctypes/callproc.c#l1103

_ctypes_extend_error(PyExc_ArgError, "argument %d: ", i+1);

If I'm right and the "i+1" (here and/or in subsequent lines) is the cause, that 
definitely makes it look intentional.

--
components: ctypes
messages: 162251
nosy: perey
priority: normal
severity: normal
status: open
title: ctypes ArgumentError lists arguments from 1, not 0
type: behavior
versions: Python 3.2

___
Python tracker 

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



[issue14998] pprint._safe_key is not always safe enough

2012-06-03 Thread Shawn Brown

Shawn Brown <03sjbr...@gmail.com> added the comment:

Currently, I'm monkey patching _safe_key (adding a try/except) as follows:

>>> import pprint
>>>
>>> class _safe_key(pprint._safe_key):
>>> def __lt__(self, other):
>>> try:
>>> rv = self.obj.__lt__(other.obj)
>>> except TypeError:   # Exception instead of TypeError?
>>> rv = NotImplemented
>>> 
>>> if rv is NotImplemented:
>>> rv = (str(type(self.obj)), id(self.obj)) < \
>>>  (str(type(other.obj)), id(other.obj))
>>> return rv
>>> 
>>> pprint._safe_key = _safe_key
>>> 
>>> pprint.pprint({(0,): 1, (None,): 2})
{(None,): 2, (0,): 1}

--

___
Python tracker 

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



[issue14998] pprint._safe_key is not always safe enough

2012-06-03 Thread Shawn Brown

New submission from Shawn Brown <03sjbr...@gmail.com>:

This is related to resolved issue 3976 and, to a lesser extent, issue 10017.

I've run across another instance where pprint throws an exception (but works 
fine in 2.7 and earlier):

Python 3.2 (r32:88445, Mar 25 2011, 19:28:28) 
[GCC 4.5.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from pprint import pprint
>>> pprint({(0,): 1, (None,): 2})
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python3.2/pprint.py", line 55, in pprint
printer.pprint(object)
  File "/usr/lib/python3.2/pprint.py", line 132, in pprint
self._format(object, self._stream, 0, 0, {}, 0)
  File "/usr/lib/python3.2/pprint.py", line 155, in _format
rep = self._repr(object, context, level - 1)
  File "/usr/lib/python3.2/pprint.py", line 245, in _repr
self._depth, level)
  File "/usr/lib/python3.2/pprint.py", line 257, in format
return _safe_repr(object, context, maxlevels, level)
  File "/usr/lib/python3.2/pprint.py", line 299, in _safe_repr
items = sorted(object.items(), key=_safe_tuple)
  File "/usr/lib/python3.2/pprint.py", line 89, in __lt__
rv = self.obj.__lt__(other.obj)
TypeError: unorderable types: int() < NoneType()

The above example might seem contrived but I stumbled across the issue quite 
naturally. Honest!

In working with multiple lists and computing results using combinations of 
these lists' values.  I _could_ organize the results as a dictionary of 
dictionaries of dictionaries but that would get confusing very quickly.  
Instead, I'm using a single dictionary with a composite key ("flat is better 
than nested"). So I've got code like this...

>>> combinations = itertools.product(lst_x, lst_y, lst_z)
>>> results = {(x,y,z): compute(x,y,z) for x,y,z in combinations}

... and it is not uncommon for one or more of the values to be None -- 
resulting in the above exception should anyone (including unittest) attempt to 
pprint the dictionary.

--
components: Library (Lib)
messages: 162249
nosy: Shawn.Brown
priority: normal
severity: normal
status: open
title: pprint._safe_key is not always safe enough
versions: Python 3.2

___
Python tracker 

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



[issue12510] IDLE: calltips mishandle raw strings and other examples

2012-06-03 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

i12510.test.diff (for Python 3 only) does the following:

* Turn method CallTips.get_entity into a module function as it does not use the 
self parameter and is therefore not really an instance method.

* Delete the erroneous _find_constructor function. Even if it were fixed, it is 
unnecessary at least in 3.x. Class attribute lookup already does the superclass 
search duplicated in this function and should find object.__init__ if nothing 
else. (I defaulted to None anyway in case of an unforeseen problem, such as a 
type subclass that somehow disables the lookup.)

* In get_argspec, remove the lambda stuff that resulted in all classes getting 
a spurious '()' line. With the fix to retrieving .__init__, it never gets used 
and is not needed anyway.

* Only delete 'self' from the argument list for classes and bound methods where 
it is implicit and not to be explicity entered.

* Increase tests from 13 to 37.

* Modernize and re-organize tests with an eye to becoming part of an idlelib 
test suite.

With the increased number of tests, I am pretty confident in the patch, but I 
would not mind if you glance at it and try it out on Linux.

--
stage: needs patch -> patch review
Added file: http://bugs.python.org/file25814/i12510.test.diff

___
Python tracker 

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



[issue14996] pthon 3.2.3 freezes when saving a .py program

2012-06-03 Thread Ned Deily

Ned Deily  added the comment:

We need more information to be able to help.  What platform and OS version are 
you running on?  Where did you install Python 3.2.3 from?  Exactly what happens 
when you try to save a file, i.e. are you using a mouse or a keyboard 
accelerator, what messages do you see, etc?

--
nosy: +ned.deily

___
Python tracker 

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



[issue14997] Syntax Error in Python Version Number

2012-06-03 Thread cuulblu

New submission from cuulblu :

When using Idle any code I attempt to test I get a syntax error in the version 
number of the software. Please see the attached image. I have python installed 
on three machines and get the same error on all three. 
All three machines are Windows 7, 64 bit. Two have Intel CPU's. One is an AMD. 
I have tried reinstalling. Same results.

--
components: IDLE
files: python_error.jpg
messages: 162246
nosy: cuulblu
priority: normal
severity: normal
status: open
title: Syntax Error in Python Version Number
type: compile error
versions: Python 2.7
Added file: http://bugs.python.org/file25813/python_error.jpg

___
Python tracker 

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



[issue14993] GCC error when using unicodeobject.h

2012-06-03 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

It might not matter if it's an extension that everyone implements.

--
nosy: +benjamin.peterson, loewis

___
Python tracker 

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



[issue14994] GCC error when using pyerrors.h

2012-06-03 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 696d3631a4a1 by Benjamin Peterson in branch 'default':
__GNUC__ does not imply gcc version is present, so just check for version 
(closes #14994)
http://hg.python.org/cpython/rev/696d3631a4a1

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

___
Python tracker 

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



[issue14996] pthon 3.2.3 freezes when saving a .py program

2012-06-03 Thread Maureen Cuomo

New submission from Maureen Cuomo :

I have been using ver 3.2.1 without a problem. Downloaded 3.2.3 nd cannot save 
any file in idle.

--
components: IDLE
messages: 162243
nosy: mcu...@prestonhs.org
priority: normal
severity: normal
status: open
title: pthon 3.2.3 freezes when saving a .py program
type: crash
versions: Python 3.2

___
Python tracker 

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



[issue14995] PyLong_FromString documentation should state that the string must be null-terminated

2012-06-03 Thread Ryan Kelly

New submission from Ryan Kelly :

PyLong_FromString will raise a ValueError if the given string doesn't contain a 
null byte after the digits.  For example, this will result in a ValueError

   char *pend;
   PyLong_FromString("1234 extra", &pend, 10)

While this will successfully read the number and set the pointer to the extra 
data:

   char *pend;
   PyLong_FromString("1234\0extra", &pend, 10)

The requirement for a null-terminated string of digits is not clear from the 
docs.  Suggested re-wording attached.

--
assignee: docs@python
components: Documentation
files: PyLong_FromString-doc.patch
keywords: patch
messages: 162242
nosy: docs@python, rfk
priority: normal
severity: normal
status: open
title: PyLong_FromString documentation should state that the string must be 
null-terminated
Added file: http://bugs.python.org/file25812/PyLong_FromString-doc.patch

___
Python tracker 

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



[issue7559] TestLoader.loadTestsFromName swallows import errors

2012-06-03 Thread R. David Murray

R. David Murray  added the comment:

OK, let's just do it in the individual test, then.

--

___
Python tracker 

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



[issue14938] 'import my_pkg.__init__' creates duplicate modules

2012-06-03 Thread Ronan Lamy

Ronan Lamy  added the comment:

I'm not sure that it's enough to test is_package() because that only involves 
the loader and not the interaction between it and FileFinder. That's the reason 
why my test works at a higher level.

BTW, I sent the contributor agreement.

--

___
Python tracker 

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



[issue13598] string.Formatter doesn't support empty curly braces "{}"

2012-06-03 Thread Florent Xicluna

Changes by Florent Xicluna :


--
nosy: +flox

___
Python tracker 

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



[issue7559] TestLoader.loadTestsFromName swallows import errors

2012-06-03 Thread Brett Cannon

Brett Cannon  added the comment:

Not sure what DirsOnSysPath is, but I have been only calling 
importlib.invalidate_caches() as needed in order to not slow down tests 
needlessly.

And as for detecting an environment change as necessary, that's essentially 
impossible since it's only needed if something changed between imports which 
would require adding a hook to notice that an import happened *and* a directory 
already covered by sys.path_importer_cache (not sys.path since that doesn't 
cover packages) changed w/o calling invalidate_caches().

--

___
Python tracker 

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



[issue14982] pkgutil.walk_packages seems to not work properly on Python 3.3a

2012-06-03 Thread Brett Cannon

Brett Cannon  added the comment:

I should mention that Guido and others on python-dev mentioned coming up with 
an API for finders/loaders that allowed for file-like API and possibly being 
able to iterate over available modules when importlib's bootstrapping landed 
(sorry, don't have a link for it). If pip needs some specific introspection 
support from finders or loaders I would try asking on python-dev about exactly 
what you need to see if it can get into Python 3.3.

--

___
Python tracker 

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



[issue10574] email.header.decode_header fails if the string contains multiple directives

2012-06-03 Thread R. David Murray

R. David Murray  added the comment:

This is fixed by the fix to issue 1079, but we have decided that fix can't be 
backported because it is a behavior change that might break existing working 
programs.

--
resolution:  -> duplicate
stage:  -> committed/rejected
status: open -> closed
superseder:  -> decode_header does not follow RFC 2047

___
Python tracker 

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



[issue9967] encoded_word regular expression in email.header.decode_header()

2012-06-03 Thread R. David Murray

R. David Murray  added the comment:

Instead of doing this we've opted to follow postel and be generous in what we 
accept and go ahead and decode even if the leading and/or terminating space is 
missing (see issue 1079).

--
resolution:  -> rejected
status: open -> closed

___
Python tracker 

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



[issue14814] Implement PEP 3144 (the ipaddress module)

2012-06-03 Thread Nick Coghlan

Nick Coghlan  added the comment:

With a cross link from the header of the module reference to the howto guide, I 
think what Sandro posted is good enough for a first draft.

Once the basic content is checked in, then I'll tinker a bit to figure out a 
more logical order (and possibly move some details from the current howto guide 
into the module reference).

--

___
Python tracker 

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



[issue14992] os.makedirs expect_ok=True test_os failure when directory has S_ISGID bit set

2012-06-03 Thread Gregory P. Smith

Changes by Gregory P. Smith :


--
assignee:  -> gregory.p.smith
resolution:  -> fixed
status: open -> closed

___
Python tracker 

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



[issue14992] os.makedirs expect_ok=True test_os failure when directory has S_ISGID bit set

2012-06-03 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset fef529f3de5b by Gregory P. Smith in branch '3.2':
Fixes Issue #14992: os.makedirs(path, exist_ok=True) would raise an OSError
http://hg.python.org/cpython/rev/fef529f3de5b

New changeset eed26e508b7e by Gregory P. Smith in branch 'default':
Fixes Issue #14992: os.makedirs(path, exist_ok=True) would raise an OSError
http://hg.python.org/cpython/rev/eed26e508b7e

--
nosy: +python-dev

___
Python tracker 

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



[issue12510] IDLE: calltips mishandle raw strings and other examples

2012-06-03 Thread Roger Serwy

Roger Serwy  added the comment:

fix_12510.patch addresses the issue with the test.

What do you mean by: "int.append( does not bring up a tip on either version, 
but should if possible." ? The "int" object does not have "append" as a method.

--
Added file: http://bugs.python.org/file25811/fix_12510.patch

___
Python tracker 

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



[issue14714] PEP 414 tokenizing hook does not preserve tabs

2012-06-03 Thread Vinay Sajip

Changes by Vinay Sajip :


--
title: PEp 414 tokenizing hook does not preserve tabs -> PEP 414 tokenizing 
hook does not preserve tabs

___
Python tracker 

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



[issue14992] os.makedirs expect_ok=True test_os failure when directory has S_ISGID bit set

2012-06-03 Thread Gregory P. Smith

Changes by Gregory P. Smith :


--
versions: +Python 3.2

___
Python tracker 

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



[issue14989] http.server option to run CGIHTTPRequestHandler

2012-06-03 Thread Éric Araujo

Éric Araujo  added the comment:

I don’t think this can be defended as a bug fix, so let’s keep 3.2 as it is.

--
nosy: +eric.araujo

___
Python tracker 

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



[issue9949] os.path.realpath on Windows does not follow symbolic links

2012-06-03 Thread Daniel Harding

Daniel Harding  added the comment:

The previous version of this patch did not handle bytes arguments correctly and 
could fail in conjunction with a non-ASCII compatible encoding.  Also, if the 
result was a UNC path, it was not being handled correctly (the returned value 
would have started with a single backslash, not two).  Version 3 of the patch 
fixes these issues.  I am also attaching a single, condensed patch as requested 
by the Lifecycle of a Patch devguide.  I can also provide a patch series as 
before if desired.

--
keywords: +patch
Added file: http://bugs.python.org/file25810/issue9949-v3.patch

___
Python tracker 

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



[issue14994] GCC error when using pyerrors.h

2012-06-03 Thread André Malo

New submission from André Malo :

GCC error when using pyerrors.h

This ist my first attempt to test an extension with python 3.3. I've been using 
the 3.3.0a4 tarball.

I'm using very strict compiler settings when compiling my extension modules, 
especially -Wall -Werror (along with a lot more flags, like -pedantic, 
-std=c89).

Including Python.h includes pyerrors.h which emits:

/usr/include/python3.3/pyerrors.h:91:8: error: "__GNUC_MAJOR__" is not defined
/usr/include/python3.3/pyerrors.h:92:8: error: "__GNUC_MAJOR__" is not defined

I'm not sure, which of the compiler flags is responsible for dropping those 
macros. Simple defined() checks should fix that problem though.

--
components: Extension Modules, Interpreter Core
messages: 162230
nosy: ndparker
priority: normal
severity: normal
status: open
title: GCC error when using pyerrors.h
type: compile error
versions: Python 3.3

___
Python tracker 

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



[issue14993] GCC error when using unicodeobject.h

2012-06-03 Thread André Malo

New submission from André Malo :

GCC error when using unicodeobject.h

This ist my first attempt to test an extension with python 3.3. I've been using 
the 3.3.0a4 tarball.

I'm using very strict compiler settings when compiling my extension modules, 
especially -Wall -Werror (along with a lot more flags, like -pedantic, 
-std=c89).

Including Python.h includes unicodeobject.h which emits:

/usr/include/python3.3/unicodeobject.h:905: error: type of bit-field 
'overallocate' is a GCC extension
/usr/include/python3.3/unicodeobject.h:908: error: type of bit-field 'readonly' 
is a GCC extension

Maybe these should just be (unsigned) ints or something?

--
components: Extension Modules, Interpreter Core
messages: 162229
nosy: ndparker
priority: normal
severity: normal
status: open
title: GCC error when using unicodeobject.h
type: compile error
versions: Python 3.3

___
Python tracker 

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



[issue14992] os.makedirs expect_ok=True test_os failure when directory has S_ISGID bit set

2012-06-03 Thread Gregory P. Smith

New submission from Gregory P. Smith :

==
ERROR: test_exist_ok_existing_directory (__main__.MakedirTests)
--
Traceback (most recent call last):
  File "Lib/test/test_os.py", line 842, in test_exist_ok_existing_directory
os.makedirs(path, mode=mode, exist_ok=True)
  File "/home/greg/sandbox/python/cpython/default/Lib/os.py", line 161, in 
makedirs
mkdir(name, mode)
FileExistsError: [Errno 17] File exists (mode 0o2755 != desired mode 0o755): 
'@test_4027_tmp/dir1'

(I modified os.makedirs to add the info on the mode differences above to 
highlight the source of the problem)

0o2000 is the S_ISGID bit on a directory which is a "contagious" bit that is 
automatically copied onto subdirectories.  os.makedirs is not expecting to find 
it so exist_ok does not work as desired.

Workaround: Don't run the Python test suite from a directory with that bit set.

I think the os.makedirs() behavior should be to ignore bits that can appear 
regardless of the umask as it makes exist_ok=True useless in that situation.

--
messages: 162228
nosy: gregory.p.smith
priority: normal
severity: normal
status: open
title: os.makedirs expect_ok=True test_os failure when directory has S_ISGID 
bit set
versions: Python 3.3

___
Python tracker 

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



[issue14673] add sys.implementation

2012-06-03 Thread Eric Snow

Eric Snow  added the comment:

> Is full_4.diff the most up-to-date
> patch, and is it complete (i.e. contains all code, docs, and tests)?

Yep.  :)

--

___
Python tracker 

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



[issue13598] string.Formatter doesn't support empty curly braces "{}"

2012-06-03 Thread Vinay Sajip

Vinay Sajip  added the comment:

It seems like the patch doesn't consider mixing of positional and keyword 
arguments: if you have the format string "{foo} {} {bar}", then manual will be 
set to True when "foo" is seen as the field_name, and fail soon after when "" 
is seen as the field_name the next time around.

So, the test should include something which shows that

fmt.format("{foo} {} {bar}", 2, foo='fooval', bar='barval') returns "fooval 2 
barval", whereas with a format string like "{foo} {0} {} {bar}" or "{foo} {} 
{0} {bar}" you get a ValueError.

Also, why "automatic field numbering" vs. "manual field specification"? Why not 
"numbering" for both?

--
nosy: +vinay.sajip

___
Python tracker 

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



[issue14712] Integrate PEP 405

2012-06-03 Thread Vinay Sajip

Vinay Sajip  added the comment:

Closing, as the changes are now incorporated in default, and the buildbots seem 
reasonably happy.

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

___
Python tracker 

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



[issue1521950] shlex.split() does not tokenize like the shell

2012-06-03 Thread Vinay Sajip

Changes by Vinay Sajip :


Added file: http://bugs.python.org/file25809/388411be9b61.diff

___
Python tracker 

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



[issue13598] string.Formatter doesn't support empty curly braces "{}"

2012-06-03 Thread Éric Araujo

Éric Araujo  added the comment:

Could you upload just one patch with fix and test, addressing my previous 
comments, and remove the old patches?  It will make it easier for Eric to 
review when he gets some time.  Please also keep lines under 80 characters.  
Thanks in advance.

--

___
Python tracker 

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



[issue14991] Option for regex groupdict() to show only matching names

2012-06-03 Thread Raymond Hettinger

New submission from Raymond Hettinger :

Currently, mo.groupdict() always inserts a default value for unmatched named 
groups.   This is helpful in some use cases and awkward in others.

I propose adding an option to suppress default entries:

>>> # CURRENT WAY
>>> pattern = r'(?PMrs |Mr |Dr )?(?P\w+)(?P Phd| JD)?'
>>> print re.match(pattern, 'Dr Who').groupdict()
{'LASTNAME': 'Who', 'SUFFIX': None, 'TITLE': 'Dr '}

>>> # PROPOSED WAY
>>> print re.match(pattern, 'Dr Who').groupdict(nodefault=True)
{'LASTNAME': 'Who', 'TITLE': 'Dr '}

>>> # UPSTREAM VARIANT
>>> print re.match(pattern, 'Dr Who', re.NODEFAULT).groupdict()
{'LASTNAME': 'Who', 'TITLE': 'Dr '}

There is probably a better name than "nodefault", but I would like to see 
someway to improve the usability of groupdict().

--
messages: 162223
nosy: rhettinger
priority: normal
severity: normal
status: open
title: Option for regex groupdict() to show only matching names
type: enhancement
versions: Python 3.4

___
Python tracker 

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



[issue1079] decode_header does not follow RFC 2047

2012-06-03 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 0808cb8c60fd by R David Murray in branch 'default':
#2658: Add test for issue fixed by fix for #1079.
http://hg.python.org/cpython/rev/0808cb8c60fd

--

___
Python tracker 

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



[issue2658] decode_header() fails on multiline headers

2012-06-03 Thread R. David Murray

R. David Murray  added the comment:

This is fixed by the fix for issue 1079.  I've added the test to the test suite.

--
resolution:  -> duplicate
stage:  -> committed/rejected
status: open -> closed
superseder:  -> decode_header does not follow RFC 2047
versions:  -Python 2.7, Python 3.1, Python 3.2

___
Python tracker 

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



[issue2658] decode_header() fails on multiline headers

2012-06-03 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 0808cb8c60fd by R David Murray in branch 'default':
#2658: Add test for issue fixed by fix for #1079.
http://hg.python.org/cpython/rev/0808cb8c60fd

--
nosy: +python-dev

___
Python tracker 

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



[issue1467619] Header.decode_header eats up spaces

2012-06-03 Thread R. David Murray

R. David Murray  added the comment:

This is fixed by the fix in issue 1079.  Ralf found a *relatively* backward 
compatible way to fix it, but since the point is preserving whitespace that 
wasn't preserved before, there is an unavoidable behavior change, so it can't 
be backported.

--
resolution:  -> duplicate
stage: needs patch -> committed/rejected
status: open -> closed
superseder:  -> decode_header does not follow RFC 2047

___
Python tracker 

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



[issue1079] decode_header does not follow RFC 2047

2012-06-03 Thread R. David Murray

R. David Murray  added the comment:

OK, I'm closing this, then, and will close the related issues as well.

Thanks again for the patch, Ralf.

--
resolution:  -> fixed
stage: patch review -> committed/rejected
status: open -> closed
versions:  -Python 2.7, Python 3.2

___
Python tracker 

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



[issue14673] add sys.implementation

2012-06-03 Thread Barry A. Warsaw

Barry A. Warsaw  added the comment:

On Jun 02, 2012, at 08:03 AM, Amaury Forgeot d'Arc wrote:

>- _PyNamespace_New should be a public API function.  From Python code,
>- SimpleNamespace is public.

This is a separate discussion.  I'm not opposed, but I don't think this should
be addressed in this patch.

>- SimpleNamespace should support weak references.

Again, this could be addressed separately.

--

___
Python tracker 

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



[issue1079] decode_header does not follow RFC 2047

2012-06-03 Thread Barry A. Warsaw

Barry A. Warsaw  added the comment:

On Jun 02, 2012, at 09:59 PM, R. David Murray wrote:

>I've applied this to 3.3.  Because the preservation of spaces around the
>ascii parts is a visible behavior change that could cause working programs to
>break, I don't think I can backport it.  I'm going to leave this open until I
>can consult with Barry to see if he thinks a backport is justified.  Anyone
>else can feel free to chime in with an opinion as well :)

I think a backport is risky.

--

___
Python tracker 

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



[issue14673] add sys.implementation

2012-06-03 Thread Barry A. Warsaw

Barry A. Warsaw  added the comment:

On Jun 02, 2012, at 11:33 PM, Eric Snow wrote:

>Added file: http://bugs.python.org/file25804/issue14673_full_4.diff

Hi Eric.  I'm ready to do a final review and merge this in, but I just want to
be sure I'm looking at the right file.  Is full_4.diff the most up-to-date
patch, and is it complete (i.e. contains all code, docs, and tests)?

--

___
Python tracker 

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



[issue14894] distutils.LooseVersion fails to compare number and a word

2012-06-03 Thread Natalia

Changes by Natalia :


Removed file: http://bugs.python.org/file25807/14894.patch

___
Python tracker 

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



[issue14894] distutils.LooseVersion fails to compare number and a word

2012-06-03 Thread Natalia

Natalia  added the comment:

I had a wrong return value in one of unit tests, fixed.

--
Added file: http://bugs.python.org/file25808/14894.patch

___
Python tracker 

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



[issue14894] distutils.LooseVersion fails to compare number and a word

2012-06-03 Thread Natalia

Natalia  added the comment:

Hi, I'm attaching a patch that fixes this issue:)

--
keywords: +patch
Added file: http://bugs.python.org/file25807/14894.patch

___
Python tracker 

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



[issue7559] TestLoader.loadTestsFromName swallows import errors

2012-06-03 Thread R. David Murray

R. David Murray  added the comment:

Thanks for figuring that out.  And no, it doesn't matter if it is 
importlib.load_module or __import__, since both are provided by importlib now 
and both use the cache.

It's an interesting question where the cache clear should go.  I *think* it 
should go in the test, based on the idea that the cache is part of the 
environment, and therefore should be reset by tests that change what's on the 
path.  I'm not sure how we'd write an environment monitor for that, since not 
all changes to the import cache need to be reset.  I wonder if it would be 
worth putting a reset into DirsOnSysPath.

--
nosy: +brett.cannon

___
Python tracker 

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



[issue11480] Cannot copy a class with a metaclass other than type

2012-06-03 Thread Daniel Urban

Daniel Urban  added the comment:

I've updated the patch to the current version. I've also checked, that the 
tests still pass.

--
nosy: +ncoghlan
Added file: http://bugs.python.org/file25806/copy_metaclass_2.patch

___
Python tracker 

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



[issue14983] email.generator should always add newlines after closing boundaries

2012-06-03 Thread Dmitry Shachnev

Dmitry Shachnev  added the comment:

> Hmm.  So that means the verifiers are not paying attention to the MIME > RFC? 
>  That's unfortunate.

It seems that's true...

--

___
Python tracker 

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



[issue14959] ttk.Scrollbar in Notebook widget freezes

2012-06-03 Thread David Beck

David Beck  added the comment:

That's a shame, though I guess it means I can stop struggling with the 
installation of Tix. Since that's another extension of Tk, the same issue will 
probably be lurking in there as well. Maybe I'll give wxPyton or QT a shot.

Thanks for your help.

--

___
Python tracker 

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



[issue14929] IDLE crashes on *Edit / Find in files ...* command

2012-06-03 Thread Francisco Gracia

Francisco Gracia  added the comment:

While your are at it, here is another suggestion: what the *Find in files ...* 
dialog needs most urgently in my opinion is a field for specifying clearly the 
directory from which the user wants to launch the search.

Also in my modest opinion, having an input field for encondings would be good, 
although detecting the encodings of the handled files is something that any 
self respecting software should reliably do by itself.

--

___
Python tracker 

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



[issue13598] string.Formatter doesn't support empty curly braces "{}"

2012-06-03 Thread Ramchandra Apte

Ramchandra Apte  added the comment:

What is the status of the bug?

--

___
Python tracker 

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



[issue14990] detect_encoding should fail with SyntaxError on invalid encoding

2012-06-03 Thread Florent Xicluna

Florent Xicluna  added the comment:

This patch seems to fix the issue.

--
keywords: +patch
stage: needs patch -> patch review
Added file: http://bugs.python.org/file25805/issue14990_detect_encoding.diff

___
Python tracker 

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



[issue14990] detect_encoding should fail with SyntaxError on invalid encoding

2012-06-03 Thread Florent Xicluna

New submission from Florent Xicluna :

I've hit this issue while playing with tokenize for the pep8.py module.

The tokenize detect_encoding() should report SyntaxError when the encoding is 
improperly declared.

However it raises a LookupError in some cases.

$ ./python -m tokenize Lib/test/bad_coding2.py 
unexpected error: unknown encoding: utf8-sig
Traceback (most recent call last):
  File "./Lib/runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
  File "./Lib/runpy.py", line 75, in _run_code
exec(code, run_globals)
  File "./Lib/tokenize.py", line 686, in 
main()
  File "./Lib/tokenize.py", line 656, in main
tokens = list(tokenize(f.readline))
  File "./Lib/tokenize.py", line 489, in _tokenize
line = line.decode(encoding)
LookupError: unknown encoding: utf8-sig

--
components: Library (Lib)
messages: 162205
nosy: flox
priority: normal
severity: normal
stage: needs patch
status: open
title: detect_encoding should fail with SyntaxError on invalid encoding
type: behavior
versions: Python 3.1, Python 3.2, Python 3.3

___
Python tracker 

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



[issue14937] IDLE's deficiency in the completion of file names (Python 32, Windows XP)

2012-06-03 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

I have now fixed it by looking for the beginning of the string, and not 
checking for file name characters at all. There was a related issue that the 
auto-complete window would disappear if you type a non-ascii character; I have 
fixed that as well.

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

___
Python tracker 

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



[issue14937] IDLE's deficiency in the completion of file names (Python 32, Windows XP)

2012-06-03 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 41e85ac2ccef by Martin v. Löwis in branch '3.2':
Issue #14937: Perform auto-completion of filenames in strings even for 
non-ASCII filenames.
http://hg.python.org/cpython/rev/41e85ac2ccef

New changeset 9aa8af0761ef by Martin v. Löwis in branch 'default':
Merge 3.2: issue #14937.
http://hg.python.org/cpython/rev/9aa8af0761ef

--
nosy: +python-dev

___
Python tracker 

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



[issue14986] print() fails on latin1 characters on OSX

2012-06-03 Thread Adrian Bastholm

Adrian Bastholm  added the comment:

Thanks a lot for the help, guys !

--

___
Python tracker 

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



[issue14989] http.server option to run CGIHTTPRequestHandler

2012-06-03 Thread Senthil Kumaran

Senthil Kumaran  added the comment:

I have added this in 3.3, I am not sure if adding to 3.2 is a good idea. To 
some, it may look like a feature.

--
resolution:  -> fixed
stage: needs patch -> committed/rejected

___
Python tracker 

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



[issue14989] http.server option to run CGIHTTPRequestHandler

2012-06-03 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 935a656359ae by Senthil Kumaran in branch 'default':
Issue 14989: http.server --cgi option can enable the CGI http server.
http://hg.python.org/cpython/rev/935a656359ae

--
nosy: +python-dev

___
Python tracker 

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



[issue14989] http.server option to run CGIHTTPRequestHandler

2012-06-03 Thread Senthil Kumaran

New submission from Senthil Kumaran :

python3 -m http.server enables you to serve with SimpleHTTPRequestHandler 
serving as http server. If the cgi-bin paths are present those are *not treated 
as cgi paths*.  Previously in Python2, python -m CGIHTTPServer enabled the 
sever to run it as CGI enabled HTTP Server.

Since in Python3, both SimpleHTTPServer and CGIHTTPServer are combined into 
http/server.py, I think having a option to serve cgi server from command like 
invocation is a good idea.

This is not a new feature, just an enabler in command line execution of 
http.server module and I think, it should be made available in 3.2 as well as 
it already available in 2.7 ( via CGIHTTPServer).

--
assignee: orsenthil
messages: 162199
nosy: orsenthil
priority: normal
severity: normal
stage: needs patch
status: open
title: http.server option to run CGIHTTPRequestHandler
type: behavior
versions: Python 3.2, Python 3.3

___
Python tracker 

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



[issue14988] _elementtree: Raise ImportError when importing of pyexpat fails

2012-06-03 Thread Zac Medico

Changes by Zac Medico :


--
nosy: +zmedico

___
Python tracker 

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



[issue14988] _elementtree: Raise ImportError when importing of pyexpat fails

2012-06-03 Thread Arfrever Frehtes Taifersar Arahesis

New submission from Arfrever Frehtes Taifersar Arahesis 
:

If, after building of Python, libexpat.so (library used by pyexpat module) has 
been broken/removed or pyexpat module has been broken/removed, then attempt of 
import of _elementtree module, which requires pyexpat module, will raise 
strange exceptions in Python 3.

These exceptions can be simulated by setting sys.modules["pyexpat"] = None.

$ python2.6 -c 'import sys; sys.modules["pyexpat"] = None; import _elementtree'
Traceback (most recent call last):
  File "", line 1, in 
ImportError: No module named pyexpat
$ python2.7 -c 'import sys; sys.modules["pyexpat"] = None; import _elementtree'
Traceback (most recent call last):
  File "", line 1, in 
ImportError: PyCapsule_Import could not import module "pyexpat"
$ python3.1 -c 'import sys; sys.modules["pyexpat"] = None; import _elementtree'
Traceback (most recent call last):
  File "", line 1, in 
SystemError: initialization of _elementtree raised unreported exception
$ python3.2 -c 'import sys; sys.modules["pyexpat"] = None; import _elementtree'
Traceback (most recent call last):
  File "", line 1, in 
SystemError: initialization of _elementtree raised unreported exception
$ python3.3 -c 'import sys; sys.modules["pyexpat"] = None; import _elementtree'
Traceback (most recent call last):
  File "", line 1, in 
  File "", line 1286, in _find_and_load
  File "", line 1253, in _find_and_load_unlocked
  File "", line 432, in _check_name_wrapper
  File "", line 347, in set_package_wrapper
  File "", line 360, in set_loader_wrapper
  File "", line 870, in load_module
RuntimeError: cannot load dispatch table from pyexpat

I suggest to raise ImportError instead of SystemError or RuntimeError.
Third-party modules would rather use only 'except ImportError: pass' instead of 
'except (ImportError, SystemError, RuntimeError): pass' when trying to 
optionally use e.g. xml.etree.cElementTree.
xml.etree.ElementTree in Python 3.3 also ignores only ImportError when trying 
to import _elementtree.

--
messages: 162198
nosy: Arfrever, eli.bendersky, flox
priority: normal
severity: normal
status: open
title: _elementtree: Raise ImportError when importing of pyexpat fails
versions: Python 3.2, Python 3.3

___
Python tracker 

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