[issue1452] subprocess's popen.stdout.seek(0) doesn't raise an error

2007-11-16 Thread Christian Heimes

New submission from Christian Heimes:

On Linux:

>>> p = subprocess.Popen("ls", stdout=subprocess.PIPE)
>>> p.stdout.read()
b'...'
>>> p.stdout.seek(0)
Traceback (most recent call last):
  File "", line 1, in 
  File "/home/heimes/dev/python/py3k/Lib/io.py", line 809, in seek
pos = self.raw.seek(pos, whence)
IOError: [Errno 29] Illegal seek
>>> p.stdout.read()
b''

On Windows p.stdout.seek(0) does neither raise an error nor works as one
might expect it. The second read() returns an empty byte string, too.

--
components: Windows
keywords: py3k
messages: 57585
nosy: tiran
severity: normal
status: open
title: subprocess's popen.stdout.seek(0) doesn't raise an error
versions: Python 3.0

__
Tracker <[EMAIL PROTECTED]>

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



[issue1373762] Tweak pprint.PrettyPrinter.format for subclassing

2007-11-16 Thread Kathy Van Stone

Kathy Van Stone added the comment:

I might be able to give a more compelling example (aside from the fact
wanting it to fit the documentation which implies that one can subclass
the pretty printer).  I had a structure containing mostly lists,
dictionary and primitives that I wanted to display, but it also
contained UUIDs. In order to be able to see what the UUID referred to, I
extended the pretty printer to lookup up the name associated with the
UUID and included that. I have it working now by keeping the width
narrow.  The patch listed here (moving the line length check inside
lists and dictionaries) doesn't entirely work as my altered
representation of a UUID is different enough from the original that the
calculation of line length is inaccurate.

--
nosy: +kathyvs

_
Tracker <[EMAIL PROTECTED]>

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



[issue1432] Strange behavior of urlparse.urljoin

2007-11-16 Thread yan

yan added the comment:

That sounds great, thanks a lot.

__
Tracker <[EMAIL PROTECTED]>

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



[issue1432] Strange behavior of urlparse.urljoin

2007-11-16 Thread Senthil

Senthil added the comment:

Yes, you are right.
test_urlparse also does not consider the scenarios wherein the relative url
+starts with a query like ?y.

This needs to be addressed. I shall code the patch to fix it.

__
Tracker <[EMAIL PROTECTED]>

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



[issue1259] string find and rfind methods give a TypeError that is misleading

2007-11-16 Thread Facundo Batista

Facundo Batista added the comment:

Moved the function to find.h, cleaned the whitespace issues and
documented the reference counting.

Commited in trunk, rev 59020.

Thanks everybody!

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

__
Tracker <[EMAIL PROTECTED]>

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



[issue1453] Python does not honor "CFLAGS" environment variable

2007-11-16 Thread Martin v. Löwis

Martin v. Löwis added the comment:

In all versions of make, "make CFLAGS=..." should work fine (although
that's not an environment variable).

--
nosy: +loewis

__
Tracker <[EMAIL PROTECTED]>

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



[issue1452] subprocess's popen.stdout.seek(0) doesn't raise an error

2007-11-16 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

Python 2.5 on Windows has the same behaviour, it does not fail.
In general, python does not try to hide this kind of differences.

--
nosy: +amaury.forgeotdarc

__
Tracker <[EMAIL PROTECTED]>

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



[issue1453] Python does not honor "CFLAGS" environment variable

2007-11-16 Thread Miki Tebeka

Miki Tebeka added the comment:

I'll try to be clearer:
`./configure --help` states (at the end):
Some influential environment variables:
  CC  C compiler command
  CFLAGS  C compiler flags
  LDFLAGS linker flags, e.g. -L if you have libraries  in a
  nonstandard directory 
  CPPFLAGSC/C++ preprocessor flags, e.g. -I if you have
  headers in a nonstandard directory 
  CPP C preprocessor

Use these variables to override the choices made by `configure' or
to help
it to find libraries and programs with nonstandard names/locations.

What I've tried to do is compile Python with gprof, adding the -pg flag.
So I ran `CFLAGS=-pg ./configure`, the resulting Makefile did not
contained the -pg in the CFLAGS (or OPT) variables.

Using `make CFLAGS=XXX` will override the CFLAGS definition in the
Makefile, I just want to add to it.

__
Tracker <[EMAIL PROTECTED]>

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



[issue1453] Python does not honor "CFLAGS" environment variable

2007-11-16 Thread Guido van Rossum

Guido van Rossum added the comment:

This depends on the version of Make used.  See the man page for Make.

--
nosy: +gvanrossum

__
Tracker <[EMAIL PROTECTED]>

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



[issue1453] Python does not honor "CFLAGS" environment variable

2007-11-16 Thread Miki Tebeka

New submission from Miki Tebeka:

Setting CFLAGS environment variable do not show up in the build process,
the gcc flags do not include the CFLAGS flags.

--
components: Build
messages: 57588
nosy: tebeka
severity: normal
status: open
title: Python does not honor "CFLAGS" environment variable
versions: Python 2.5

__
Tracker <[EMAIL PROTECTED]>

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



[issue1453] Python does not honor "CFLAGS" environment variable

2007-11-16 Thread Guido van Rossum

Guido van Rossum added the comment:

I think you misunderstand. Passing a variable to configure makes that
setting have effect *during the configure run*.

__
Tracker <[EMAIL PROTECTED]>

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



[issue1453] Python does not honor "CFLAGS" environment variable

2007-11-16 Thread Guido van Rossum

Guido van Rossum added the comment:

> Any "standard" way to add custom compilation flags?.

Beats me. I'm no autoconf expert.

--
resolution:  -> wont fix
status: open -> closed

__
Tracker <[EMAIL PROTECTED]>

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



[issue1453] Python does not honor "CFLAGS" environment variable

2007-11-16 Thread Martin v. Löwis

Martin v. Löwis added the comment:

> Any "standard" way to add custom compilation flags?.

See the README. Set OPT to influence the optimization flags;
set EXTRA_CFLAGS otherwise.

__
Tracker <[EMAIL PROTECTED]>

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



[issue1453] Python does not honor "CFLAGS" environment variable

2007-11-16 Thread Miki Tebeka

Miki Tebeka added the comment:

OK, let's close it then.
(However note that in two projects I've checked - vim and pcre the
CFLAGS environment variable do get reflected in the build process)

Any "standard" way to add custom compilation flags?.

__
Tracker <[EMAIL PROTECTED]>

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



[issue1431] pth files not loaded at startup

2007-11-16 Thread Brett Cannon

Brett Cannon added the comment:

Fixed in r59033 for Python 2.6.  Thanks for the help!

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

__
Tracker <[EMAIL PROTECTED]>

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



[issue1454] Generators break trace functionality

2007-11-16 Thread Aldo Cortesi

New submission from Aldo Cortesi:

I rely heavily on a code coverage analysis engine I developed, and a bug
in Python's trace functionality has been bothering me for years. Today I
snapped, and finally tracked it down to a minimal test case. To see the
problem, play with the following code:

import sys

def run(): yield 1

def trace(frame, event, arg):
try:
for i in []: pass
except Exception, e:
pass

sys.settrace(trace)
x = run()
del x

Remove the try clause, and re-run with a debug build of the interpreter
for a different symptom. Add a print statement at the end to verify that
the problem occurs when the generator object is deleted.

The problem occurs due to an interaction between generators and the
trace functionality. When a generator is deleted, the gen_del function
calls gen_close, which then sets a GeneratorExit exception. Eventually,
PyEval_EvalFrameEx is called, with the throwflag set. At this point the
trace function is called, the GeneratorExit exception which is set
causes problems with the FOR_ITER opcode, which then fails.

The attached patch against trunk fixes this by storing exceptions before
the call trace function is called, and restoring the exception
afterwards. All regression tests pass for me with this patch applied.

--
components: Interpreter Core
files: generator-trace.patch
messages: 57598
nosy: cortesi
severity: major
status: open
title: Generators break trace functionality
type: behavior
versions: Python 2.5, Python 2.6
Added file: http://bugs.python.org/file8765/generator-trace.patch

__
Tracker <[EMAIL PROTECTED]>

__Index: Python/ceval.c
===
--- Python/ceval.c	(revision 59033)
+++ Python/ceval.c	(working copy)
@@ -530,6 +530,7 @@
 	register PyObject *t;
 	register PyObject *stream = NULL;/* for PRINT opcodes */
 	register PyObject **fastlocals, **freevars;
+	PyObject *error_type, *error_value, *error_traceback;
 	PyObject *retval = NULL;	/* Return value */
 	PyThreadState *tstate = PyThreadState_GET();
 	PyCodeObject *co;
@@ -700,6 +701,8 @@
 	tstate->frame = f;
 
 	if (tstate->use_tracing) {
+		PyErr_Fetch(&error_type, &error_value, &error_traceback);
+		PyErr_Clear();
 		if (tstate->c_tracefunc != NULL) {
 			/* tstate->c_tracefunc, if defined, is a
 			   function that will be called on *every* entry
@@ -731,6 +734,7 @@
 goto exit_eval_frame;
 			}
 		}
+		PyErr_Restore(error_type, error_value, error_traceback);
 	}
 
 	co = f->f_code;
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com