[issue13043] Unexpected behavior of imp.find_module(".") with a package present in sys.path and also referenced in a .pth file

2011-09-25 Thread Arfrever Frehtes Taifersar Arahesis

New submission from Arfrever Frehtes Taifersar Arahesis 
:

# python3.3 -c 'import imp; print(imp.find_module("."))'
Traceback (most recent call last):
  File "", line 1, in 
ImportError: No module named '.'
# mkdir /usr/lib64/python3.3/site-packages/something
# touch /usr/lib64/python3.3/site-packages/something/__init__.py
# echo something > /usr/lib64/python3.3/site-packages/something.pth
# python3.3 -c 'import imp; print(imp.find_module("."))'
(None, '/usr/lib64/python3.3/site-packages/something/.', ('', '', 5))

--
messages: 144519
nosy: Arfrever
priority: normal
severity: normal
status: open
title: Unexpected behavior of imp.find_module(".") with a package present in 
sys.path and also referenced in a .pth file
versions: Python 2.7, Python 3.2, Python 3.3

___
Python tracker 

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



[issue13043] Unexpected behavior of imp.find_module(".") with a package present in sys.path and also referenced in a .pth file

2011-09-25 Thread Arfrever Frehtes Taifersar Arahesis

Arfrever Frehtes Taifersar Arahesis  added the comment:

After thinking more about it, it's probably expected.

--
resolution:  -> invalid
status: open -> closed

___
Python tracker 

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



[issue13041] argparse: terminal width is not detected properly

2011-09-25 Thread Zbyszek Szmek

Zbyszek Szmek  added the comment:

I see that adding a separate module was proposed in issue #8408, which was 
rejected/closed. I don't have the rights to reopen, so I'll continue here.

#8408 was proposing a new module, which seems a bit overkill, since the 
implementation for unix and windows is about 20 lines.

I'm attaching a second version of the patch which works on windows (tested with 
python3.2.2 on XP). Thanks to techtonik for pointing to a windows imlementation.

--
Added file: http://bugs.python.org/file23241/patch1.1.diff

___
Python tracker 

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



[issue12806] argparse: Hybrid help text formatter

2011-09-25 Thread Zbyszek Szmek

Zbyszek Szmek  added the comment:

On 09/25/2011 01:50 AM, Graylin Kim wrote:
>
> Graylin Kim  added the comment:
>
> I fully support taking blank line based line-wrapping approach and agree with 
> Zbyszek's suggested indentation approach as well. I am not sure why they 
> didn't occur to me at the time but they are certainly a more effective and 
> widely adopted approaches to the structured text problem.
>
> I suppose here is where I should volunteer to update the patch file...
>
>
> Re: Bike-shedding
>
>> dash '-' has special meaning in brackets:
>
> Good catch, I had intended on '-' being a valid list item character. It 
> clearly needs to be escaped. Not that it would matter given your proposed 
> alternative.
>
>>>   if(list_match):
>> Parenthesis unnecessary.
>
> In my defense I have the sadistic pleasure of coding in PHP where they are 
> necessary for 8 hours a day for my day job. I can only apologize profusely 
> for my offense and beg for forgiveness :)
>

:)

>>> lines = list()
>> Why not just 'lines = []'?
>
> Not to get off topic, but I happen to like list() and dict() instead of [] 
> and {} for empty collections. If there are non-religious reasons for avoiding 
> this practice I'll consider it. I don't want to invoke a holy war here, just 
> wondering if there are practical reasons.

In general brevity is good, but I agree that this is just a style 
question, and not very important here.

This wasn't my intention, I was only saying that due to this bug the 
wrapping uses fixed width, but I'm hoping that #13041 will be 
successfully resolved.

--

___
Python tracker 

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



[issue12981] rewrite multiprocessing (senfd|recvfd) in Python

2011-09-25 Thread Charles-François Natali

Changes by Charles-François Natali :


--
dependencies:  -_XOPEN_SOURCE and _XOPEN_SOURCE_EXTENDED usage on Solaris
resolution:  -> fixed
stage:  -> committed/rejected

___
Python tracker 

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



[issue12981] rewrite multiprocessing (senfd|recvfd) in Python

2011-09-25 Thread Charles-François Natali

Changes by Charles-François Natali :


--
status: open -> closed

___
Python tracker 

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



[issue13041] argparse: terminal width is not detected properly

2011-09-25 Thread Denilson Figueiredo de Sá

Denilson Figueiredo de Sá  added the comment:

> #8408 was proposing a new module, which seems a bit overkill

If a module seems overkill, then maybe add this useful function to os module. 
Don't leave it private to argparse module. Maybe something along these lines:

>>> import os
>>> print(os.get_terminal_size())
(80, 25)

Why do I believe a module could be better? Because I'd also like some way to 
detect when the terminal size has changed (without probing it all the time).

--

___
Python tracker 

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



[issue1621] Do not assume signed integer overflow behavior

2011-09-25 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 3fb9464f9b02 by Mark Dickinson in branch 'default':
Issue #1621: Fix undefined behaviour from signed overflow in datetime module 
hashes, array and list iterations, and get_integer (stringlib/string_format.h)
http://hg.python.org/cpython/rev/3fb9464f9b02

--

___
Python tracker 

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



[issue13044] pdb throws AttributeError at end of debugging session

2011-09-25 Thread akl

New submission from akl :

Using Python 2.7.1 on OpenBSD-current and 2.7.2 on Arch Linux, pdb throws a 
(harmless, it appears) exception at the end of a debugging session.  This does 
not happen for me using Python 2.5 or 2.6 or 3.2.

Console Session (on linux):

$ python2 --version
Python 2.7.2

$ python2 debug.py 
> /tmp/debug.py(4)()
-> a = 1
(Pdb) n
> /tmp/debug.py(5)()
-> b = 2
(Pdb) n
> /tmp/debug.py(6)()
-> sum = a + b
(Pdb) n
--Return--
> /tmp/debug.py(6)()->None
-> sum = a + b
(Pdb) n
Exception AttributeError: "'NoneType' object has no attribute 'path'" in 
 ignore

--
components: Library (Lib)
files: debug.py
messages: 144525
nosy: akl
priority: normal
severity: normal
status: open
title: pdb throws AttributeError at end of debugging session
type: behavior
versions: Python 2.7
Added file: http://bugs.python.org/file23242/debug.py

___
Python tracker 

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



[issue13045] [PATCH] socket.getsockopt may require custom buffer contents

2011-09-25 Thread Artyom Gavrichenkov

New submission from Artyom Gavrichenkov :

Currently the Python implementation of socket.getsockopt allows only option 
name, level name and buffer size as its arguments. However, IEEE Standard 
1003.1-2008 allows one further argument -- an actual buffer to modify at the 
kernel level. POSIX does not prohibit the kernel from reading this buffer 
before modification, and the contents of the buffer may be used together with 
option and level names to specify an exact socket option to return.

In fact, this is how some applications already work, ipset 
(http://ipset.netfilter.org/) being a noticeable example.

The patch, written against Python 3.2 and aiming at providing this 
functionality, is attached. It may also apply to previous Python versions, 
though it's not tested against anything except Python 3.2.

--
components: Extension Modules
files: getsockopt_buffer_input.patch
keywords: patch
messages: 144526
nosy: Artyom.Gavrichenkov
priority: normal
severity: normal
status: open
title: [PATCH] socket.getsockopt may require custom buffer contents
type: feature request
versions: Python 3.2
Added file: http://bugs.python.org/file23243/getsockopt_buffer_input.patch

___
Python tracker 

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



[issue13046] imp.find_module() should not find unimportable modules

2011-09-25 Thread Arfrever Frehtes Taifersar Arahesis

New submission from Arfrever Frehtes Taifersar Arahesis 
:

imp.find_module() can find files, which cannot be imported. I suggest that 
imp.find_module() raise an exception in such cases.

$ cd /tmp
$ touch .something.py
$ python3.3
Python 3.3.0a0 (default:5e456e1a9e8c+, Sep 25 2011, 18:57:23) 
[GCC 4.5.3] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import .something
  File "", line 1
import .something
   ^
SyntaxError: invalid syntax
>>> module = __import__(".something")
Traceback (most recent call last):
  File "", line 1, in 
ValueError: Empty module name
>>> import imp
>>> file, pathname, description = imp.find_module(".something")
>>> file, pathname, description
(<_io.TextIOWrapper name=4 mode='U' encoding='utf-8'>, '.something.py', ('.py', 
'U', 1))

--
components: Interpreter Core
messages: 144527
nosy: Arfrever
priority: normal
severity: normal
status: open
title: imp.find_module() should not find unimportable modules
versions: Python 2.7, Python 3.2, Python 3.3

___
Python tracker 

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



[issue10588] imp.find_module raises unexpected SyntaxError

2011-09-25 Thread Arfrever Frehtes Taifersar Arahesis

Changes by Arfrever Frehtes Taifersar Arahesis :


--
nosy: +Arfrever

___
Python tracker 

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



[issue13046] imp.find_module() should not find unimportable modules

2011-09-25 Thread Ezio Melotti

Ezio Melotti  added the comment:

I'm not sure they should be disallowed.  We have ways to set variables and 
attributes with "invalid" names (like '.something') too.  OTOH __import__ fails 
to import the .something due to the special meaning of the dot, but it imports 
things like foo-bar.py just fine.
Also I'm assuming that with "unimportable" you just mean "with a name that is 
not a valid identifier" and not other modules that can't be imported for other 
reasons.

--
nosy: +brett.cannon, ezio.melotti, ncoghlan
type:  -> behavior

___
Python tracker 

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



[issue13046] imp.find_module() should not find unimportable modules

2011-09-25 Thread Arfrever Frehtes Taifersar Arahesis

Arfrever Frehtes Taifersar Arahesis  added the comment:

I mean files, which cannot be imported even by __import__().
I know that __import__() can import foo-bar.py.

--

___
Python tracker 

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



[issue11751] Increase distutils.filelist / packaging.manifest test coverage

2011-09-25 Thread Justin Love

Justin Love  added the comment:

Incorporated some formatting suggestions.

Removed _actions.  Just as well, as I accidentally left in the 'blarg' bogus 
action ;^)

Added a test for implicit-include.

Whether 'this cannot happen' can happen depends on the output of 
_parse_template_line.  If you wanted to remove the catch-all and still have 
test backup, you'd probably have to restort to some form of fuzz-testing 
_process_template_line.  As the code stands now it could be removed.  I left it 
alone as insurance against future changes.

--
Added file: http://bugs.python.org/file23244/packaging-manifest_v3.diff

___
Python tracker 

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



[issue13045] socket.getsockopt may require custom buffer contents

2011-09-25 Thread Artyom Gavrichenkov

Changes by Artyom Gavrichenkov :


--
title: [PATCH] socket.getsockopt may require custom buffer contents -> 
socket.getsockopt may require custom buffer contents

___
Python tracker 

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



[issue13047] imp.find_module("") and imp.find_module(".")

2011-09-25 Thread Arfrever Frehtes Taifersar Arahesis

New submission from Arfrever Frehtes Taifersar Arahesis 
:

It's undocumented that imp.find_module("") and imp.find_module(".") try to find 
__init__.py.

There is also a small difference in behavior between them.
sys.path by default contains "" as the first element, which is sufficient for 
imp.find_module("."), but not for imp.find_module(""):

$ mkdir /tmp/imp_tests
$ cd /tmp/imp_tests
$ touch __init__.py
$ python3.3 -c 'import imp, sys; print(repr(sys.path[0])); 
print(imp.find_module("."))'
''
(None, '.', ('', '', 5))
$ python3.3 -c 'import imp, sys; print(repr(sys.path[0])); 
print(imp.find_module(""))'
''
Traceback (most recent call last):
  File "", line 1, in 
ImportError: No module named ''

If sys.path contains path (e.g. "." or absolute path) to directory with 
__init__.py file, then imp.find_module("") will succeed:

$ PYTHONPATH="." python3.3 -c 'import imp, sys; print(repr(sys.path[0:2])); 
print(imp.find_module("."))'
['', '/tmp/imp_tests']
(None, '.', ('', '', 5))
$ PYTHONPATH="." python3.3 -c 'import imp, sys; print(repr(sys.path[0:2])); 
print(imp.find_module(""))'
['', '/tmp/imp_tests']
(None, '/tmp/imp_tests/', ('', '', 5))
$ python3.3 -c 'import imp, sys; sys.path.insert(1, "."); 
print(repr(sys.path[0:2])); print(imp.find_module("."))'
['', '.']
(None, '.', ('', '', 5))
$ python3.3 -c 'import imp, sys; sys.path.insert(1, "."); 
print(repr(sys.path[0:2])); print(imp.find_module(""))'
['', '.']
(None, './', ('', '', 5))

I think that imp.find_module(".") and imp.find_module("") should have the same 
behavior, and this behavior should be documented.

--
assignee: docs@python
components: Documentation, Interpreter Core
messages: 144531
nosy: Arfrever, docs@python
priority: normal
severity: normal
status: open
title: imp.find_module("") and imp.find_module(".")
versions: Python 2.7, Python 3.2, Python 3.3

___
Python tracker 

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



[issue13047] imp.find_module("") and imp.find_module(".")

2011-09-25 Thread Ezio Melotti

Changes by Ezio Melotti :


--
nosy: +brett.cannon, ezio.melotti, ncoghlan

___
Python tracker 

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



[issue13048] Handling of paths in first argument of imp.find_module()

2011-09-25 Thread Arfrever Frehtes Taifersar Arahesis

New submission from Arfrever Frehtes Taifersar Arahesis 
:

It's undocumented that imp.find_module() supports paths with "/" as the first 
argument:

$ mkdir /tmp/imp_tests
$ cd /tmp/imp_tests
$ mkdir a
$ touch a/b.py
$ python3.3 -c 'import imp; print(imp.find_module("a/b"))'
(<_io.TextIOWrapper name=4 mode='U' encoding='utf-8'>, 'a/b.py', ('.py', 'U', 
1))

--
assignee: docs@python
components: Documentation, Interpreter Core
messages: 144532
nosy: Arfrever, brett.cannon, docs@python, ezio.melotti, ncoghlan
priority: normal
severity: normal
status: open
title: Handling of paths in first argument of imp.find_module()
versions: Python 2.7, Python 3.2, Python 3.3

___
Python tracker 

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



[issue11676] Improve imp.load_module and submodules doc

2011-09-25 Thread Arfrever Frehtes Taifersar Arahesis

Changes by Arfrever Frehtes Taifersar Arahesis :


--
nosy: +Arfrever

___
Python tracker 

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



[issue12806] argparse: Hybrid help text formatter

2011-09-25 Thread Zbyszek Szmek

Zbyszek Szmek  added the comment:

[I now see that roundup ate half of my reply. I have no idea why,
 because the e-mail is formatted correctly. Maybe I'll have more
 luck this time, but since there's no preview, I must try to see.]

On 09/25/2011 01:50 AM, Graylin Kim wrote:
>>>   if(list_match):
>> Parenthesis unnecessary.
>
> In my defense I have the sadistic pleasure of coding in PHP where
> they are necessary for 8 hours a day for my day job. I can only
> apologize profusely for my offense and beg for forgiveness

:)

>>> lines = list()
>> Why not just 'lines = []'?
>
> Not to get off topic, but I happen to like list() and dict() instead
> of [] and {} for empty collections. If there are non-religious
> reasons for avoiding this practice I'll consider it. I don't want to
> invoke a holy war here, just wondering if there are practical reasons.

In general brevity is good, but I agree that this is just a style question, and 
not very important here.

>> One a side note: due to #13041 the terminal width is normally stuck
> at 80 chars.
> Not a good reason to remove the flexibility from the implementation
> I don't think.
This wasn't my intention, I was only saying that due to this bug the wrapping 
uses fixed width, but I'm hoping that #13041 will be successfully resolved.

--

___
Python tracker 

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



[issue13040] call to tkinter.messagebox.showinfo hangs the script on timer on Windows

2011-09-25 Thread Richard86

Changes by Richard86 :


--
nosy: +gpolo

___
Python tracker 

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



[issue13044] pdb throws AttributeError at end of debugging session

2011-09-25 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

By modifying a bit the Python intepreter, I got this traceback:

Traceback (most recent call last):
  File "/home/amauryfa/python/cpython2.7/Lib/_weakrefset.py", line 38, in 
_remove
def _remove(item, selfref=ref(self)):
  File "/home/amauryfa/python/cpython2.7/Lib/bdb.py", line 50, in trace_dispatch
return self.dispatch_call(frame, arg)
  File "/home/amauryfa/python/cpython2.7/Lib/bdb.py", line 76, in dispatch_call
if not (self.stop_here(frame) or self.break_anywhere(frame)):
  File "/home/amauryfa/python/cpython2.7/Lib/bdb.py", line 147, in 
break_anywhere
return self.canonic(frame.f_code.co_filename) in self.breaks
  File "/home/amauryfa/python/cpython2.7/Lib/bdb.py", line 33, in canonic
canonic = os.path.abspath(filename)
AttributeError: 'NoneType' object has no attribute 'path'

Here is the gdb stack when the error is printed:

#0  PyErr_Print () at Python/pythonrun.c:1040
#1  0x00480c1d in handle_callback (object=) at 
Objects/weakrefobject.c:884
#2  PyObject_ClearWeakRefs (object=) at 
Objects/weakrefobject.c:966
#3  0x00423a37 in class_dealloc (op=0x77f68890) at 
Objects/classobject.c:193
#4  0x0046a7ed in tupledealloc (op=0x77f89410) at 
Objects/tupleobject.c:220
#5  0x00423afb in class_dealloc (op=0x77f7ed50) at 
Objects/classobject.c:194
#6  0x004270cb in instance_dealloc (inst=0x77f8a518) at 
Objects/classobject.c:670
#7  0x0044de47 in insertdict (mp=0x7f7800, key='environ', 
hash=-5347984860299468300, value=None)
at Objects/dictobject.c:530
#8  0x00450287 in PyDict_SetItem (op=
{'WTERMSIG': None, 'lseek': None, 'EX_IOERR': None, 'EX_NOHOST': None, 
'seteuid': None, 'pathsep': None, 'execle': None, 'major': None, '_Environ': 
None, 'fstatvfs': None, 'uname': None, 'kill': None, 'urandom': None, 'execlp': 
None, 'getegid': None, 'getresgid': None, 'EX_OSFILE': None, 'umask': None, 
'linesep': None, 'fchmod': None, 'lchown': None, 'setgid': None, 'tmpnam': 
None, 'devnull': None, 'EX_NOINPUT': None, 'makedev': None, 'fstat': None, 
'getlogin': None, 'O_CREAT': None, 'dup2': None, 'read': None, '__file__': 
None, 'getppid': None, 'fchown': None, 'getloadavg': None, 'WIFSTOPPED': None, 
'getpgrp': None, '_spawnvef': None, 'TMP_MAX': None, 'utime': None, 'execl': 
None, 'F_OK': None, '_make_stat_result': None, 'name': None, 'fsync': None, 
'tcsetpgrp': None, 'statvfs': None, 'setreuid': None, 'remove': None, 
'setegid': None, 'P_NOWAITO': None, '_copy_reg': None, 'execv': None, 'spawnv': 
None, 'spawnvpe': None, 'EX_OSERR': None, 'ttyname': None, 'pardir': None, 
 'tempnam': None, 'tmpfile': None, 'sep...(truncated), key='environ', 
value=None) at Objects/dictobject.c:775
#9  0x0045268e in _PyModule_Clear (m=) at 
Objects/moduleobject.c:138
#10 0x004bfa17 in PyImport_Cleanup () at Python/import.c:498
#11 0x004cd9ef in Py_Finalize () at Python/pythonrun.c:447

So, when the interpreter shuts down, the debugger is still active...
Python 3 does not seem to be affected by this issue. And indeed if I make 
UserDict a new-style class, I don't reproduce the error on 2.7 either.

A possible fix is to reset the trace function to None in Py_Finalize.

--
nosy: +amaury.forgeotdarc

___
Python tracker 

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



[issue13013] _ctypes.c: refleak

2011-09-25 Thread Meador Inge

Meador Inge  added the comment:

OK, I will just fix the ref leak in 2.7, 3.2, and 3.3.  This is a pretty 
low-risk fix (as I mentioned before, I can't see how the error condition is 
even executed).

--

___
Python tracker 

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



[issue13044] pdb throws AttributeError at end of debugging session

2011-09-25 Thread Meador Inge

Changes by Meador Inge :


--
nosy: +meador.inge

___
Python tracker 

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