Re: [Python-Dev] Proposed unittest changes

2008-04-25 Thread Michael Foord

Neal Norwitz wrote:

[Michael working on cleaning up the unittest module]

it seems like most of the good ideas have been captured already.  I'll
through two more (low priority) ideas out there.

 1) Randomized test runner/option that runs tests in a random order
(like regrtest.py -r, but for methods)
  


Should be easy enough.


 2) decorator to verify a test method is supposed to fail

#2 is useful for getting test cases into the code sooner rather than
later.  I'm pretty sure I have a patch that implements this
(http://bugs.python.org/issue1399935).  It didn't fit in well with the
old unittest structure, but seems closer to the direction you are
headed.
  



We normally just prefix the test name with 'DONT' so that it isn't 
actually run...



One other idea that probably ought not be done just yet:  add a way of
failing with the test continuing.  We use this at work (not in Python
though) and when used appropriately, it works quite well.  It provides
more information about the failure.  It looks something like this:

  def testMethod(self):
# setup
self.assertTrue(precondition)
self.expectTrue(value)
self.expectEqual(expected_result, other_value)

All the expect methods duplicate the assert methods.  Asserts can the
test to fail immediately, expects don't fail immediately allowing the
test to continue.  All the expect failures are collected and printed
at the end of the method run.  I was a little skeptical about assert
vs expect at first, but it has proven useful in the long run.  As I
said, I don't think this should be done now, maybe later.

n
  

I like this pattern.

Michael Foord
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] segfault in 2.5.1

2008-04-25 Thread Neal Becker
Attempt to write to a mmap which was opened mmap.PROT_READ causes python to
segfault.

___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] segfault in 2.5.1

2008-04-25 Thread Ralf Schmitt
On Fri, Apr 25, 2008 at 3:13 PM, Neal Becker <[EMAIL PROTECTED]> wrote:

> Attempt to write to a mmap which was opened mmap.PROT_READ causes python
> to
> segfault.


 http://bugs.python.org/issue2111
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] mmap documentation error (2.5.1)

2008-04-25 Thread Neal Becker
mmap(  fileno, length[, flags[, prot[, access]]])
(Unix version) Maps length bytes from the file specified by the file
descriptor fileno, and returns a mmap object. If length is 0, the maximum
length of the map will be the current size of the file when mmap() is
called. 
flags specifies the nature of the mapping. MAP_PRIVATE creates a private
copy-on-write mapping, so changes to the contents of the mmap object will
be private to this process, and MAP_SHARED creates a mapping that's shared
with all other processes mapping the same areas of the file. The default
value is MAP_SHARED. 

Apparantly, this is wrong - the default is not MAP_SHARED, as I just found
out the hard way.

___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] mmap documentation error (2.5.1)

2008-04-25 Thread Neal Becker
Sorry, my mistake.  Acutally, I was trying to debug this:
On linux, I don't understand why:

f = open ('/dev/eos', 'rw')
m = mmap.mmap(f.fileno(), 100, prot=mmap.PROT_READ|mmap.PROT_WRITE,
flags=mmap.MAP_SHARED)

gives 'permission denied', but this c++ code works:

#include 
#include 
#include 
#include 
#include 

int main() {
  int fd = open ("/dev/eos", O_RDWR);
  void* m = mmap (NULL, 100, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
  std::cout << m << '\n';
}

___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] mmap documentation error (2.5.1)

2008-04-25 Thread Aahz
On Fri, Apr 25, 2008, Neal Becker wrote:
>
> Sorry, my mistake.  Acutally, I was trying to debug this:

python-dev is probably not the right place for this -- please use c.l.py
or the list capi-sig.
-- 
Aahz ([EMAIL PROTECTED])   <*> http://www.pythoncraft.com/

Why is this newsgroup different from all other newsgroups?  
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] Summary of Tracker Issues

2008-04-25 Thread Tracker

ACTIVITY SUMMARY (04/18/08 - 04/25/08)
Tracker at http://bugs.python.org/

To view or respond to any of the issues listed below, click on the issue 
number.  Do NOT respond to this message.


 1850 open (+26) / 12667 closed (+11) / 14517 total (+37)

Open issues with patches:   558

Average duration of open issues: 707 days.
Median duration of open issues: 1333 days.

Open Issues Breakdown
   open  1828 (+26)
pending22 ( +0)

Issues Created Or Reopened (37)
___

Create ctypes instances from buffer interface04/18/08
CLOSED http://bugs.python.org/issue2655created  theller   
   patch, patch

Autodoc should skip inherited methods04/18/08
   http://bugs.python.org/issue2656created  jmillikin 
   

curses   04/18/08
   http://bugs.python.org/issue2657created  fer_perez 
   

decode_header() fails on multiline headers   04/19/08
   http://bugs.python.org/issue2658created  cschnee   
   

textwrap handling of hyphenation 04/19/08
   http://bugs.python.org/issue2659created  fourmanoit
   patch   

Py3k fails to parse a file with an iso-8859-1 string 04/19/08
   http://bugs.python.org/issue2660created  azverkan  
   

Mapping tests cannot be passed by user implementations   04/19/08
   http://bugs.python.org/issue2661created  danderson 
   

Allows HUGE_VAL as extern variable   04/20/08
CLOSED http://bugs.python.org/issue2662created  ocean-city
   patch   

shutil.copytree glob-style filtering [patch] 04/20/08
   http://bugs.python.org/issue2663created  tarek 
   patch   

The position of special value tables (cmathmodule.c) 04/21/08
   http://bugs.python.org/issue2664created  ocean-city
   patch   

unable to launch IDLE on windows XP  04/21/08
CLOSED http://bugs.python.org/issue2665created  Leo   
   

webbrowser.py doesn't properly handle BROWSER env var04/21/08
   http://bugs.python.org/issue2666created  phd   
   patch   

Remove multiple inheritance in Python 3000   04/22/08
CLOSED http://bugs.python.org/issue2667created  gmarketer 
   

apply() documentation is slightly incorrect  04/22/08
   http://bugs.python.org/issue2668created  belopolsky
   

bsddb iterkeys sliently fails when database modified during iter 04/22/08
   http://bugs.python.org/issue2669created  tebeka
   

urllib2 build_opener() fails if two handlers use the same defaul 04/22/08
CLOSED http://bugs.python.org/issue2670created  tlynn 
   

PyErr_WarnPy3k   04/22/08
   http://bugs.python.org/issue2671created  benjamin.peterson 
   patch   

speed of set.update( 04/23/08
CLOSED http://bugs.python.org/issue2672created  jameinel  
   

error on optparse page   04/23/08
CLOSED http://bugs.python.org/issue2673created  fbe2  
   

unittest.TestProgram uses sys.exit() 

[Python-Dev] Do we still need BaseAddress in .vcproj files?

2008-04-25 Thread Trent Nelson

I just did this locally to all my .vcproj files for .pyds:

-  BaseAddress="0x1e00"
+  RandomizedBaseAddress="2"

This was partly out of curiosity, and partly because it was quicker doing that 
than finding a new unique base address to use for a new module I added to my 
local tree.  Rebuilt everything and ran a full regression test, and everything 
passed.  What am I missing?  Do we have parts of Python that rely on finding 
modules at explicit base addresses?  Is BaseAddress a relic from the past?  
Christian or Martin?

Trent.
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Do we still need BaseAddress in .vcproj files?

2008-04-25 Thread Christian Heimes
Trent Nelson schrieb:
> I just did this locally to all my .vcproj files for .pyds:
> 
> -  BaseAddress="0x1e00"
> +  RandomizedBaseAddress="2"
> 
> This was partly out of curiosity, and partly because it was quicker doing 
> that than finding a new unique base address to use for a new module I added 
> to my local tree.  Rebuilt everything and ran a full regression test, and 
> everything passed.  What am I missing?  Do we have parts of Python that rely 
> on finding modules at explicit base addresses?  Is BaseAddress a relic from 
> the past?  Christian or Martin?


An explicit base address speeds up the loading of shared extension
modules a bit. Checkout PC/dllbase_nt.txt

Christian
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Do we still need BaseAddress in .vcproj files?

2008-04-25 Thread Martin v. Löwis
> This was partly out of curiosity, and partly because it was quicker
> doing that than finding a new unique base address to use for a new
> module I added to my local tree.  Rebuilt everything and ran a full
> regression test, and everything passed.  What am I missing?  Do we
> have parts of Python that rely on finding modules at explicit base
> addresses?  Is BaseAddress a relic from the past?  Christian or
> Martin?

As Christian says: specifying the base address so that the addresses
don't overlap avoids having Windows to perform relocations on startup.

There is a Microsoft tool (editbin /rebase) to compute non-overlapping
base addresses for a given set of DLLs.

Regards,
Martin

___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Do we still need BaseAddress in .vcproj files?

2008-04-25 Thread Atul Varma
A while back I was reading an MSDN article that did some concrete research
on the performance benefits of rebasing DLLs to avoid fixups at runtime, and
it actually concluded that on modern systems, the benefits are really
negligible.  I tried finding the article on the net just now, though, and I
couldn't, so don't take my word for it.  This 1995 MSDN article provides an
explanation and some raw numbers for systems at that time, though:

  http://msdn2.microsoft.com/en-us/library/ms810432.aspx

- Atul

On Fri, Apr 25, 2008 at 2:00 PM, "Martin v. Löwis" <[EMAIL PROTECTED]>
wrote:

> > This was partly out of curiosity, and partly because it was quicker
> > doing that than finding a new unique base address to use for a new
> > module I added to my local tree.  Rebuilt everything and ran a full
> > regression test, and everything passed.  What am I missing?  Do we
> > have parts of Python that rely on finding modules at explicit base
> > addresses?  Is BaseAddress a relic from the past?  Christian or
> > Martin?
>
> As Christian says: specifying the base address so that the addresses
> don't overlap avoids having Windows to perform relocations on startup.
>
> There is a Microsoft tool (editbin /rebase) to compute non-overlapping
> base addresses for a given set of DLLs.
>
> Regards,
> Martin
>
> ___
> Python-Dev mailing list
> [email protected]
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:
> http://mail.python.org/mailman/options/python-dev/varmaa%40gmail.com
>
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] annoying dictionary problem, non-existing keys

2008-04-25 Thread Collin Winter
2008/4/24 bvidinli <[EMAIL PROTECTED]>:
> I posted to so many lists because,
>
>  this issue is related to all lists,
>  this is an idea for python,
>  this is related to development of python...
>
>  why are you so much defensive ?
>
>  i think ideas all important for development of python, software
>  i am sory anyway hope will be helpful.

Please consult the documentation first:
http://docs.python.org/lib/typesmapping.html . You're looking for the
get() method.

This attribute of PHP is hardly considered a feature, and is not
something Python wishes to emulate.

Collin Winter

>  2008/4/24, Terry Reedy <[EMAIL PROTECTED]>:
>
>
> > Python-dev is for discussion of development of future Python.  Use
>  >  python-list / comp.lang.python / gmane.comp.python.general for usage
>  >  questions.
>  >
>  >
>  >
>  >  ___
>  >  Python-Dev mailing list
>  >  [email protected]
>  >  http://mail.python.org/mailman/listinfo/python-dev
>  >  Unsubscribe: 
> http://mail.python.org/mailman/options/python-dev/bvidinli%40gmail.com
>
> >
>
>
>  --
>  İ.Bahattin Vidinli
>  Elk-Elektronik Müh.
>  ---
>  iletisim bilgileri (Tercih sirasina gore):
>  skype: bvidinli (sesli gorusme icin, www.skype.com)
>  msn: [EMAIL PROTECTED]
>  yahoo: bvidinli
>
>  +90.532.7990607
>  +90.505.5667711
>  ___
>
>
> Python-Dev mailing list
>  [email protected]
>  http://mail.python.org/mailman/listinfo/python-dev
>  Unsubscribe: 
> http://mail.python.org/mailman/options/python-dev/collinw%40gmail.com
>
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com