Re: [Python-Dev] CSV, bytes and encodings

2009-04-01 Thread R. David Murray
On Thu, 2 Apr 2009 at 07:23, Antoine Pitrou wrote: Le mercredi 01 avril 2009 ?? 18:22 -0400, R. David Murray a ??crit : I just added some tests to trunk that seem to indicate this case is handled correctly in terms of preserving the data. Maybe you didn't write the file such that the fields wit

Re: [Python-Dev] CSV, bytes and encodings

2009-04-01 Thread Antoine Pitrou
Le mercredi 01 avril 2009 à 18:22 -0400, R. David Murray a écrit : > I just added some tests to trunk that seem to indicate this case is > handled correctly in terms of preserving the data. Maybe you didn't > write the file such that the fields with the newlines were quoted? I used the default cs

Re: [Python-Dev] CSV, bytes and encodings

2009-04-01 Thread Aahz
On Wed, Apr 01, 2009, s...@pobox.com wrote: > > Antoine> Perhaps. But without using 'rU' the file couldn't be read at > Antoine> all. (I'm not sure it was Windows line endings by the way; > Antoine> perhaps Macintosh ones; anyway, it didn't work using 'rb') > > Please file a bug repo

Re: [Python-Dev] Let's update CObject API so it is safe and regular!

2009-04-01 Thread Guido van Rossum
On Wed, Apr 1, 2009 at 7:58 PM, Larry Hastings wrote: > Guido van Rossum wrote: >> Yeah, any two CAPI objects can be used to play this trick, as long as >> you have some place that calls them. :-( > > FWIW, I can't take credit for this observation.  Neal Norwitz threw me at > this class of problem

Re: [Python-Dev] Let's update CObject API so it is safe and regular!

2009-04-01 Thread Lisandro Dalcin
On Wed, Apr 1, 2009 at 11:58 PM, Larry Hastings wrote: > > Guido van Rossum wrote: >> >> Yeah, any two CAPI objects can be used to play this trick, as long as >> you have some place that calls them. :-( > > FWIW, I can't take credit for this observation.  Neal Norwitz threw me at > this class of p

Re: [Python-Dev] Let's update CObject API so it is safe and regular!

2009-04-01 Thread Larry Hastings
Guido van Rossum wrote: Yeah, any two CAPI objects can be used to play this trick, as long as you have some place that calls them. :-( FWIW, I can't take credit for this observation. Neal Norwitz threw me at this class of problem at the Py3k sprints in August 2007 at Google Mountain View, s

Re: [Python-Dev] PyDict_SetItem hook

2009-04-01 Thread John Ehresman
Collin Winter wrote: Have you measured the impact on performance? I've tried to test using pystone, but am seeing more differences between runs than there is between python w/ the patch and w/o when there is no hook installed. The highest pystone is actually from the binary w/ the patch, wh

Re: [Python-Dev] Let's update CObject API so it is safe and regular!

2009-04-01 Thread Guido van Rossum
On Wed, Apr 1, 2009 at 5:39 PM, Larry Hastings wrote: > > Guido van Rossum wrote: > > This is a bug in cPickle. It calls the PycString_IMPORT macro at the > very end of its init_stuff() function without checking for success. > > > The bug you cite is a genuine bug, but that's not what I'm exploiti

Re: [Python-Dev] PyDict_SetItem hook

2009-04-01 Thread Raymond Hettinger
John Ehresman wrote: * To what extent should non-debugger code use the hook? At one end of the spectrum, the hook could be made readily available for non-debug use and at the other end, it could be documented as being debug only, disabled in python -O, & not exposed in the stdlib to python cod

Re: [Python-Dev] PyDict_SetItem hook

2009-04-01 Thread Christian Heimes
John Ehresman wrote: > * To what extent should non-debugger code use the hook? At one end of > the spectrum, the hook could be made readily available for non-debug use > and at the other end, it could be documented as being debug only, > disabled in python -O, & not exposed in the stdlib to python

Re: [Python-Dev] 3.1a2

2009-04-01 Thread Benjamin Peterson
2009/4/1 Hirokazu Yamamoto : > > Hirokazu Yamamoto wrote: >> >> I added #5499 to release blocker because it needs specification decision. >> (It's too strong?) > > Thank you for fixing this. I also added > > #5391: mmap: read_byte/write_byte and object type > #5410: msvcrt bytes cleanup > > which d

Re: [Python-Dev] 3.1a2

2009-04-01 Thread Hirokazu Yamamoto
Hirokazu Yamamoto wrote: I added #5499 to release blocker because it needs specification decision. (It's too strong?) Thank you for fixing this. I also added #5391: mmap: read_byte/write_byte and object type #5410: msvcrt bytes cleanup which depend on this issue. These are also API spec is

Re: [Python-Dev] Let's update CObject API so it is safe and regular!

2009-04-01 Thread Larry Hastings
Guido van Rossum wrote: This is a bug in cPickle. It calls the PycString_IMPORT macro at the very end of its init_stuff() function without checking for success. The bug you cite is a genuine bug, but that's not what I'm exploiting. % python >>> import _socket >>> _socket.CAPI The PyCObje

Re: [Python-Dev] PyDict_SetItem hook

2009-04-01 Thread Collin Winter
On Wed, Apr 1, 2009 at 4:29 PM, John Ehresman wrote: > I've written a proof of concept patch to add a hook to PyDict_SetItem at >  http://bugs.python.org/issue5654  My motivation is to enable watchpoints in > a python debugger that are called when an attribute or global changes.  I > know that thi

Re: [Python-Dev] Let's update CObject API so it is safe and regular!

2009-04-01 Thread Guido van Rossum
2009/4/1 Larry Hastings : > > Jim Fulton wrote: > > The only type-safety mechanism for a CObject is it's identity.  If you want > to make sure you're using the foomodule api, make sure the address of the > CObject is the same as the address of the api object exported by the module. > > That doesn't

[Python-Dev] Get the standard library to declare the versions it provides!

2009-04-01 Thread Chris Withers
Fred Drake wrote: Even simple cases present issues with regard to this. For example, I work on a project that relies on the uuid module, so we declare a dependency on Ka-Ping Ye's uuid module (since we're using Python 2.4). How should we write that in a version-agnostic way if we want to use

[Python-Dev] PyDict_SetItem hook

2009-04-01 Thread John Ehresman
I've written a proof of concept patch to add a hook to PyDict_SetItem at http://bugs.python.org/issue5654 My motivation is to enable watchpoints in a python debugger that are called when an attribute or global changes. I know that this won't cover function locals and objects with slots (as M

Re: [Python-Dev] Let's update CObject API so it is safe and regular!

2009-04-01 Thread Larry Hastings
Jim Fulton wrote: The only type-safety mechanism for a CObject is it's identity. If you want to make sure you're using the foomodule api, make sure the address of the CObject is the same as the address of the api object exported by the module. That doesn't help. Here's a program that crashes

Re: [Python-Dev] bdb.py trace C implementation?

2009-04-01 Thread Guido van Rossum
On Wed, Apr 1, 2009 at 3:53 PM, Benjamin Peterson wrote: > 2009/4/1 Guido van Rossum : >> Tracing has other uses besides debugging though. > > The OP said he wished to implement a C trace function for bdb. > Wouldn't that make it only applicable to debugging? I honestly don't recall, but I believ

Re: [Python-Dev] bdb.py trace C implementation?

2009-04-01 Thread David Christian
On Wed, Apr 1, 2009 at 6:53 PM, Benjamin Peterson wrote: > 2009/4/1 Guido van Rossum : >> Tracing has other uses besides debugging though. > > The OP said he wished to implement a C trace function for bdb. > Wouldn't that make it only applicable to debugging? > > Benjamin > I was suggesting a spee

Re: [Python-Dev] bdb.py trace C implementation?

2009-04-01 Thread Robert Kern
On 2009-04-01 17:53, Benjamin Peterson wrote: 2009/4/1 Guido van Rossum: Tracing has other uses besides debugging though. The OP said he wished to implement a C trace function for bdb. Wouldn't that make it only applicable to debugging? Once you are at the breakpoint and stepping through the

Re: [Python-Dev] bdb.py trace C implementation?

2009-04-01 Thread Benjamin Peterson
2009/4/1 Guido van Rossum : > Tracing has other uses besides debugging though. The OP said he wished to implement a C trace function for bdb. Wouldn't that make it only applicable to debugging? -- Regards, Benjamin ___ Python-Dev mailing list Python-

Re: [Python-Dev] bdb.py trace C implementation?

2009-04-01 Thread Guido van Rossum
On Wed, Apr 1, 2009 at 3:25 PM, Benjamin Peterson wrote: > 2009/4/1 David Christian : >> Hi all, >> I've recently written a C version of the trace function used in >> figleaf (the coverage tool written by Titus).  After a few rewrites to >> add in caching, etc, it gives users a significant speedup

Re: [Python-Dev] CSV, bytes and encodings

2009-04-01 Thread R. David Murray
OK, Antoine, having merged my newline tests to py3k and having them work when lineend is set to '', as you suggested on the ticket, I'm inclined to agree with you that this is a doc bug. Skip? --David ___ Python-Dev mailing list Python-Dev@python.org h

Re: [Python-Dev] bdb.py trace C implementation?

2009-04-01 Thread Benjamin Peterson
2009/4/1 David Christian : > Hi all, > I've recently written a C version of the trace function used in > figleaf (the coverage tool written by Titus).  After a few rewrites to > add in caching, etc, it gives users a significant speedup.  One person > stated that switching to the C version caused co

Re: [Python-Dev] CSV, bytes and encodings

2009-04-01 Thread R. David Murray
On Wed, 1 Apr 2009 at 10:53, Antoine Pitrou wrote: Perhaps. But without using 'rU' the file couldn't be read at all. (I'm not sure it was Windows line endings by the way; perhaps Macintosh ones; anyway, it didn't work using 'rb') I just tested it in 2.6. It must have been old-mac (\r), which i

[Python-Dev] bdb.py trace C implementation?

2009-04-01 Thread David Christian
Hi all, I've recently written a C version of the trace function used in figleaf (the coverage tool written by Titus). After a few rewrites to add in caching, etc, it gives users a significant speedup. One person stated that switching to the C version caused coverage to decrease from a 442% slowdo

Re: [Python-Dev] Let's update CObject API so it is safe and regular!

2009-04-01 Thread Jim Fulton
On Mar 31, 2009, at 3:14 PM, Larry Hastings wrote: (Thanks for calling my attention to this. :) The CObject API has two flaws. First, there is no usable type safety mechanism. You can store a void *object, and a void *description. There is no established schema for the description; it coul

Re: [Python-Dev] Let's update CObject API so it is safe and regular!

2009-04-01 Thread Larry Hastings
Kristján Valur Jónsson wrote: What are the semantics of the "type" argument for PyCObject_FromVoidPtr()? From the patch, from the documentation comment above the prototype for PyCObject_FromVoidPtr() in Include/cobject.h: The "type" string must point to a legal C string of non-zero len

Re: [Python-Dev] Wing IDE and python.wpr

2009-04-01 Thread Michael Foord
Michael Foord wrote: Hello all, How many are using the Wing IDE to work on core Python? It would be nice to have a 'python.wpr' checked in to trunk, as I have to recreate the project file every time I do a new checkout. Would this be useful for anyone else? Where is a good place for it to liv

Re: [Python-Dev] Let's update CObject API so it is safe and regular!

2009-04-01 Thread Larry Hastings
Brett Cannon wrote: On Tue, Mar 31, 2009 at 20:34, Guido van Rossum > wrote: Can you get Jim Fulton's feedback? ISTR he originated this. I thought Neal started this idea? The earliest revision spotted in "svn blame cobject.[ch]" is 5782: svn log -r 5782 -

[Python-Dev] Wing IDE and python.wpr

2009-04-01 Thread Michael Foord
Hello all, How many are using the Wing IDE to work on core Python? It would be nice to have a 'python.wpr' checked in to trunk, as I have to recreate the project file every time I do a new checkout. Would this be useful for anyone else? Where is a good place for it to live? Littering the top

Re: [Python-Dev] 3to2 Project

2009-04-01 Thread Ron DuPlain
On Mon, Mar 30, 2009 at 9:29 PM, Benjamin Peterson wrote: > 2009/3/30 Collin Winter : >> If anyone is interested in working on this during the PyCon sprints or >> otherwise, here are some easy, concrete starter projects that would >> really help move this along: >> - The core refactoring engine ne

Re: [Python-Dev] issue5578 - explanation

2009-04-01 Thread Jeremy Hylton
Eeek, I think it was me. Part of the AST changes involved raising a SyntaxError when exec was used in a scope that had a free variable, since the behavior is pretty much undefined. If the compiler decides a variable is free, then it can't be assigned to in the function body. The compiled exec co

Re: [Python-Dev] Python 2.6 64-bit Mac Release

2009-04-01 Thread Michael Foord
Ronald Oussoren wrote: On 1 Apr, 2009, at 8:45, Peck, Jon wrote: Apparently the Mac Python 2.6.1 Installer image does not include 64-bit binaries. Is this going to change? Is there some technical reason why these are not included? We are hoping to support that in our next 64-bit release.

Re: [Python-Dev] Python 2.6 64-bit Mac Release

2009-04-01 Thread Ronald Oussoren
On 1 Apr, 2009, at 8:45, Peck, Jon wrote: Apparently the Mac Python 2.6.1 Installer image does not include 64- bit binaries. Is this going to change? Is there some technical reason why these are not included? We are hoping to support that in our next 64-bit release. The 2.6 installer i

Re: [Python-Dev] Let's update CObject API so it is safe and regular!

2009-04-01 Thread Kristján Valur Jónsson
What are the semantics of the "type" argument for PyCObject_FromVoidPtr()? -Does it do a strdup, or is the type required to be valid while the object exists (e.g. a static string)? -How is the type match determined, strcmp, or pointer comparison? -Original Message- From: python-dev-bounce

Re: [Python-Dev] Let's update CObject API so it is safe and regular!

2009-04-01 Thread Brett Cannon
On Tue, Mar 31, 2009 at 20:34, Guido van Rossum wrote: > Can you get Jim Fulton's feedback? ISTR he originated this. > I thought Neal started this idea? -Brett > > On Tue, Mar 31, 2009 at 12:14 PM, Larry Hastings > wrote: > > > > The CObject API has two flaws. > > > > First, there is no usab

Re: [Python-Dev] issue5578 - explanation

2009-04-01 Thread Jeremy Hylton
I posted in the bug report, but repeating here: I don't remember why exec in a nested function changed either. It would help if someone could summarize why we made the change. (I hope I didn't do it <0.2 wink>.) Jeremy On Tue, Mar 31, 2009 at 11:36 PM, Maciej Fijalkowski wrote: > Because clas

Re: [Python-Dev] issue5578 - explanation

2009-04-01 Thread R. David Murray
On Wed, 1 Apr 2009 at 13:12, Chris Withers wrote: Guido van Rossum wrote: Well hold on for a minute, I remember we used to have an exec statement in a class body in the standard library, to define some file methods in socket.py IIRC. But why an exec?! Surely there must be some other way to

[Python-Dev] All Hail the FLUFL

2009-04-01 Thread The Extruder
On behalf of the entire Python community and as CTO of Cheez Whiz Global Conglomerates, Inc. I would like to extend My Thanks to our BDEVIL's many Selfless and Dedicated years of service. I can say without remorse that the State of the Art in the Gas Propelled Cheezical Sciences would be 11 years

[Python-Dev] Python 2.6 64-bit Mac Release

2009-04-01 Thread Peck, Jon
Apparently the Mac Python 2.6.1 Installer image does not include 64-bit binaries. Is this going to change? Is there some technical reason why these are not included? We are hoping to support that in our next 64-bit release. Thanks for your help. Jon K. Peck SPSS Inc. p...@spss.com (

Re: [Python-Dev] CSV, bytes and encodings

2009-04-01 Thread R. David Murray
On Wed, 1 Apr 2009 at 05:37, s...@pobox.com wrote: This case arises rarely, but it does turn up every now and again. If you For some definition of "rarely". I don't handle CVS files generated by Windows very often, but I've run into it a least a couple times. That says to me that it isn't al

Re: [Python-Dev] CSV, bytes and encodings

2009-04-01 Thread skip
Antoine> Perhaps. But without using 'rU' the file couldn't be read at Antoine> all. (I'm not sure it was Windows line endings by the way; Antoine> perhaps Macintosh ones; anyway, it didn't work using 'rb') Please file a bug report and assign to me. Does it work in 2.x? What was the

Re: [Python-Dev] issue5578 - explanation

2009-04-01 Thread Chris Withers
Guido van Rossum wrote: Well hold on for a minute, I remember we used to have an exec statement in a class body in the standard library, to define some file methods in socket.py IIRC. But why an exec?! Surely there must be some other way to do this than an exec? Chris -- Simplistix - Conte

Re: [Python-Dev] Broken import?

2009-04-01 Thread Nick Coghlan
Greg Ewing wrote: > Nick Coghlan wrote: > >> 'import a.b.c' will look in sys.modules for "a.b.c", succeed and work, >> even if "a.b.c" is in the process of being imported. >> >> 'from a.b import c' (or 'from . import c' in a subpackage of "a.b") will >> only look in sys.modules for "a.b", and then

Re: [Python-Dev] Broken import?

2009-04-01 Thread Greg Ewing
Nick Coghlan wrote: 'import a.b.c' will look in sys.modules for "a.b.c", succeed and work, even if "a.b.c" is in the process of being imported. 'from a.b import c' (or 'from . import c' in a subpackage of "a.b") will only look in sys.modules for "a.b", and then look on that object for a "c" att

Re: [Python-Dev] CSV, bytes and encodings

2009-04-01 Thread Antoine Pitrou
pobox.com> writes: > > Antoine> The documentation is, IMO, wrong even in 2.x. Just yesterday I > Antoine> had to open a CSV file in 'rU' mode because it had Windows line > Antoine> endings and I'm under Linux > > See above. You almost certainly didn't have fields containing CRLF

Re: [Python-Dev] Broken import?

2009-04-01 Thread Nick Coghlan
Greg Ewing wrote: > Nick Coghlan wrote: > >> Jim Fulton's example in that tracker issue shows that with a bit of >> creativity you can provoke this behaviour *without* using a from-style >> import. Torsten Bronger later brought up the same issue that Fredrik did >> - it prevents some kinds of expl

Re: [Python-Dev] CSV, bytes and encodings

2009-04-01 Thread skip
>> Having read through the ticket, it seems that a CSV file must be (and >> 2.6 was) treated as a binary file, and part of the CSV module's job >> is to convert that binary data to and from strings. Antoine> IMO this interpretation is flawed. In 2.6 there is no tangible Antoi

[Python-Dev] CSV, bytes and encodings

2009-04-01 Thread Antoine Pitrou
R. David Murray bitdance.com> writes: > > Having read through the ticket, it seems that a CSV file must be (and > 2.6 was) treated as a binary file, and part of the CSV module's job > is to convert that binary data to and from strings. IMO this interpretation is flawed. In 2.6 there is no tangib

Re: [Python-Dev] And the winner is...

2009-04-01 Thread Paul Moore
2009/4/1 Tres Seaver : > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Stephen J. Turnbull wrote: > >> I also just wrote a long post about the comparison of bzr to hg >> responding to a comment on baz...@canonical.com.  I won't recap it >> here but it might be of interest. > > Thank you very