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

2011-10-25 Thread Nick Coghlan

Nick Coghlan  added the comment:

After a little thought, I think the explicit "unwrap" function is the only 
viable approach. Doing the unwrapping implicitly just has too many nasty corner 
cases to track down to ensure we aren't losing existing functionality.

I'd also suggest that we add a __wrapped__ alias for the 'func' attribute of 
functools.partial objects.

--
title: Support for unwrapping __wrapped__ functions in 'inspect' module -> Add 
inspect.unwrap(f) to easily unravel "__wrapped__" chains

___
Python tracker 

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



[issue13266] Support for unwrapping __wrapped__ functions in 'inspect' module

2011-10-25 Thread Ezio Melotti

Changes by Ezio Melotti :


--
nosy: +ezio.melotti
stage:  -> needs patch
type:  -> feature request

___
Python tracker 

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



[issue13266] Support for unwrapping __wrapped__ functions in 'inspect' module

2011-10-25 Thread Nick Coghlan

New submission from Nick Coghlan :

I just got bitten by the singularly unhelpful results of doing 
inspect.getsource(generator_context_manager).

Now that @functools.wraps adds the __wrapped__ attribute, perhaps 
inspect.getsource(f) should follow the wrapper chain by default?

This would affect other inspect APIs as well, such as getgeneratorstate() and 
the new getclosurevars() and getgeneratorlocals() that will be available in 3.3

While the source code of the wrapper could still be accessed by doing 
inspect.getsource(f.__code__), this isn't a reliable alternative in general 
(e.g. it doesn't work when introspecting closure state, since that needs access 
to the function object to look things up correctly). Accordingly, there would 
need to be a way to disable the "follow wrapper chains behaviour".

Alternatively (and more simply), we could just add an "inspect.unwrap(f)" 
function that followed a chain of __wrapped__ attributes and returned the last 
object in the chain (using an "already seen" set to avoid hit the recursion 
limit if someone sets up a wrapper loop). Applying this would then be a manual 
process when the initial output of an inspect function is clearly coming from a 
wrapper rather than the underlying function definition.

--
components: Library (Lib)
messages: 146420
nosy: ncoghlan
priority: normal
severity: normal
status: open
title: Support for unwrapping __wrapped__ functions in 'inspect' module
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



[issue13263] Group some os functions in submodules

2011-10-25 Thread Ezio Melotti

Ezio Melotti  added the comment:

It would be fine for me to rename os.sched_get_priority_max() to 
os.sched.get_priority_max().
os.sched.sched_get_priority_max() is a bit redundant, and I think it's not to 
difficult to figure out that os.sched.get_priority_max() corresponds to the 
posix sched_get_priority_max() function, especially if we add a note to the doc 
(I'm only -0 about keeping the original name though).
Regarding the other functions that don't share a common prefix it's certainty 
better to keep the original name.

--

___
Python tracker 

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



[issue13247] os.path.abspath returns unicode paths as question marks

2011-10-25 Thread Yuval Greenfield

Yuval Greenfield  added the comment:

I use python a lot with Hebrew and many websites have internationalization 
which may involve unicode paths. I agree that saying "unicode paths are rare" 
is inaccurate. 

If the current situation isn't fixed though - you just can't use the resulting 
path for almost anything. Do you have a use case Ishimoto?

Windows XP and up implement paths as unicode, that means that a bytes api 
doesn't even make sense unless python does some encoding and decoding for you. 
E.g. python can use the unicode API's internally and return utf-8 encoded 
bytes. But you couldn't use these paths outside of python. The fact is you 
shouldn't be doing os.path.abspath(b'.') in windows to begin with.

--

___
Python tracker 

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



[issue13263] Group some os functions in submodules

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

Charles-François Natali  added the comment:

> I would prefer to keep the shared prefix even if we move functions to a new 
> module. Python refers usually to the C documentation for the details of a 
> function. If we rename a function, it becomes more difficult to get the 
> manual of the function.

Indeed.
But that's what I understood from Ezio's proposal, I don't think he's
suggesting to rename them.

--

___
Python tracker 

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



[issue13211] urllib2.HTTPError does not have 'reason' attribute.

2011-10-25 Thread Petri Lehtinen

Petri Lehtinen  added the comment:

> It appears the Python 3.2 docs no longer include documentation for URLError

Both URLError and HTTPError are documented in 3.2 and 3.3:

http://docs.python.org/py3k/library/urllib.error.html#urllib.error.URLError

http://docs.python.org/dev/library/urllib.error.html#urllib.error.URLError

It needs to be investigated whether each point raising a HTTPError sets a good 
msg. If this is the case, reason can be aliased to msg.

This could be done for 2.7, too, because this is a bug (deviation from what the 
documentation says) rather than a new feature.

--
keywords: +easy
nosy: +petri.lehtinen
stage:  -> needs patch

___
Python tracker 

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



[issue13265] IDLE crashes when printing some unprintable characters.

2011-10-25 Thread maniram maniram

maniram maniram  added the comment:

The error is visible from the command-line.

--

___
Python tracker 

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



[issue13265] IDLE crashes when printing some unprintable characters.

2011-10-25 Thread Ezio Melotti

Ezio Melotti  added the comment:

Both print(chr(500304)) and print('\U0007a250') seem to work and print two 
empty boxes on IDLE with Python 3.2/WinXP.

Is that error displayed in the IDLE window or does IDLE crash and you see the 
error somewhere else?

--
nosy: +ezio.melotti, kbk

___
Python tracker 

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



[issue13265] IDLE crashes when printing some unprintable characters.

2011-10-25 Thread maniram maniram

maniram maniram  added the comment:

My OS is Ubuntu Linux 11.10 (Oneiric Ocelot)
Running uname -a gives "Linux ramcomputer 3.0.0-12-generic #20-Ubuntu SMP Fri 
Oct 7 14:56:25 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux"

--

___
Python tracker 

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



[issue13265] IDLE crashes when printing some unprintable characters.

2011-10-25 Thread maniram maniram

maniram maniram  added the comment:

Here's the Error message.
*** Internal Error: rpc.py:SocketIO.localcall()

 Object: stdout 
 Method: > 
 Args: ('\U0007a250',)

Traceback (most recent call last):
  File "/usr/lib/python3.2/idlelib/rpc.py", line 188, in localcall
ret = method(*args, **kwargs)
  File "/usr/lib/python3.2/idlelib/PyShell.py", line 1220, in write
self.shell.write(s, self.tags)
  File "/usr/lib/python3.2/idlelib/PyShell.py", line 1202, in write
OutputWindow.write(self, s, tags, "iomark")
  File "/usr/lib/python3.2/idlelib/OutputWindow.py", line 40, in write
self.text.insert(mark, s, tags)
  File "/usr/lib/python3.2/idlelib/Percolator.py", line 25, in insert
self.top.insert(index, chars, tags)
  File "/usr/lib/python3.2/idlelib/ColorDelegator.py", line 79, in insert
self.delegate.insert(index, chars, tags)
  File "/usr/lib/python3.2/idlelib/PyShell.py", line 312, in insert
UndoDelegator.insert(self, index, chars, tags)
  File "/usr/lib/python3.2/idlelib/UndoDelegator.py", line 81, in insert
self.addcmd(InsertCommand(index, chars, tags))
  File "/usr/lib/python3.2/idlelib/UndoDelegator.py", line 116, in addcmd
cmd.do(self.delegate)
  File "/usr/lib/python3.2/idlelib/UndoDelegator.py", line 219, in do
text.insert(self.index1, self.chars, self.tags)
  File "/usr/lib/python3.2/idlelib/ColorDelegator.py", line 79, in insert
self.delegate.insert(index, chars, tags)
  File "/usr/lib/python3.2/idlelib/WidgetRedirector.py", line 104, in __call__
return self.tk_call(self.orig_and_operation + args)
ValueError: unsupported character

--

___
Python tracker 

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



[issue13265] IDLE crashes when printing some unprintable characters.

2011-10-25 Thread maniram maniram

New submission from maniram maniram :

When you print an unprintable character, IDLE raises an error.
>>> print(chr(500304)) # print an unprintable character
The error is only visible when you run the code from a commmand-line.
When you run python from the command-line and execute the code it shows
the unprintable character symbol (looks like []).

--
components: IDLE
messages: 146411
nosy: maniram.maniram
priority: normal
severity: normal
status: open
title: IDLE crashes when printing some unprintable characters.
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



[issue12892] UTF-16 and UTF-32 codecs should reject (lone) surrogates

2011-10-25 Thread Ezio Melotti

Changes by Ezio Melotti :


--
dependencies: +Refactor code using unicode_encode_call_errorhandler() in 
unicodeobject.c

___
Python tracker 

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



[issue13161] problems with help() documentation of __i*__ operators

2011-10-25 Thread Ezio Melotti

Changes by Ezio Melotti :


--
nosy: +ezio.melotti

___
Python tracker 

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



[issue13207] os.path.expanduser breaks when using unicode character in the username

2011-10-25 Thread Ezio Melotti

Changes by Ezio Melotti :


--
nosy: +ezio.melotti

___
Python tracker 

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



[issue12618] py_compile cannot create files in current directory

2011-10-25 Thread Meador Inge

Meador Inge  added the comment:

I think it might be easier to just always use the absolute path rather than 
looking at the directory length.  Maybe something like the attached.  I added 
unit tests as well.

--
nosy: +meador.inge
stage: test needed -> patch review
Added file: http://bugs.python.org/file23523/issue12618-0.py

___
Python tracker 

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



[issue11440] fix_callable should be dropped from lib2to3 / changed

2011-10-25 Thread Ezio Melotti

Ezio Melotti  added the comment:

Benjamin added a note in d9571fb37269.
I agree with Florent though, if the fixer is disabled by default and people are 
using 3.1 they will see the error and enable it.
If they aren't 2to3 will correctly leave callable().

--

___
Python tracker 

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



[issue13240] sysconfig gives misleading results for USE_COMPUTED_GOTOS

2011-10-25 Thread Meador Inge

Meador Inge  added the comment:

>> P.S. We could probably get rid of the HAVE macro all together by doing
>> all the work in the 'configure' script.
> Would that be a breach of backward compatibility for sysconfig?

Yeah, I think so.  Best to leave it alone then.

--

___
Python tracker 

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



[issue13247] os.path.abspath returns unicode paths as question marks

2011-10-25 Thread Atsuo Ishimoto

Atsuo Ishimoto  added the comment:

On Wed, Oct 26, 2011 at 9:12 AM, STINNER Victor  wrote:
>
> STINNER Victor  added the comment:
>
> Le 26/10/2011 01:32, Atsuo Ishimoto a écrit :
>> - I don't think filenames cannot be decoded in ANSI code page are rare 
>> enough to be ignored.
>
> The issue is able being able to be noticied of encoding errors.

This patch solve nothing, but just raises exception. It can break
existing codes. Also, I don't think it worth to add weired behavior to
Python std lib. I'll be surprised if *Byte* API raised an
UnicodeEncodeError.

> Anyway, you must use the Unicode API on Windows. If you use the Unicode
> API, filenames are no more encoded and code pages are no more used, so
> bye bye Unicode errors!
>

Agreed. So I would like to suggest not to adding unnecessary
complexity to the Byte API.

--

___
Python tracker 

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



[issue13247] os.path.abspath returns unicode paths as question marks

2011-10-25 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

The doc says "All functions accepting path or file names accept both bytes and 
string objects, and result in an object of the same type, if a path or file 
name is returned." It does that now (the encoding assumed or produced for bytes 
is not specified). It says nothing about raising exceptions in certain 
situations. So this is a feature change request, one that would likely break 
existing code.

Users can test for invalid returned paths with "'?' in returned_path", though I 
admit that the use of '?' as a glob, regex, and url special char makes it a bad 
choice of error char.

--
nosy: +terry.reedy
type: behavior -> feature request
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



[issue13247] os.path.abspath returns unicode paths as question marks

2011-10-25 Thread STINNER Victor

STINNER Victor  added the comment:

Le 26/10/2011 01:32, Atsuo Ishimoto a écrit :
> - I don't think filenames cannot be decoded in ANSI code page are rare enough 
> to be ignored.

The issue is able being able to be noticied of encoding errors. 
Currently, unencodable characters are silently replaced and you don't 
know if the filename is valid or not. If a UnicodeEncodeError is raised, 
you will be noticed and so you have to fix the problem.

Anyway, you must use the Unicode API on Windows. If you use the Unicode 
API, filenames are no more encoded and code pages are no more used, so 
bye bye Unicode errors!

The Windows bytes API is just kept for backward compatibility. More 
details in my email to python-dev:
http://mail.python.org/pipermail/python-dev/2011-October/114203.html

--

___
Python tracker 

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



[issue1559549] ImportError needs attributes for module and file name

2011-10-25 Thread Brian Curtin

Brian Curtin  added the comment:

Here's an updated patch, plus support for a second attribute that I need for 
#10854. I previously wrote a patch that does this same thing for that issue, 
but this one handles things a lot more nicely :)

I renamed "module_name" to just be "name" since I was adding "path" and didn't 
want to have to name it "module_path" and have two "module_" attributes since I 
think it's clear what they are for. We can go back to "module_" names if you 
want - no big deal.

It's really just the same patch as before but updated for a few minor changes 
(the ComplexExtendsException sig changed), and the moving of keyword handling 
in ImportError_init into a macro since we have to do the same initialization 
twice now. I'm not married to that implementation, it just minimized 
duplication and seems to work alright.

Also, this removes the import.c change (see Brett's last message).

--
nosy: +brian.curtin
Added file: http://bugs.python.org/file23522/issue1559549.diff

___
Python tracker 

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



[issue13247] os.path.abspath returns unicode paths as question marks

2011-10-25 Thread Atsuo Ishimoto

Atsuo Ishimoto  added the comment:

-1 from me.

- I hate to see Unicode exceptions here. It would be an another source of 
mysterious Unicode exception. Programmers and users would be confused by error 
message. If you make such characters error, Python should raise an OSError or 
such.

- File names with '?' are fine to display informations to users. Not all file 
names are nessesary to be used to open files.

- I don't think filenames cannot be decoded in ANSI code page are rare enough 
to be ignored. I use Japanese edition of windows, but I sometime receive files 
with Chinese or German names. 

Or, in some case, I have to change codepage with 'chcp 437' command to run 
console application made for American environment. I seldom run such 
application in these days, though.

--
nosy: +ishimoto

___
Python tracker 

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



[issue13220] print function unable while multiprocessing.Process is being run

2011-10-25 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

This may be a 'cannot fix' issue due to the way Windows connects the output and 
input streams of various processes. It would be helpful to know if *nix has the 
same difference of behavior between interpreter and IDLE shell. Otherwise some 
experiments are needed.

--

___
Python tracker 

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



[issue13244] WebSocket schemes in urllib.parse

2011-10-25 Thread Tobias Oberstein

Tobias Oberstein  added the comment:

> I’d say that urlparse should raise an exception when a ws/wss URI contains a 
> fragment part.

Yep, better.

> I’m not sure this will be possible; from a glance at the source and a quick 
> test, urlparse will happily break the Generic URI Syntax RFC and return a 
> path including a # character!

That's unfortunate.

In that case I'd probably prefer the lesser evil, namely that urlparse be set 
up (falsely) such that ws/wss scheme would falsely allow fragments, so I get 
back the non-empty fragment as a separate component, and check myself.

If urlparse returns the fragment (falsely) within path, then a user could check 
only by searching for # in the path. Also hacky .. even worse than compare 
fragment for != "". 

Essentially, this would be exactly "the hack" that I posted in my very first 
comment:

urlparse.uses_fragment.extend(wsschemes)

===

Alternative: make this bug dependent on fixing urlparse for fragment rules in 
generic URI RFC and don't do anything until then?

--

___
Python tracker 

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



[issue13234] os.listdir breaks with literal paths

2011-10-25 Thread Santoso Wijaya

Santoso Wijaya  added the comment:

> I don't understand this change in issue13234_py33_v4.patch (the change looks 
> to be useless).

It's pedantic correctness on my part. SEP and ALTSEP are defined as wide 
strings L'\\' and L'/' respectively. Their usage in the unicode conditional 
branch and the bytes conditional branch seem to have been reversed.

--

___
Python tracker 

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



[issue13263] Group some os functions in submodules

2011-10-25 Thread STINNER Victor

STINNER Victor  added the comment:

I would prefer to keep the shared prefix even if we move functions to a new 
module. Python refers usually to the C documentation for the details of a 
function. If we rename a function, it becomes more difficult to get the manual 
of the function.

--

___
Python tracker 

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



[issue13234] os.listdir breaks with literal paths

2011-10-25 Thread STINNER Victor

STINNER Victor  added the comment:

-if (ch != SEP && ch != ALTSEP && ch != ':')
+if (ch != '\\' && ch != '/' && ch != ':')

I don't understand this change in issue13234_py33_v4.patch (the change looks to 
be useless).

--

___
Python tracker 

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



[issue13247] os.path.abspath returns unicode paths as question marks

2011-10-25 Thread STINNER Victor

STINNER Victor  added the comment:

os_mbcs.patch adds _Py_EncodeCodePage() to encode directly wchar_t* filenames 
without having to create a temporary Unicode object.

The patch removes HAVE_MBCS because the MBCS is now always needed by the 
posixmodule.c. Anyway, I don't see why MultiByteToWideChar() and 
WideCharToMultiByte() would not be available on Windows.

--

___
Python tracker 

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



[issue13247] os.path.abspath returns unicode paths as question marks

2011-10-25 Thread STINNER Victor

STINNER Victor  added the comment:

os.getcwdb() (GetCurrentDirectoryA) and os.listdir(bytes) (FindNextFileA & co) 
encode filenames using WideCharToMultiByte() in default mode (flags=0): 
unencodable characters are replaced by question marks. Such filenames cannot be 
used, open() fails with OSError(22, "invalid argument: '?'") for example.

Attached patch changes os.getcwdb() and os.listdir(bytes) to use the Windows 
native API (wide character API) with Python MBCS codec in strict mode (error 
handler "strict") to notify directly the user that the filename cannot be 
decoded.

The patch only changes the behaviour for filename not encodable to the ANSI 
code page, such filenames are rare.

--
keywords: +patch
Added file: http://bugs.python.org/file23521/os_mbcs.patch

___
Python tracker 

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



[issue13264] Monkeypatching using metaclass

2011-10-25 Thread Daniel Urban

Daniel Urban  added the comment:

> class Meta(ABCMeta):
> def __instancecheck__(cls, instance):
> # monkeypatching class method
> cls.__subclasscheck__ = super(Meta, cls).__subclasscheck__

This line is approximately the same as:
cls.__dict__['__subclasscheck__'] = ...
So it will put the object in the namespace of cls. The function in the 
namespace of type(cls) will remain there. (Also, the object you put in there is 
a bound method, so this is probably not what you want.)


> return super(Meta, cls).__instancecheck__(instance)
> 
> def __subclasscheck__(cls, sub):
> return cls in sub.mro()
> 
> class A(object):
> __metaclass__ = Meta
> 
> class B(object): pass
> 
> # registering class 'B' as a virtual subclass of 'A'
> A.register(B)
> 
> >>> issubclass(B, A)
> False
> >>> isinstance(B(), A) # => method __subclasscheck__ is now
> monkeypatched

A.__dict__['__subclasscheck__'] is now indeed the other method you put in 
there, but issubclass will call  type(A).__dict__['__subclasscheck__'] which 
remain the same. (Because __special__ methods a looked up directly in the 
namespace of the type of an object, see 
http://docs.python.org/dev/py3k/reference/datamodel#special-lookup).

--

___
Python tracker 

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



[issue13188] generator.throw() ignores __traceback__ of exception

2011-10-25 Thread Petri Lehtinen

Petri Lehtinen  added the comment:

The same issue exists on 2.7, working on a patch.

--
status: closed -> open
versions: +Python 2.7

___
Python tracker 

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



[issue13263] Group some os functions in submodules

2011-10-25 Thread Ross Lagerwall

Ross Lagerwall  added the comment:

Some functions would be easy to split off into separate modules conceptually 
like the sched_* functions and the cap_* functions (see #1615158).

However, certain groups of functions like the *at functions cover a lot of 
different functionality and don't really belong together.

Perhaps the only grouping that should be done is for functions that start with 
a common prefix like sched_* since they are basically in a C "namespace".

--

___
Python tracker 

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



[issue13264] Monkeypatching using metaclass

2011-10-25 Thread Daniel Urban

Changes by Daniel Urban :


--
nosy: +durban

___
Python tracker 

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



[issue13263] Group some os functions in submodules

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

Charles-François Natali  added the comment:

> I think there is a value to use the very same function names in the 
> posix module as in the posix API.

It would still be the case, except that they'd live in distinct submodule.

> The posix API (and C in general) is also flat, and uses the prefix 
> convention.

That's because C doesn't have namespaces: it's certainly due to this 
limitation, and not a design choice (and when you think about it, there is a 
namespace hierarchy, in the header files: , , etc.).

--
nosy: +neologix

___
Python tracker 

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



[issue13234] os.listdir breaks with literal paths

2011-10-25 Thread Santoso Wijaya

Santoso Wijaya  added the comment:

Fair enough. Simplifying.

--
Added file: http://bugs.python.org/file23520/issue13234_py33_v4.patch

___
Python tracker 

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



[issue13263] Group some os functions in submodules

2011-10-25 Thread Ezio Melotti

Ezio Melotti  added the comment:

Of the new ones, only the sched_* ones share a common prefix, the *xattr and 
*at functions share a common suffix, and it's difficult to find them e.g. in 
dir() (also it's difficult to find other common os functions among all the 
names).  The fact that the Posix API and C in general use a flat API doesn't 
seem to me a valid reason to do the same in Python.  Having the same name is a 
good reason to avoid sched.*, even if I don't think that having sched.* will 
make finding/recognizing these functions much more difficult.

--

___
Python tracker 

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



[issue13234] os.listdir breaks with literal paths

2011-10-25 Thread Santoso Wijaya

Santoso Wijaya  added the comment:

Addressing patch comments.

--
Added file: http://bugs.python.org/file23519/issue13234_py33_v3.patch

___
Python tracker 

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



[issue13234] os.listdir breaks with literal paths

2011-10-25 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

This issue is getting messy. I declare that this issue is *only* about the 
original problem reported in msg146031. When that is fixed, this issue will be 
closed, and any further issues need to be reported separately.

As for the original problem, ISTM that the right fix is to replace

namebuf[len++] = '/';

with

namebuf[len++] = '\\';

No further change should be necessary.

--

___
Python tracker 

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



[issue13016] selectmodule.c: refleak

2011-10-25 Thread Petri Lehtinen

Petri Lehtinen  added the comment:

PySequence_Fast_GET_ITEM expects that the object is valid and the index is 
within bounds, and never returns NULL. There's no need to decref and actually 
there's even no need to check the return value of PySequence_Fast_GET_ITEM.

--
resolution:  -> rejected
stage: patch review -> 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



[issue13263] Group some os functions in submodules

2011-10-25 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

I think there is a value to use the very same function names in the posix 
module as in the posix API. The posix API (and C in general) is also flat, and 
uses the prefix convention. People who look at the function lists will know to 
ignore blocks of functions by prefix if they don't need them.

--

___
Python tracker 

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



[issue13017] pyexpat.c: refleak

2011-10-25 Thread Petri Lehtinen

Petri Lehtinen  added the comment:

The patch is not correct: modelobj must not be decref'd, because it has been 
inserted to the args tuple with the reference-stealing 'N' format. args is 
later decref'd in function's cleanup code after "finally:".

--
keywords:  -after moratorium
resolution:  -> rejected
stage: patch review -> 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



[issue12641] Remove -mno-cygwin from distutils

2011-10-25 Thread Seppo Yli-Olli

Seppo Yli-Olli  added the comment:

Would it be practical to have a trivial compilation test to see if we are 
capable of using GCC with -mno-cygwin and if so, use it, otherwise drop off? I 
think GNU autotools uses a similar strategy for detecting compiler capabilities.

--
nosy: +Seppo.Yli-Olli

___
Python tracker 

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



[issue12394] packaging: generate scripts from callable (dotted paths)

2011-10-25 Thread Vinay Sajip

Vinay Sajip  added the comment:

To expand on what I said about not seeing how things will work under Windows: 
are we going to place .exe launchers adjacent to the script, like setuptools 
does? If the script just has a shebang of "#!/usr/bin/env python", how is the 
launcher supposed to determine the exact Python to use from that, in a venv 
scenario where multiple Pythons will be installed? Scripts in virtual envs are 
supposed to run if invoked, even if the env is not on the PATH.

--

___
Python tracker 

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



[issue12394] packaging: generate scripts from callable (dotted paths)

2011-10-25 Thread Vinay Sajip

Vinay Sajip  added the comment:

> 

>>  What about Windows support?
> Just like with distutils: the file extension is used, not the shebang.

Please spell out for me how you see this working: I don't see it. Note that 
scripts have to use the correct Python even if they are invoked using an 
explicit path pointing into a virtual environment.

--

___
Python tracker 

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



[issue13218] test_ssl failures on Debian/Ubuntu

2011-10-25 Thread Barry A. Warsaw

Barry A. Warsaw  added the comment:

Here's the diff that disables SSLv2 and changes the expected sense of the 
connection results.  Again, I can't test this on other than Debian/Ubuntu atm, 
so feedback would be useful.

--
Added file: http://bugs.python.org/file23518/issue13218-true.diff

___
Python tracker 

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



[issue13218] test_ssl failures on Debian/Ubuntu

2011-10-25 Thread Barry A. Warsaw

Barry A. Warsaw  added the comment:

I'm not sure I particularly like this patch, and I can't test it on anything 
other than Debian/Ubuntu right now, but it does "fix" the test (defined as: 
making it pass :).

AFAICT, there's no way to tell openssl to revert back to trying SSLv2 client 
hello when the library has been compiled with no-ssl, but still setting 
OP_NO_SSLv2 or OP_NO_TLSv1 kind of seems like keeping a couple of tests that 
can't possibly succeed (because neither v2 nor v3, nor tlsv1 will be tried).

The other thing is that testing the flags on the client context doesn't seem to 
work:


Python 3.2.2+ (3.2:03ef6108beae, Oct 25 2011, 10:57:32) 
[GCC 4.6.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import ssl
>>> cc = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
>>> cc.options & ssl.OP_NO_SSLv2
0

Now, the other way to go is to set OP_NO_SSLv2 on both tests and change the 
sense of it from False to True, so that we'd always expect the connection to 
succeed.  I'll attach that patch next, and it does seem a bit more sane.  Let 
me know what you think.

--
Added file: http://bugs.python.org/file23517/issue13218.diff

___
Python tracker 

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



[issue10197] subprocess.getoutput fails on win32

2011-10-25 Thread Éric Araujo

Éric Araujo  added the comment:

> IMO, both should be deprecated:
> - they're not cross-platform
Isn’t the purpose of this report to fix that? :)

> - they invoke the shell implicitly, which subprocess promises never to do
One could argue that it’s not implicit if it’s documented.  Nonetheless, I 
agree that they don’t fit well with the subprocess promises.

So, +1 on deprecating and +1 on new, safer helpers.

--

___
Python tracker 

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



[issue12394] packaging: generate scripts from callable (dotted paths)

2011-10-25 Thread Éric Araujo

Éric Araujo  added the comment:

> What about Windows support?
Just like with distutils: the file extension is used, not the shebang.

--

___
Python tracker 

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



[issue13244] WebSocket schemes in urllib.parse

2011-10-25 Thread Éric Araujo

Éric Araujo  added the comment:

> # must always be escaped, both in path and query components.

Agreed.  This just follows from the Generic URI Syntax RFC, it’s not specific 
to WebSockets.

> And further: urlparse should raise an exception upon unescaped # within URLs
> from ws/wss schemes.

I’d say that urlparse should raise an exception when a ws/wss URI contains a 
fragment part.  I’m not sure this will be possible; from a glance at the source 
and a quick test, urlparse will happily break the Generic URI Syntax RFC and 
return a path including a # character!

--
title: WebSocket schemes in urlparse -> WebSocket schemes in urllib.parse

___
Python tracker 

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



[issue13240] sysconfig gives misleading results for USE_COMPUTED_GOTOS

2011-10-25 Thread Éric Araujo

Éric Araujo  added the comment:

> If we truly want to enable this by default, then the defaulting should be 
> moved to
> configure.  This will give a more accurate portrayal in sysconfig.
This sounds good.  (I know little about configure/pyconfig.h, but making 
sysconfig more accurate is a valuable result.)

> P.S. We could probably get rid of the HAVE macro all together by doing
> all the work in the 'configure' script.
Would that be a breach of backward compatibility for sysconfig?

--

___
Python tracker 

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



[issue13234] os.listdir breaks with literal paths

2011-10-25 Thread Santoso Wijaya

Santoso Wijaya  added the comment:

Even if we decide not to convert any forward slash, listdir() adds u"\\*.*" 
when the input is unicode, but it adds "/*.*" when it is not, before passing it 
off to Windows API. Hence the inconsistency and the problem Manuel saw.

IMO, his patch shouldn't have differentiated if the path starts with r"\\?\" 
and just be consistent with adding "\\*.*", unicode or not.

--

___
Python tracker 

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



[issue9750] sqlite3 iterdump fails on column with reserved name

2011-10-25 Thread Éric Araujo

Éric Araujo  added the comment:

Hi Lucas.  Have you read my previous message?  The patch needs to be updated.  
Would you like to do it?

--
versions: +Python 3.3 -Python 3.1

___
Python tracker 

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



[issue13260] distutils and cross-compiling the extensions

2011-10-25 Thread Éric Araujo

Éric Araujo  added the comment:

Hi Alexander,

Thanks for your interest in improving Python.  I’m forced to reject your 
request because

- Python 2.7 does not get new features (and support for cross-compilation would 
be one).

- distutils does not get new features (we had to freeze it because improvements 
broke many setup scripts depending on undocumented behavior or working around 
bugs).

- This request has been made many times already: 
http://mail.python.org/pipermail/python-dev/2011-March/110099.html

To get cross-compilation, here’s one would have to do:

- Work on distutils2, the replacement for distutils and setuptools (it’s 
included in Python 3.3 under the “packaging” name).

- Define exactly what is supported (cross-compiling from any platform to any 
platform for example), possibly by reviewing all other bug reports about and 
hashing things out on the distutils-sig mailing list.

- Think about getting buildbots running to make sure we don’t get regressions.

--
assignee: tarek -> eric.araujo
resolution:  -> rejected
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



[issue12618] py_compile cannot create files in current directory

2011-10-25 Thread Éric Araujo

Éric Araujo  added the comment:

I can reproduce in 3.2 and 3.3.  I’ll commit a test and patch when I get the 
time, or another dev can take this over.

--

___
Python tracker 

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



[issue13258] replace hasattr(obj, '__call__') with callable(obj)

2011-10-25 Thread Éric Araujo

Éric Araujo  added the comment:

This change is fine for packaging.  In the 2.x backport I already use callable 
(and damn the py3k warning) and  the 3.x backport uses the incorrect 
hasattr(inst, '__call__'); I’ll change that to use a backported 
d2.compat.callable.

--

___
Python tracker 

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



[issue8036] Interpreter crashes on invalid arg to spawnl on Windows

2011-10-25 Thread Ezio Melotti

Ezio Melotti  added the comment:

Now we are using Mercurial, and what was called 'py3k' on SVN is now 'default'. 
 Since we now commit on older branches first and then merge with the most 
recent ones, the patch should either be against 3.2 or 2.7.
You can check the devguide for more informations.

--
nosy: +ezio.melotti

___
Python tracker 

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



[issue8036] Interpreter crashes on invalid arg to spawnl on Windows

2011-10-25 Thread Vetoshkin Nikita

Vetoshkin Nikita  added the comment:

against py3k branch?

--

___
Python tracker 

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



[issue13220] print function unable while multiprocessing.Process is being run

2011-10-25 Thread ben

ben  added the comment:

Thanks Terry,

That does solve the problem, so the bug is really with IDLE (I got a previous 
Issue (12967) reported which also was connected to the stdout).

I changed the component to IDLE as the lib. is working as it should do.

--
components: +IDLE -Library (Lib)

___
Python tracker 

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



[issue13264] Monkeypatching using metaclass

2011-10-25 Thread Ezio Melotti

Changes by Ezio Melotti :


--
nosy: +ezio.melotti

___
Python tracker 

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



[issue13238] Add shell command helpers to shutil module

2011-10-25 Thread Nick Coghlan

Nick Coghlan  added the comment:

After a bit of thought, I realised I could use the string.Formatter API to 
implement a custom formatter for the shell command helpers that auto-escapes 
whitespace while leaving the other shell metacharacters alone (so you can still 
interpolate paths containing wildcards, etc).

People that want to bypass the autoescaping of whitespace can do the 
interpolation prior to the shell call, those that also want to escape shell 
metacharacters can use shlex.quote explicitly.

Diff can be seen here:
https://bitbucket.org/ncoghlan/cpython_sandbox/changeset/f19accc9a91b

--
hgrepos: +85

___
Python tracker 

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



[issue13264] Monkeypatching using metaclass

2011-10-25 Thread Artem Tomilov

New submission from Artem Tomilov :

from abc import ABCMeta

class Meta(ABCMeta):
def __instancecheck__(cls, instance):
# monkeypatching class method
cls.__subclasscheck__ = super(Meta, cls).__subclasscheck__
return super(Meta, cls).__instancecheck__(instance)

def __subclasscheck__(cls, sub):
return cls in sub.mro()

class A(object):
__metaclass__ = Meta

class B(object): pass

# registering class 'B' as a virtual subclass of 'A'
A.register(B)

>>> issubclass(B, A)
False
>>> isinstance(B(), A) # => method __subclasscheck__ is now monkeypatched
True
>>> issubclass(B, A) # => desire to get 'True' because 'B' is a virtual subclass
False

--
components: None
messages: 146366
nosy: Artem.Tomilov
priority: normal
severity: normal
status: open
title: Monkeypatching using metaclass
type: behavior
versions: Python 2.7

___
Python tracker 

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



[issue13263] Group some os functions in submodules

2011-10-25 Thread Ross Lagerwall

Changes by Ross Lagerwall :


--
nosy: +rosslagerwall

___
Python tracker 

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



[issue13256] Document and test new socket options

2011-10-25 Thread STINNER Victor

Changes by STINNER Victor :


--
keywords: +patch
Added file: http://bugs.python.org/file23516/socket_options_doc.patch

___
Python tracker 

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



[issue13263] Group some os functions in submodules

2011-10-25 Thread Petri Lehtinen

Changes by Petri Lehtinen :


--
nosy: +petri.lehtinen

___
Python tracker 

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



[issue13263] Group some os functions in submodules

2011-10-25 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +haypo

___
Python tracker 

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



[issue13238] Add shell command helpers to shutil module

2011-10-25 Thread Nick Coghlan

Nick Coghlan  added the comment:

I discovered a couple of APIs that were moved from the commands module to the 
subprocess module in 3.0:
http://docs.python.org/dev/library/subprocess#subprocess.getstatusoutput

However, they have issues, especially on Windows: 
http://bugs.python.org/issue10197

So part of this patch would include deprecating those two interfaces in favour 
of the new shutil ones - the existing APIs break the subprocess promise of 
never invoking the shell implicitly.

--

___
Python tracker 

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



[issue10197] subprocess.getoutput fails on win32

2011-10-25 Thread Nick Coghlan

Nick Coghlan  added the comment:

Without knowing this issue existed, I recently started working on adding some 
convenience APIs for shell invocation to shutil: 
http://bugs.python.org/issue13238

I think the getstatus and getstatusoutput APIs were copied from the commands 
module in 3.0 without sufficient thought being given to whether or not they fit 
with the design principles of the subprocess module. IMO, both should be 
deprecated:
   - they're not cross-platform
   - they invoke the shell implicitly, which subprocess promises never to do

--
nosy: +ncoghlan

___
Python tracker 

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



[issue13263] Group some os functions in submodules

2011-10-25 Thread Ezio Melotti

New submission from Ezio Melotti :

In Python 3.3 the os module gained a few new functions and constants:

Python 3.2.2+ (3.2:58a75eeb5c8e, Sep 29 2011, 02:11:05) 
>>> import os; len(dir(os))
232

Python 3.3.0a0 (default:a50f080c22ca+, Oct 25 2011, 09:56:01) 
>>> import os; len(dir(os))
332

http://docs.python.org/dev/py3k/whatsnew/3.3.html#os lists some of these 
additions, and they are already grouped (e.g. the sched_* functions, the "at" 
functions, ...).

Before the os API gets even more bloated, maybe we should group some of these 
functions in new submodules, like os.sched.*.

--
components: Extension Modules
messages: 146363
nosy: benjamin.peterson, ezio.melotti, georg.brandl, loewis, pitrou, rhettinger
priority: normal
severity: normal
stage: needs patch
status: open
title: Group some os functions in submodules
type: feature request
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



[issue9750] sqlite3 iterdump fails on column with reserved name

2011-10-25 Thread Lucas Sinclair

Lucas Sinclair  added the comment:

I just encountered this issue today.

So, it's been several months, will the patch be merged into the master branch ? 
Or will this never be fixed ?

--
nosy: +xapple

___
Python tracker 

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



[issue13256] Document and test new socket options

2011-10-25 Thread STINNER Victor

STINNER Victor  added the comment:

For #12619, I added socket.SO_BINDTODEVICE constant.

--

___
Python tracker 

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



[issue12619] Automatically regenerate platform-specific modules

2011-10-25 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 6159311f0f44 by Victor Stinner in branch 'default':
Issue #12619: Expose socket.SO_BINDTODEVICE constant
http://hg.python.org/cpython/rev/6159311f0f44

--

___
Python tracker 

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



[issue13226] Expose RTLD_* constants in the posix module

2011-10-25 Thread STINNER Victor

Changes by STINNER Victor :


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



[issue13226] Expose RTLD_* constants in the posix module

2011-10-25 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset c75427c0da06 by Victor Stinner in branch 'default':
Issue #13226: Add RTLD_xxx constants to the os module. These constants can by
http://hg.python.org/cpython/rev/c75427c0da06

--
nosy: +python-dev

___
Python tracker 

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



[issue13218] test_ssl failures on Debian/Ubuntu

2011-10-25 Thread Barry A. Warsaw

Barry A. Warsaw  added the comment:

On Oct 25, 2011, at 09:56 AM, Antoine Pitrou wrote:

>
>Antoine Pitrou  added the comment:
>
>> It looks like it's been this way for a long time too.
>
>But tests have always passed here using OpenSSL 1.0.0.

Right, sorry, what I meant was this particular behavior (switching to SSLv3
client hello when SSLv2 is disabled) appears to have been in upstream openssl
since about 2005.  What's changed recently is that instead of patching openssl
to disable SSLv2 (and thereby not triggering the client hello switch), Debian
has started to use the no-ssl Configure option, which is what probably started
allowing this test to unexpectedly succeed.

>> It's probably too difficult, and not really Python's responsibility,
>> to determine whether SSL_OP_NO_SSLv2 is set.
>
>See http://docs.python.org/dev/library/ssl.html#ssl.SSLContext.options

Interesting, thanks for the pointer.

>> Rather, I think the test is simply bogus and should be disabled or
>> removed.
>
>I think it would be good to keep a simplified/minimal (and, of course,
>working :-)) version of these tests.
>Patches welcome, anyway. I can't really test with Debian's OpenSSL.

I'll work up a patch.

-Barry

--

___
Python tracker 

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



[issue10278] add time.wallclock() method

2011-10-25 Thread STINNER Victor

STINNER Victor  added the comment:

I closed maybe this issue too quickly. My commit doesn't solve the initial 
issue: Python doesn't provide a portable "wallclock" function.

wallclock.patch should be updated to use:

 - time.clock() on Windows (use QueryPerformanceCounter)
 - or time.clock_gettime(CLOCK_MONOTONIC_RAW) if available
 - or time.clock_gettime(CLOCK_MONOTONIC) if available
 - or time.time() (which is usually gettimeofday())

Pseudo-code:

wallclock = None
if hasattr(time, 'clock_gettime') and hasattr(time, 'CLOCK_MONOTONIC_RAW'):
  # I understood that CLOCK_MONOTONIC_RAW is more reliable
  # than CLOCK_MONOTONIC, because CLOCK_MONOTONIC may be adjusted
  # by NTP. I don't know if it's correct.
  def wallclock():
return time.clock_gettime(CLOCK_MONOTONIC_RAW)

elif hasattr(time, 'clock_gettime') and hasattr(time, 'CLOCK_MONOTONIC'):
  def wallclock():
return time.clock_gettime(CLOCK_MONOTONIC)

elif os.name == 'nt':
  # define a new function to be able to set its docstring
  def wallclock():
return time.clock()

else:
  def wallclock():
 return time.time()
if wallclock is not None:
   wallclock.__doc__ = 'monotonic time'
else:
   del wallclock

wallclock() doc should also explain that time.time() may be adjusted by NTP or 
manually by the administrator.

--

By the way, it would be nice to expose the precision of time.clock(): it's 
1/divisor or 1/CLOCKS_PER_SEC on Windows, 1/CLOCKS_PER_SEC on UNIX.

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

___
Python tracker 

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



[issue10278] add time.wallclock() method

2011-10-25 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 35e4b7c4bafa by Victor Stinner in branch 'default':
Close #10278: Add clock_getres(), clock_gettime() and CLOCK_xxx constants to
http://hg.python.org/cpython/rev/35e4b7c4bafa

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



[issue13262] IDLE opens partially hidden

2011-10-25 Thread Aivar Annamaa

New submission from Aivar Annamaa :

When IDLE opens in Windows 7, its bottom edge will be hidden behind taskbar. It 
should position itself so that it's fully visible.

--
components: IDLE
messages: 146354
nosy: Aivar.Annamaa
priority: normal
severity: normal
status: open
title: IDLE opens partially hidden
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



[issue13234] os.listdir breaks with literal paths

2011-10-25 Thread Manuel de la Pena

Manuel de la Pena  added the comment:

In case of my patch (I don't know about santa4nt case) I did not use 
shutil.remove because it was not used in the other tests and I wanted to be 
consistent and not add a new import. Certainly if there is not an issue with 
that we should use it.

--

___
Python tracker 

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



[issue13218] test_ssl failures on Debian/Ubuntu

2011-10-25 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> It looks like it's been this way for a long time too.

But tests have always passed here using OpenSSL 1.0.0.

> It's probably too difficult, and not really Python's responsibility,
> to determine whether SSL_OP_NO_SSLv2 is set.

See http://docs.python.org/dev/library/ssl.html#ssl.SSLContext.options

> Rather, I think the test is simply bogus and should be disabled or
> removed.

I think it would be good to keep a simplified/minimal (and, of course,
working :-)) version of these tests.
Patches welcome, anyway. I can't really test with Debian's OpenSSL.

--

___
Python tracker 

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



[issue10278] add time.wallclock() method

2011-10-25 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

CLOCK_MONOTONIC, CLOCK_PROCESS_CPUTIME_ID and CLOCK_THREAD_CPUTIME_ID are 
optional according to POSIX, which only mandates CLOCK_REALTIME. You should 
mention it in the docs.

You might also want to export clock_getres():
http://pubs.opengroup.org/onlinepubs/9699919799/functions/clock_getres.html

--

___
Python tracker 

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



[issue13234] os.listdir breaks with literal paths

2011-10-25 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Thanks for the patch. Is there a reason you don't use shutil.rmtree in 
tearDown()?
I don't know if it's our business to convert forward slashes passed by the 
user. Also, general support for extended paths is another can of worms ;)

--

___
Python tracker 

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



[issue10278] add time.wallclock() method

2011-10-25 Thread STINNER Victor

STINNER Victor  added the comment:

The issue #13261 has been marked as a duplicate of this issue. Copy of 
msg146347:
-
time.clock () has very poor time resolution on Linux (tested on Ubuntu 11.04).

The result of call to clock () changes once per several seconds. On the other 
side, on Windows it provides very good resolution.

Here is a doctest that fails on Linux:
"""
 >>> from time import sleep
 >>> prev = clock ()
 >>> res = True
 >>> for i in xrange(10):
 ... sleep(0.15)
 ... next = clock ()
 ... res = res and (next - prev) > 0.1
 ... prev = next
 >>> print res
 True
"""

Currently on Linux I am using a workaround that is attached to the issue.
-

The issue has also a script:
http://bugs.python.org/file23515/monotime_unix.py

--

___
Python tracker 

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



[issue13261] time.clock () has very low resolution on Linux

2011-10-25 Thread STINNER Victor

STINNER Victor  added the comment:

This issue is a duplicate of the issue #10278.

--
nosy: +haypo
resolution:  -> duplicate
status: open -> closed

___
Python tracker 

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



[issue13261] time.clock () has very low resolution on Linux

2011-10-25 Thread Elijah Merkin

New submission from Elijah Merkin :

time.clock () has very poor time resolution on Linux (tested on Ubuntu 11.04).

The result of call to clock () changes once per several seconds. On the other 
side, on Windows it provides very good resolution.

Here is a doctest that fails on Linux:
"""
 >>> from time import sleep
 >>> prev = clock ()
 >>> res = True
 >>> for i in xrange(10):
 ... sleep(0.15)
 ... next = clock ()
 ... res = res and (next - prev) > 0.1
 ... prev = next
 >>> print res
 True
"""

Currently on Linux I am using a workaround that is attached to the issue.

--
components: None
files: monotime_unix.py
messages: 146347
nosy: ellioh
priority: normal
severity: normal
status: open
title: time.clock () has very low resolution on Linux
type: behavior
versions: Python 2.6, Python 2.7
Added file: http://bugs.python.org/file23515/monotime_unix.py

___
Python tracker 

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



[issue13234] os.listdir breaks with literal paths

2011-10-25 Thread Manuel de la Pena

Manuel de la Pena  added the comment:

Indeed, in our code we had to write a number of wrappers around the os calls to 
be able to work with long path on Windows. At the moment working with long 
paths on windows and python is broken in a number of places and is a PITA to 
work with.

--

___
Python tracker 

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



[issue13238] Add shell command helpers to shutil module

2011-10-25 Thread Nick Coghlan

Nick Coghlan  added the comment:

Considering this further, I've realised that the idea of implicit quoting for 
this style of helper function is misguided on another level - the parameters to 
be interpolated may not even be strings yet, so attempting to quote them would 
fail:

>>> subprocess.call("exit {}".format(1), shell=True)
1
>>> shlex.quote(1)
Traceback (most recent call last):
  File "", line 1, in 
  File "/home/ncoghlan/devel/py3k/Lib/shlex.py", line 285, in quote
if _find_unsafe(s) is None:
TypeError: expected string or buffer

I'll note that none of these problems will be unique to the new convenience API 
- they're all a general reflection of the impedance mismatch between typical 
shell interfaces and filenames that can contain spaces.

--

___
Python tracker 

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