[Python-Dev] Proposal: new environment variable PYTHONSTDOUTENCODING

2008-05-20 Thread Martin v. Löwis
I'd like to propose a new environment variable PYTHONSTDOUTENCODING. This is meant to solve various problems that people had with Python not detecting their terminal encoding correctly; it would override any detection that Python would use for determining the encoding of stdout (and stdin - but tha

Re: [Python-Dev] Proposal: new environment variable PYTHONSTDOUTENCODING

2008-05-20 Thread M.-A. Lemburg
On 2008-05-20 10:22, Martin v. Löwis wrote: I'd like to propose a new environment variable PYTHONSTDOUTENCODING. This is meant to solve various problems that people had with Python not detecting their terminal encoding correctly; it would override any detection that Python would use for determini

Re: [Python-Dev] Proposal: new environment variable PYTHONSTDOUTENCODING

2008-05-20 Thread Thomas Wouters
On Tue, May 20, 2008 at 10:41 AM, M.-A. Lemburg <[EMAIL PROTECTED]> wrote: > On 2008-05-20 10:22, Martin v. Löwis wrote: > >> I'd like to propose a new environment variable PYTHONSTDOUTENCODING. >> This is meant to solve various problems that people had with Python >> not detecting their terminal

Re: [Python-Dev] Proposal: new environment variable PYTHONSTDOUTENCODING

2008-05-20 Thread Lennart Regebro
On Tue, May 20, 2008 at 12:16 PM, Thomas Wouters <[EMAIL PROTECTED]> wrote: > You're forgetting about print; in Python 2.x, when stdout is connected to a > terminal, the locale settings (typically the LANG, LC_ALL and LC_CTYPE > environment variables) are taken into account when 'print' writes to >

Re: [Python-Dev] Proposal: new environment variable PYTHONSTDOUTENCODING

2008-05-20 Thread Oleg Broytmann
On Tue, May 20, 2008 at 10:22:37AM +0200, "Martin v. L?wis" wrote: > I'd like to propose a new environment variable PYTHONSTDOUTENCODING. > This is meant to solve various problems that people had with Python > not detecting their terminal encoding correctly; it would override > any detection that P

Re: [Python-Dev] Proposal: new environment variable PYTHONSTDOUTENCODING

2008-05-20 Thread M.-A. Lemburg
On 2008-05-20 12:16, Thomas Wouters wrote: On Tue, May 20, 2008 at 10:41 AM, M.-A. Lemburg <[EMAIL PROTECTED]> wrote: On 2008-05-20 10:22, Martin v. Löwis wrote: I'd like to propose a new environment variable PYTHONSTDOUTENCODING. This is meant to solve various problems that people had with P

Re: [Python-Dev] Proposal: new environment variable PYTHONSTDOUTENCODING

2008-05-20 Thread Tarek Ziadé
On Tue, May 20, 2008 at 12:48 PM, Oleg Broytmann <[EMAIL PROTECTED]> wrote: > On Tue, May 20, 2008 at 10:22:37AM +0200, "Martin v. L?wis" wrote: > > I'd like to propose a new environment variable PYTHONSTDOUTENCODING. > > This is meant to solve various problems that people had with Python > > not

Re: [Python-Dev] Addition of "pyprocessing" module to standard lib.

2008-05-20 Thread A.M. Kuchling
On Mon, May 19, 2008 at 06:13:11PM -0700, Bill Janssen wrote: > And these are all SYSV derivatives, aren't they? So perhaps it's some > common fix for all three? This reminds of a Tim-ism: == > Just for the record, on AIX, the following C program: Oh no you don't! I followed AIX

Re: [Python-Dev] Addition of "pyprocessing" module to standard lib.

2008-05-20 Thread Nick Coghlan
Bill Janssen wrote: And these are all SYSV derivatives, aren't they? So perhaps it's some common fix for all three? I've never personally had the pleasure(?!) of having to get stuff working on all of AIX/HP-UX/Tru64/Solaris, but what little dealings I've had with people who have suggests tha

Re: [Python-Dev] Addition of "pyprocessing" module to standard lib.

2008-05-20 Thread Charles Cazabon
A.M. Kuchling <[EMAIL PROTECTED]> wrote: > On Mon, May 19, 2008 at 08:50:39PM +0200, Thomas Heller wrote: > > Myself I would rather spend my energy to make ctypes more portable, within > > my > > skills and the platforms I have access to. > > Someone could run Solaris x86 inside a hosted virtual

Re: [Python-Dev] Addition of "pyprocessing" module to standard lib.

2008-05-20 Thread Thomas Heller
Charles Cazabon schrieb: > A.M. Kuchling <[EMAIL PROTECTED]> wrote: >> On Mon, May 19, 2008 at 08:50:39PM +0200, Thomas Heller wrote: >> > Myself I would rather spend my energy to make ctypes more portable, within >> > my >> > skills and the platforms I have access to. >> >> Someone could run Sol

[Python-Dev] Issue 643841: Including a new-style proxy base class in 2.6/3.0

2008-05-20 Thread Nick Coghlan
One of the tasks where classic classes are currently far superior to new-style classes is in writing proxy classes like weakref.proxy - cases where nearly all operations need to be delegated to some other object, with only a few being handled via the proxy type object itself. With classic clas

Re: [Python-Dev] Issue 643841: Including a new-style proxy base class in 2.6/3.0

2008-05-20 Thread Michael Foord
Nick Coghlan wrote: One of the tasks where classic classes are currently far superior to new-style classes is in writing proxy classes like weakref.proxy - cases where nearly all operations need to be delegated to some other object, with only a few being handled via the proxy type object itself

Re: [Python-Dev] Addition of "pyprocessing" module to standard lib.

2008-05-20 Thread Ted Leung
On May 19, 2008, at 7:47 PM, Steve Holden wrote: OK, I know people in Sun and possibly H-P I could ask, and I may have an arm or two to twist to get to IBM. But worst-case, what budget would the infrastructure committee need for the hardware and (more importantly) if the hardware material

Re: [Python-Dev] Addition of "pyprocessing" module to standard lib.

2008-05-20 Thread Leif Walsh
On Mon, 19 May 2008, Bill Janssen wrote: > > On Mon, May 19, 2008 at 5:15 PM, Bill Janssen <[EMAIL PROTECTED]> wrote: > > >> If you can run a pure Python module > > >> that does not depend on any C extension, then that platform has the > > >> support needed to run Python. > > > > > > This is certai

Re: [Python-Dev] Proposal: new environment variable PYTHONSTDOUTENCODING

2008-05-20 Thread Martin v. Löwis
> Writing Unicode to stdout will still use the default encoding > ASCII to convert it to an 8-bit string. That's not true. Regards, Martin ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe:

Re: [Python-Dev] Proposal: new environment variable PYTHONSTDOUTENCODING

2008-05-20 Thread Martin v. Löwis
>> You're forgetting about print; in Python 2.x, when stdout is connected to a >> terminal, the locale settings (typically the LANG, LC_ALL and LC_CTYPE >> environment variables) are taken into account when 'print' writes to >> sys.stdout. > > Isn't it then enough to make sure your locale setting

Re: [Python-Dev] Addition of "pyprocessing" module to standard lib.

2008-05-20 Thread Bill Janssen
Steve Holden wrote: > The more libraries that use ctypes to call into native functionality, > the more important it becomes to have ctypes run, even if only to > implement platform-specific functionality on the given platforms. I > would like "being able to call a wide range of native libraries"

Re: [Python-Dev] Proposal: new environment variable PYTHONSTDOUTENCODING

2008-05-20 Thread Martin v. Löwis
> PYTHONSTDOUTENCODING could then provide the default to > sys.stdout.encoding. Right - that's the proposal. Regards, Martin ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.

[Python-Dev] Possible bug in re module?

2008-05-20 Thread Dmitry Vasiliev
I've just found a strange re behavior: >>> import re >>> re.sub("(?:ab|b|a)", "+", "cbacbabcabc") 'c++c++c+c' >>> re.sub("(?:ab|b|a){2}", "+", "cbacbabcabc") 'c+c+c+c' In the last case |-separated expressions seems don't tried from left to right. Is it bug or just me? -- Dmitry Vasiliev http

Re: [Python-Dev] Proposal: new environment variable PYTHONSTDOUTENCODING

2008-05-20 Thread M.-A. Lemburg
On 2008-05-20 20:23, Martin v. Löwis wrote: Writing Unicode to stdout will still use the default encoding ASCII to convert it to an 8-bit string. That's not true. Are you sure ? > setenv LC_ALL de_DE.utf8 > python2.5 Python 2.5 (r25:51908, May 9 2007, 00:53:06) >>> u = u'äöü' >>> sys.stdout

Re: [Python-Dev] Proposal: new environment variable PYTHONSTDOUTENCODING

2008-05-20 Thread Martin v. Löwis
> I'm not exactly sure why, since using .encoding would be useful > in all cases. Right, I think it should use the file's encoding also for .write. Regards, Martin ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo

Re: [Python-Dev] Possible bug in re module?

2008-05-20 Thread Leif Walsh
On Tue, 20 May 2008, Dmitry Vasiliev wrote: > I've just found a strange re behavior: > > >>> import re > >>> re.sub("(?:ab|b|a)", "+", "cbacbabcabc") > 'c++c++c+c' > >>> re.sub("(?:ab|b|a){2}", "+", "cbacbabcabc") > 'c+c+c+c' > > In the last case |-separated expressions seems don't tried from left

Re: [Python-Dev] Addition of "pyprocessing" module to standard lib.

2008-05-20 Thread Bill Janssen
> Bill Janssen schrieb: > >> Hmm, perhaps the ctypes documentation could use a more prominent warning > >> that it may not be available on some Unix platforms (HP-UX, AIX, IRIX), > >> and that it may require the use of GCC rather than the vendor compiler > >> on others (Solaris). > >> > >> At t

Re: [Python-Dev] Possible bug in re module?

2008-05-20 Thread André Malo
* Dmitry Vasiliev wrote: > I've just found a strange re behavior: > >>> import re > >>> re.sub("(?:ab|b|a)", "+", "cbacbabcabc") > > 'c++c++c+c' > > >>> re.sub("(?:ab|b|a){2}", "+", "cbacbabcabc") > > 'c+c+c+c' > > In the last case |-separated expressions seems don't tried from left to > right.

Re: [Python-Dev] Proposal: new environment variable PYTHONSTDOUTENCODING

2008-05-20 Thread M.-A. Lemburg
On 2008-05-20 21:34, Martin v. Löwis wrote: I'm not exactly sure why, since using .encoding would be useful in all cases. Right, I think it should use the file's encoding also for .write. Could you add that to the proposal ?! Please also add the ability to set the .encoding on file objects.

Re: [Python-Dev] Proposal: new environment variable PYTHONSTDOUTENCODING

2008-05-20 Thread Martin v. Löwis
>Is it to override locale settings in case the user wants a different > encoding? for such cases as redirected stdout, or windows console (which > has an "OEM" encoding that differs from the locale encoding)? On Windows, the setlocale mechanism isn't used at all, since it doesn't support nl_la

Re: [Python-Dev] Proposal: new environment variable PYTHONSTDOUTENCODING

2008-05-20 Thread Martin v. Löwis
> What about PYTHONLANG ? > > or something that tries to reflect which environment variables are used > for this ? > > (LC_CTYPE -> PYTHONCTYPE ? if the code uses just LC_CTYPE) It's not meant to name a locale, but an encoding. In fact, that the encoding is tied to the locale is IMO a misconcep

Re: [Python-Dev] Addition of "pyprocessing" module to standard lib.

2008-05-20 Thread Christian Heimes
r.m.oudkerk schrieb: > Now that socket.fromfd() and socket._dup() is available on Windows in > 2.6 and 3.0 (after a patch from me) some of the code could be removed. > I would also like to see recvfd() and sendfd() get added to the socket > module -- these functions allow the transfer of file descr

Re: [Python-Dev] Proposal: new environment variable PYTHONSTDOUTENCODING

2008-05-20 Thread Oleg Broytmann
On Tue, May 20, 2008 at 10:22:03PM +0200, "Martin v. L?wis" wrote: > >PYTHONIOENCODING? > > Unprecise in a different way (as it is meant to apply only to stdout, > not to all IO), but shorter. I don't think you can make it both precise and short. If you want to be precise and have both PYT

Re: [Python-Dev] Addition of "pyprocessing" module to standard lib.

2008-05-20 Thread Nick Coghlan
Ted Leung wrote: On May 19, 2008, at 7:47 PM, Steve Holden wrote: OK, I know people in Sun and possibly H-P I could ask, and I may have an arm or two to twist to get to IBM. But worst-case, what budget would the infrastructure committee need for the hardware and (more importantly) if the ha

[Python-Dev] disappearing exceptions

2008-05-20 Thread Benjamin Peterson
In several places in the C code, there are instances where all exceptions can be completely ignored (akin to a bare except statement.) after a PyObject_GetAttr call. A week ago, I fixed one of these in hasattr (issue 2196) by propagating exceptions that don't inherit Exception (SystemExit, Keyboar

Re: [Python-Dev] Addition of "pyprocessing" module to standard lib.

2008-05-20 Thread Ted Leung
On May 20, 2008, at 2:03 PM, Nick Coghlan wrote: We actually have a couple of Solaris buildbots already - as I understand it, the issue there isn't Solaris as such, it's being able to use the Sun compiler instead of GCC to compile ctypes/libffi. Does that mean that we need access to the S

Re: [Python-Dev] disappearing exceptions

2008-05-20 Thread Christian Heimes
Benjamin Peterson schrieb: > In several places in the C code, there are instances where all > exceptions can be completely ignored (akin to a bare except > statement.) after a PyObject_GetAttr call. > > A week ago, I fixed one of these in hasattr (issue 2196) by > propagating exceptions that don't

Re: [Python-Dev] Addition of "pyprocessing" module to standard lib.

2008-05-20 Thread Steve Holden
Ted Leung wrote: On May 20, 2008, at 2:03 PM, Nick Coghlan wrote: We actually have a couple of Solaris buildbots already - as I understand it, the issue there isn't Solaris as such, it's being able to use the Sun compiler instead of GCC to compile ctypes/libffi. Does that mean that we need

Re: [Python-Dev] disappearing exceptions

2008-05-20 Thread Benjamin Peterson
On Tue, May 20, 2008 at 5:38 PM, Christian Heimes <[EMAIL PROTECTED]> wrote: > Thankfully this issue was fixed in Python 2.6 and 3.0. In newer versions > of Python hasattr() only swallows exception based on the Exception class > but not BaseExceptions. We should make sure all code in the core behav

Re: [Python-Dev] Addition of "pyprocessing" module to standard lib.

2008-05-20 Thread Bill Janssen
> > Does that mean that we need access to the Sun compiler or that the Sun > > compiler has bugs which prevent ctypes from compiling? > > > I don't think anyone's mentioned Solaris in this context, but there are > claims that libffi "doesn't build" for AIX and HP-UX. I think there was also an i

Re: [Python-Dev] disappearing exceptions

2008-05-20 Thread Christian Heimes
Benjamin Peterson schrieb: > Speaking of the C-API, I was thinking of introducing a new function > called PyObject_SafeHasAttr that functions just like PyObject_HasAttr > except it can fail. How do you define "fail" in this context? Christian ___ Python

Re: [Python-Dev] disappearing exceptions

2008-05-20 Thread Benjamin Peterson
On Tue, May 20, 2008 at 6:44 PM, Christian Heimes <[EMAIL PROTECTED]> wrote: > Benjamin Peterson schrieb: >> Speaking of the C-API, I was thinking of introducing a new function >> called PyObject_SafeHasAttr that functions just like PyObject_HasAttr >> except it can fail. > > How do you define "fai

Re: [Python-Dev] Issue 643841: Including a new-style proxy base class in 2.6/3.0

2008-05-20 Thread Greg Ewing
Nick Coghlan wrote: So what do people think of including a ProxyBase implementation in 2.6 and 3.0 that explicitly delegates all of the C-level slots to a designated target instance? Sounds good to me. -- Greg ___ Python-Dev mailing list Python-Dev@

Re: [Python-Dev] Addition of "pyprocessing" module to standard lib.

2008-05-20 Thread Greg Ewing
Christian Heimes wrote: I assume recvfd and sendfd aren't syscalls but the proposed names for the functions. Yes, the functionality in question is accessed through the sendmsg() and recvmsg() system calls. -- Greg ___ Python-Dev mailing list Python-D

Re: [Python-Dev] disappearing exceptions

2008-05-20 Thread Greg Ewing
Christian Heimes wrote: Thankfully this issue was fixed in Python 2.6 and 3.0. In newer versions of Python hasattr() only swallows exception based on the Exception class but not BaseExceptions. Shouldn't it only be catching AttributeError, though? We should make sure all code in the core beha

Re: [Python-Dev] disappearing exceptions

2008-05-20 Thread Greg Ewing
I wrote: Shouldn't it only be catching AttributeError, though? Forget that, I forgot that PyObject_HasAttr can't signal an exception. The Py3 C API should be designed to fix this, I think. -- Greg ___ Python-Dev mailing list Python-Dev@python.org

Re: [Python-Dev] Issue 643841: Including a new-style proxy base class in 2.6/3.0

2008-05-20 Thread Fred Drake
Nick Coghlan wrote: So what do people think of including a ProxyBase implementation in 2.6 and 3.0 that explicitly delegates all of the C-level slots to a designated target instance? On May 20, 2008, at 7:55 PM, Greg Ewing wrote: Sounds good to me. Same here. There's an implementation i

Re: [Python-Dev] disappearing exceptions

2008-05-20 Thread Mark Hammond
Greg writes: > Christian Heimes wrote: > > Thankfully this issue was fixed in Python 2.6 and 3.0. In newer > > versions of Python hasattr() only swallows exception based on > > the Exception class but not BaseExceptions. > > Shouldn't it only be catching AttributeError, though? This has come up

Re: [Python-Dev] Addition of "pyprocessing" module to standard lib.

2008-05-20 Thread Martin v. Löwis
> I can neither find recvfd in my man pages nor in my header files in > /usr/include on Linux (Ubuntu 8.04 i686). I assume recvfd and sendfd > aren't syscalls but the proposed names for the functions. Yes (and no). The system call is sendmsg, with a cmsg_type of SCM_RIGHTS. I don't think there is

Re: [Python-Dev] Addition of "pyprocessing" module to standard lib.

2008-05-20 Thread Martin v. Löwis
>> We actually have a couple of Solaris buildbots already - as I >> understand it, the issue there isn't Solaris as such, it's being able >> to use the Sun compiler instead of GCC to compile ctypes/libffi. > > Does that mean that we need access to the Sun compiler or that the Sun > compiler has bu

Re: [Python-Dev] Addition of "pyprocessing" module to standard lib.

2008-05-20 Thread Thomas Heller
Martin v. Löwis schrieb: >>> We actually have a couple of Solaris buildbots already - as I >>> understand it, the issue there isn't Solaris as such, it's being able >>> to use the Sun compiler instead of GCC to compile ctypes/libffi. >> >> Does that mean that we need access to the Sun compiler or

Re: [Python-Dev] Addition of "pyprocessing" module to standard lib.

2008-05-20 Thread Martin v. Löwis
> Could it be a solution to build libffi with gcc, then configure Python > with '--with-system--ffi' and compile with the sun compiler, or would this > introduce the dependencies on libgcc or whatever again that Ulrich wanted > to avoid? It depends on the processor and the code, but chances are hi