Re: [Python-Dev] doctest and pickle

2013-06-07 Thread Steven D'Aprano

On 08/06/13 15:18, Stephen J. Turnbull wrote:

Ethan Furman writes:

  > Enumerations can be pickled and unpickled::
  >
  >  >>> from enum import Enum
  >  >>> class Fruit(Enum):
  >  ... tomato = 1
  >  ... banana = 2
  >  ... cherry = 3
  >  ...
  >  >>> from pickle import dumps, loads
  >  >>> Fruit.tomato is loads(dumps(Fruit.tomato))
  >  True
  > [...]
  > Still, it would be nice if this could work.

Well, you could cheat and reverse the test. ;-)

I assume the problem is that loads proceeds to recreate the Fruit
enum, rather than checking if there already is one?



I don't believe so. I understand that the problem is that pickle cannot find 
the Fruit enum in the __main__ module.

Untested, but adding this before the call to dumps might work:

import __main__
__main__.Fruit = Fruit


although that's the sort of thing that makes me think it's time to turn this 
into a unittest rather than a doctest.



--
Steven
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] doctest and pickle

2013-06-07 Thread Stephen J. Turnbull
Ethan Furman writes:

 > Enumerations can be pickled and unpickled::
 > 
 >  >>> from enum import Enum
 >  >>> class Fruit(Enum):
 >  ... tomato = 1
 >  ... banana = 2
 >  ... cherry = 3
 >  ...
 >  >>> from pickle import dumps, loads
 >  >>> Fruit.tomato is loads(dumps(Fruit.tomato))
 >  True
 > [...]
 > Still, it would be nice if this could work.

Well, you could cheat and reverse the test. ;-)

I assume the problem is that loads proceeds to recreate the Fruit
enum, rather than checking if there already is one?  Maybe the
metaclass can check somehow?  At the very least, if this can't work in
this implementation, unpickling should be an error.

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


Re: [Python-Dev] [Python-checkins] cpython: Add reference implementation for PEP 443

2013-06-07 Thread PJ Eby
On Fri, Jun 7, 2013 at 5:16 PM, Łukasz Langa  wrote:
> On 7 cze 2013, at 22:50, PJ Eby  wrote:
>
>> On Fri, Jun 7, 2013 at 10:27 AM, Thomas Wouters  wrote:
>>> This isn't a new bug, but it's exposed by always importing weakref and
>>> atexit during interpreter startup. I'm wondering if that's really necessary
>>> :)
>>
>> In short, the overall answer right now is, "maybe", and the answer
>> later is "rather likely".  ;-)
>
> I would rather say that it's "rather certain".
>
> functools is necessary for setup.py to work while bootstrapping, whereas
> pkgutil is used in runpy.py which is always imported in Modules/main.c.
>
> So we're left with having to fix atexit to support subinterpreters. I wonder
> how difficult that will be.

If the problem really has to do with interpreter startup, then there
actually is a workaround possible, at the cost of slightly hairier
code.

If dispatch() looked in the registry *first* and avoided the cache in
that case, and lazily created the cache (including the weakref
import), then interpreter startup would not trigger an import of
weakref in the default case.

(Of course, depending on whether site/sitecustomize results in the use
of importer subclasses and such, this might not help.  It might be
necessary to take the even more complex tack of avoiding the use of a
cache entirely until an ABC is registered, and walking mro's.)

Anyway, it remains to be seen whether these workarounds are easier or
more difficult than fixing the atexit problem.  ;-)

Hmm...  actually, there are a couple other ways around this.
singledispatch doesn't use finalize(), so it doesn't really need
atexit.  It doesn't even do much with WeakKeyDictionary, so it could
actually just "from _weakref import ref", and inline the relevant
operations.

Or, WeakKeyDictionary could be pulled out into a separate module,
where singledispatch could pull it from without importing finalize.

Or, weakref.finalize could be fixed so that the atexit import and
register() are deferred until actual use.

(Of all of these, that last one actually sounds like the least
invasive workaround, with fewest lines of code likely to be changed.)
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] [Python-checkins] cpython: Add reference implementation for PEP 443

2013-06-07 Thread Łukasz Langa
On 7 cze 2013, at 22:50, PJ Eby  wrote:

> On Fri, Jun 7, 2013 at 10:27 AM, Thomas Wouters  wrote:
>> This isn't a new bug, but it's exposed by always importing weakref and
>> atexit during interpreter startup. I'm wondering if that's really necessary
>> :)
> 
> In short, the overall answer right now is, "maybe", and the answer
> later is "rather likely".  ;-)

I would rather say that it's "rather certain".

functools is necessary for setup.py to work while bootstrapping, whereas
pkgutil is used in runpy.py which is always imported in Modules/main.c.

So we're left with having to fix atexit to support subinterpreters. I wonder
how difficult that will be.

-- 
Best regards,
Łukasz Langa

WWW: http://lukasz.langa.pl/
Twitter: @llanga
IRC: ambv on #python-dev

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


Re: [Python-Dev] [Python-checkins] cpython: Add reference implementation for PEP 443

2013-06-07 Thread PJ Eby
On Fri, Jun 7, 2013 at 10:27 AM, Thomas Wouters  wrote:
> This isn't a new bug, but it's exposed by always importing weakref and
> atexit during interpreter startup. I'm wondering if that's really necessary
> :)

Importing it during startup isn't necessary per se; imports needed
only by the generic function implementation can and should be imported
late, rather than at the time functools is imported.

However, if pkgutil was/is migrated to using this implementation of
generics, then it's likely going to end up imported during startup
anyway, because at least the -m startup path involves pkgutil.

In short, the overall answer right now is, "maybe", and the answer
later is "rather likely".  ;-)
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] [Python-checkins] cpython: Add reference implementation for PEP 443

2013-06-07 Thread Łukasz Langa

On 7 cze 2013, at 16:27, Thomas Wouters  wrote:

> 
> On Wed, Jun 5, 2013 at 3:20 AM, lukasz.langa  
> wrote:
> +from weakref import WeakKeyDictionary
> 
> This isn't a new bug, but it's exposed by always importing weakref and atexit 
> during interpreter startup. I'm wondering if that's really necessary :)

We can easily move the import inside singledispatch but I would much rather try 
fixing the actual bug. What do you think?

-- 
Best regards,
Łukasz Langa

WWW: http://lukasz.langa.pl/
Twitter: @llanga
IRC: ambv on #python-dev

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


Re: [Python-Dev] doctest and pickle

2013-06-07 Thread Barry Warsaw
On Jun 07, 2013, at 02:30 PM, PJ Eby wrote:

>I don't know if enums *actually* preserve this invariant, but my
>default expectation of the One Obvious Way would be that enums, being
>uniquely-named objects that know their name and container, should be
>considered global objects in the same fashion as classes and
>functions, *and* that as singletons, they'd also be treated in the
>same way as None, Ellipsis, etc.  That is, there are two independent
>precedents for objects like that preserving "is" upon pickling and
>unpickling.

This is certainly how I thought of them in flufl.enum, and indeed the `is`
test in my own test suite proves that it works.

-Barry
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] doctest and pickle

2013-06-07 Thread Barry Warsaw
On Jun 07, 2013, at 09:06 AM, Ethan Furman wrote:

>Oh, and I just realized this is probably why the flufl.enum docs import from
>a preexisting module instead of creating a new class on the spot.

Exactly. ;)

-Barry
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] doctest and pickle

2013-06-07 Thread Mark Janssen
>> Why are you using is here instead of ==?
>
>
> I'm using `is` because I'm verifying that the instance returned by
> `pickle.loads` is the exact same object as the instance fed into
> `pickle.dumps`.  Enum members should be singletons.

I see now.  That makes sense, but I don't think you'll be able to do
that.  "Supposed to be singletons" while at the same time you are
holding two instances on the interpreter line.   How are you going to
manage that?

-- 
MarkJ
Tacoma, Washington
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] doctest and pickle

2013-06-07 Thread PJ Eby
On Fri, Jun 7, 2013 at 1:54 PM, Mark Janssen  wrote:
> On Fri, Jun 7, 2013 at 10:50 AM, Mark Janssen  
> wrote:
>>> >>> from pickle import dumps, loads
>>> >>> Fruit.tomato is loads(dumps(Fruit.tomato))
>>> True
>>
>> Why are you using is here instead of ==?  You're making a circular
>> loop using "is"
>
> I should add that when you're serializing with pickle and then
> reloading, the objects should be seen as "essentially equivalent".
> This means that they are either byte-by-byte equivalent (not sure
> actually if Python actually guarantees this), or every element would
> still compare equal and that is what matters.

For global objects such as functions and classes -- and singletons
such as None, Ellipsis, True, and False -- pickling and unpickling is
actually supposed to retain the "is" relationship as well.

I don't know if enums *actually* preserve this invariant, but my
default expectation of the One Obvious Way would be that enums, being
uniquely-named objects that know their name and container, should be
considered global objects in the same fashion as classes and
functions, *and* that as singletons, they'd also be treated in the
same way as None, Ellipsis, etc.  That is, there are two independent
precedents for objects like that preserving "is" upon pickling and
unpickling.

(As another precedent, my own SymbolType library (available on PyPI)
preserves the "is"-ness of its named symbol objects upon pickling and
unpickling.)
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] doctest and pickle

2013-06-07 Thread Ethan Furman

On 06/07/2013 10:54 AM, Mark Janssen wrote:

On Fri, Jun 7, 2013 at 10:50 AM, Mark Janssen  wrote:

 >>> from pickle import dumps, loads
 >>> Fruit.tomato is loads(dumps(Fruit.tomato))
 True


Why are you using is here instead of ==?  You're making a circular
loop using "is"


I should add that when you're serializing with pickle and then
reloading, the objects should be seen as "essentially equivalent".
This means that they are either byte-by-byte equivalent (not sure
actually if Python actually guarantees this), or every element would
still compare equal and that is what matters.


In most cases, sure.  But one of the invariants of Enums is that there is only ever one of each member specifically so 
that `is` tests work.


--
~Ethan~
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] [Python-checkins] cpython: Add reference implementation for PEP 443

2013-06-07 Thread Brett Cannon
On Fri, Jun 7, 2013 at 10:27 AM, Thomas Wouters  wrote:

>
> On Wed, Jun 5, 2013 at 3:20 AM, lukasz.langa 
> wrote:
>
>> +from weakref import WeakKeyDictionary
>>
>
> FYI, this change exposes a bug in the atexit module involving
> subinterpreters, causing the refleaks reported by Antoine's daily report:
> interpreter startup now always imports weakref, which imports atexit and
> registers a classmethod. Unfortunately the atexit module doesn't seem to
> know subinterpreters from subtitles and so doesn't unregister this
> classmethod when the subinterpreter is terminated.
>
> This isn't a new bug, but it's exposed by always importing weakref and
> atexit during interpreter startup. I'm wondering if that's really necessary
> :)
>

Is there an issue tracking this?

-Brett


>
>
> --
> Thomas Wouters 
>
> Hi! I'm an email virus! Think twice before sending your email to help me
> spread!
>
> ___
> Python-Dev mailing list
> Python-Dev@python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:
> http://mail.python.org/mailman/options/python-dev/brett%40python.org
>
>
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] doctest and pickle

2013-06-07 Thread Ethan Furman

On 06/07/2013 10:50 AM, Mark Janssen wrote:

 >>> from pickle import dumps, loads
 >>> Fruit.tomato is loads(dumps(Fruit.tomato))
 True


Why are you using is here instead of ==?


I'm using `is` because I'm verifying that the instance returned by `pickle.loads` is the exact same object as the 
instance fed into `pickle.dumps`.  Enum members should be singletons.




You're making a circular loop using "is"


Huh?

--
~Ethan~
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] doctest and pickle

2013-06-07 Thread Ethan Furman

On 06/07/2013 09:54 AM, Olemis Lang wrote:

On 6/7/13, Ethan Furman  wrote:

Is there a doctest mailing list?  I couldn't find it.



JFTR, Testing-in-Python (TiP) ML should be the right target for
general purpose questions about testing, considering docs even for
unittest and doctest
http://lists.idyll.org/listinfo/testing-in-python


Cool, thanks.



[...]

Any advice on how to make it work?

Here's the excerpt:

===
Pickling


Enumerations can be pickled and unpickled::

  >>> from enum import Enum
  >>> class Fruit(Enum):
  ... tomato = 1
  ... banana = 2
  ... cherry = 3
  ...
  >>> from pickle import dumps, loads
  >>> Fruit.tomato is loads(dumps(Fruit.tomato))
  True



... but it seems I'm still getting in tests an instance of Fruit after
invoking loads (do you ?)


I'm not sure what you mean by "an instance of Fruit" -- you should be getting an instance of Fruit; specifically the 
tomato instance.


--
~Ethan~
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] doctest and pickle

2013-06-07 Thread R. David Murray
On Fri, 07 Jun 2013 10:54:57 -0700, Mark Janssen  
wrote:
> On Fri, Jun 7, 2013 at 10:50 AM, Mark Janssen  
> wrote:
> >> >>> from pickle import dumps, loads
> >> >>> Fruit.tomato is loads(dumps(Fruit.tomato))
> >> True
> >
> > Why are you using is here instead of ==?  You're making a circular
> > loop using "is"
> 
> I should add that when you're serializing with pickle and then
> reloading, the objects should be seen as "essentially equivalent".
> This means that they are either byte-by-byte equivalent (not sure
> actually if Python actually guarantees this), or every element would
> still compare equal and that is what matters.

Enums are supposed to be singletons, though, so the 'is' test
is exactly the point of this test.

--David
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] doctest and pickle

2013-06-07 Thread Mark Janssen
On Fri, Jun 7, 2013 at 10:50 AM, Mark Janssen  wrote:
>> >>> from pickle import dumps, loads
>> >>> Fruit.tomato is loads(dumps(Fruit.tomato))
>> True
>
> Why are you using is here instead of ==?  You're making a circular
> loop using "is"

I should add that when you're serializing with pickle and then
reloading, the objects should be seen as "essentially equivalent".
This means that they are either byte-by-byte equivalent (not sure
actually if Python actually guarantees this), or every element would
still compare equal and that is what matters.

-- 
MarkJ
Tacoma, Washington
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] doctest and pickle

2013-06-07 Thread Mark Janssen
> >>> from pickle import dumps, loads
> >>> Fruit.tomato is loads(dumps(Fruit.tomato))
> True

Why are you using is here instead of ==?  You're making a circular
loop using "is"
-- 
MarkJ
Tacoma, Washington
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] doctest and pickle

2013-06-07 Thread Olemis Lang
On 6/7/13, Ethan Furman  wrote:
> Is there a doctest mailing list?  I couldn't find it.
>

JFTR, Testing-in-Python (TiP) ML should be the right target for
general purpose questions about testing, considering docs even for
unittest and doctest
http://lists.idyll.org/listinfo/testing-in-python

[...]
> Any advice on how to make it work?
>
> Here's the excerpt:
>
> ===
> Pickling
> 
>
> Enumerations can be pickled and unpickled::
>
>  >>> from enum import Enum
>  >>> class Fruit(Enum):
>  ... tomato = 1
>  ... banana = 2
>  ... cherry = 3
>  ...
>  >>> from pickle import dumps, loads
>  >>> Fruit.tomato is loads(dumps(Fruit.tomato))
>  True
>

... but it seems I'm still getting in tests an instance of Fruit after
invoking loads (do you ?)

[...]

-- 
Regards,

Olemis.

Apache™ Bloodhound contributor
http://issues.apache.org/bloodhound

Blog ES: http://simelo-es.blogspot.com/
Blog EN: http://simelo-en.blogspot.com/

Featured article:
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] doctest and pickle

2013-06-07 Thread Ethan Furman

Is there a doctest mailing list?  I couldn't find it.


I'm try to use doctest to verify my docs (imagine that!) but I'm having trouble with the one that uses pickle (imagine 
that!).


Any advice on how to make it work?

Here's the excerpt:

===
Pickling


Enumerations can be pickled and unpickled::

>>> from enum import Enum
>>> class Fruit(Enum):
... tomato = 1
... banana = 2
... cherry = 3
...
>>> from pickle import dumps, loads
>>> Fruit.tomato is loads(dumps(Fruit.tomato))
True

The usual restrictions for pickling apply: picklable enums must be defined in
the top level of a module, since unpickling requires them to be importable
from that module.
===

Oh, and I just realized this is probably why the flufl.enum docs import from a preexisting module instead of creating a 
new class on the spot.  Still, it would be nice if this could work.


Any ideas?

--
~Ethan~
___
Python-Dev mailing list
Python-Dev@python.org
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 Python tracker Issues

2013-06-07 Thread Python tracker

ACTIVITY SUMMARY (2013-05-31 - 2013-06-07)
Python tracker at http://bugs.python.org/

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

Issues counts and deltas:
  open4024 (+27)
  closed 25905 (+21)
  total  29929 (+48)

Open issues with patches: 1793 


Issues opened (41)
==

#8902: add datetime.time.now() for consistency
http://bugs.python.org/issue8902  reopened by belopolsky

#17206: Py_XDECREF() expands its argument multiple times
http://bugs.python.org/issue17206  reopened by haypo

#17222: py_compile.compile() replaces target files, breaking special f
http://bugs.python.org/issue17222  reopened by brett.cannon

#18110: Nested set comprehensions in class scope fail
http://bugs.python.org/issue18110  opened by Eric.Wieser

#18111: Add a default argument to min & max
http://bugs.python.org/issue18111  opened by Julian

#18112: PEP 442 implementation
http://bugs.python.org/issue18112  opened by pitrou

#18113: Memory leak in curses.panel
http://bugs.python.org/issue18113  opened by ishimoto

#18114: Update PyImport_ImportFrozenModuleObject() to use importlib
http://bugs.python.org/issue18114  opened by brett.cannon

#18115: Use importlib.util.module_to_load in all loaders in importlib
http://bugs.python.org/issue18115  opened by brett.cannon

#18116: getpass.unix_getpass() always fallback to sys.stdin
http://bugs.python.org/issue18116  opened by Nikratio

#18117: Missing symlink:Current after Mac OS X 3.3.2 package installat
http://bugs.python.org/issue18117  opened by gavan

#18119: urllib.FancyURLopener does not treat URL fragments correctly
http://bugs.python.org/issue18119  opened by takahashi.shuhei

#18121: antigravity leaks subprocess.Popen object
http://bugs.python.org/issue18121  opened by christian.heimes

#18122: RuntimeError: not holding the import lock
http://bugs.python.org/issue18122  opened by arigo

#18123: fnmatchicase for case insensitive file search
http://bugs.python.org/issue18123  opened by techtonik

#18125: Out-of-tree build cannot regenerate Makefile.pre
http://bugs.python.org/issue18125  opened by TBBle

#18126: Update links to NumPy resources in documentation
http://bugs.python.org/issue18126  opened by zaytsev

#18128: pygettext: non-standard timestamp format in POT-Creation-Date
http://bugs.python.org/issue18128  opened by jwilk

#18129: Fatal Python error: Cannot recover from stack overflow.
http://bugs.python.org/issue18129  opened by oscarbenjamin

#18131: Tkinter Variables require a proper master
http://bugs.python.org/issue18131  opened by terry.reedy

#18132: buttons in turtledemo disappear on small screens
http://bugs.python.org/issue18132  opened by JanKanis

#18135: _ssl module: possible integer overflow for very long strings (
http://bugs.python.org/issue18135  opened by haypo

#18136: Put local build paths before system build paths in configure.a
http://bugs.python.org/issue18136  opened by brett.cannon

#18137: format(float, str): integer overflow for huge precision
http://bugs.python.org/issue18137  opened by haypo

#18138: ssl.SSLContext.add_cert()
http://bugs.python.org/issue18138  opened by christian.heimes

#18139: email module should have a way to prepend and insert headers
http://bugs.python.org/issue18139  opened by kbandla

#18140: urlparse.urlsplit confused to fragment when password include #
http://bugs.python.org/issue18140  opened by anh.le

#18141: tkinter.Image.__del__ can throw an exception if module globals
http://bugs.python.org/issue18141  opened by JanKanis

#18142: Tests fail on Mageia Linux Cauldron x86-64 with some configure
http://bugs.python.org/issue18142  opened by shlomif

#18143: ssl.get_default_verify_paths()
http://bugs.python.org/issue18143  opened by christian.heimes

#18144: FD leak in urllib2
http://bugs.python.org/issue18144  opened by Claudio.Freire

#18147: SSL: diagnostic functions to list loaded CA certs
http://bugs.python.org/issue18147  opened by christian.heimes

#18148: Make of Python 3.2.2 fails on Solaris SPARC
http://bugs.python.org/issue18148  opened by eeiddne

#18149: filecmp.cmp() - cache invalidation fails when file modificatio
http://bugs.python.org/issue18149  opened by fbm

#18150: Duplicate test inside TestSingleDispatch
http://bugs.python.org/issue18150  opened by vajrasky

#18151: Idlelib: update to "with open ... except OSError"  (in 2.7, le
http://bugs.python.org/issue18151  opened by terry.reedy

#18152: Idle: add 2.7 backport script
http://bugs.python.org/issue18152  opened by terry.reedy

#18153: python imaplib - error 'unexpected repsonse'
http://bugs.python.org/issue18153  opened by tahnoon

#18154: make install failed on solaris
http://bugs.python.org/issue18154  opened by palm.kevin

#18155: csv.Sniffer.has_header doesn't escape characters used in regex
http://bugs.python.org/issue18155  opened by davechallis

#18156: Add an 'attr' attribute to AttributeError
http://bugs.python.org/issue18156  opened by brett.cannon



[Python-Dev] html documentation and table-of-contents

2013-06-07 Thread Ethan Furman
I just used the build system on the 3.4.0 docs, and some of the library modules (haven't checked the others) have the 
TOC showing up at the bottom of the page instead of the top.


Am I doing something wrong?

--
~Ethan~
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] [Python-checkins] cpython: Issue #17931: Resolve confusion on Windows between pids and process handles.

2013-06-07 Thread Thomas Wouters
On Fri, Jun 7, 2013 at 5:16 PM, Brett Cannon  wrote:

> I think this CL introduced a memory leak. The daily leak report went from
> 0 to not 0 between June 4 and June 5 and this is the only CL that touched C
> code.
>

It wasn't introduced by C code :) The refleak report is induced by the PEP
443 implementation, see my message to python-dev.

-- 
Thomas Wouters 

Hi! I'm an email virus! Think twice before sending your email to help me
spread!
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] [Python-checkins] cpython: Issue #17931: Resolve confusion on Windows between pids and process handles.

2013-06-07 Thread Brett Cannon
I think this CL introduced a memory leak. The daily leak report went from 0
to not 0 between June 4 and June 5 and this is the only CL that touched C
code.


On Wed, Jun 5, 2013 at 6:31 PM, richard.oudkerk
wrote:

> http://hg.python.org/cpython/rev/0410bf251e10
> changeset:   84045:0410bf251e10
> user:Richard Oudkerk 
> date:Wed Jun 05 23:29:30 2013 +0100
> summary:
>   Issue #17931: Resolve confusion on Windows between pids and process
> handles.
>
> files:
>   Include/longobject.h  |  13 +
>   Misc/NEWS |   5 ++---
>   Modules/posixmodule.c |  25 +
>   PC/msvcrtmodule.c |   5 +++--
>   PC/pyconfig.h |   4 ++--
>   5 files changed, 29 insertions(+), 23 deletions(-)
>
>
> diff --git a/Include/longobject.h b/Include/longobject.h
> --- a/Include/longobject.h
> +++ b/Include/longobject.h
> @@ -52,6 +52,19 @@
>  #error "sizeof(pid_t) is neither sizeof(int), sizeof(long) or sizeof(long
> long)"
>  #endif /* SIZEOF_PID_T */
>
> +#if SIZEOF_VOID_P == SIZEOF_INT
> +#  define _Py_PARSE_INTPTR "i"
> +#  define _Py_PARSE_UINTPTR "I"
> +#elif SIZEOF_VOID_P == SIZEOF_LONG
> +#  define _Py_PARSE_INTPTR "l"
> +#  define _Py_PARSE_UINTPTR "k"
> +#elif defined(SIZEOF_LONG_LONG) && SIZEOF_VOID_P == SIZEOF_LONG_LONG
> +#  define _Py_PARSE_INTPTR "L"
> +#  define _Py_PARSE_UINTPTR "K"
> +#else
> +#  error "void* different in size from int, long and long long"
> +#endif /* SIZEOF_VOID_P */
> +
>  /* Used by Python/mystrtoul.c. */
>  #ifndef Py_LIMITED_API
>  PyAPI_DATA(unsigned char) _PyLong_DigitValue[256];
> diff --git a/Misc/NEWS b/Misc/NEWS
> --- a/Misc/NEWS
> +++ b/Misc/NEWS
> @@ -10,9 +10,8 @@
>  Core and Builtins
>  -
>
> -- Issue #17931: Fix PyLong_FromPid() on Windows 64-bit: processes are
> -  identified by their HANDLE which is a pointer (and not a long, which is
> -  smaller).
> +- Issue #17931: Resolve confusion on Windows between pids and process
> +  handles.
>
>  - Tweak the exception message when the magic number or size value in a
> bytecode
>file is truncated.
> diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
> --- a/Modules/posixmodule.c
> +++ b/Modules/posixmodule.c
> @@ -5014,11 +5014,7 @@
>  if (spawnval == -1)
>  return posix_error();
>  else
> -#if SIZEOF_LONG == SIZEOF_VOID_P
> -return Py_BuildValue("l", (long) spawnval);
> -#else
> -return Py_BuildValue("L", (PY_LONG_LONG) spawnval);
> -#endif
> +return Py_BuildValue(_Py_PARSE_INTPTR, spawnval);
>  }
>
>
> @@ -5104,11 +5100,7 @@
>  if (spawnval == -1)
>  (void) posix_error();
>  else
> -#if SIZEOF_LONG == SIZEOF_VOID_P
> -res = Py_BuildValue("l", (long) spawnval);
> -#else
> -res = Py_BuildValue("L", (PY_LONG_LONG) spawnval);
> -#endif
> +res = Py_BuildValue(_Py_PARSE_INTPTR, spawnval);
>
>  while (--envc >= 0)
>  PyMem_DEL(envlist[envc]);
> @@ -6178,16 +6170,17 @@
>  win32_kill(PyObject *self, PyObject *args)
>  {
>  PyObject *result;
> -DWORD pid, sig, err;
> +pid_t pid;
> +DWORD sig, err;
>  HANDLE handle;
>
> -if (!PyArg_ParseTuple(args, "kk:kill", &pid, &sig))
> +if (!PyArg_ParseTuple(args, _Py_PARSE_PID "k:kill", &pid, &sig))
>  return NULL;
>
>  /* Console processes which share a common console can be sent CTRL+C
> or
> CTRL+BREAK events, provided they handle said events. */
>  if (sig == CTRL_C_EVENT || sig == CTRL_BREAK_EVENT) {
> -if (GenerateConsoleCtrlEvent(sig, pid) == 0) {
> +if (GenerateConsoleCtrlEvent(sig, (DWORD)pid) == 0) {
>  err = GetLastError();
>  PyErr_SetFromWindowsErr(err);
>  }
> @@ -6197,7 +6190,7 @@
>
>  /* If the signal is outside of what GenerateConsoleCtrlEvent can use,
> attempt to open and terminate the process. */
> -handle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pid);
> +handle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, (DWORD)pid);
>  if (handle == NULL) {
>  err = GetLastError();
>  return PyErr_SetFromWindowsErr(err);
> @@ -6603,7 +6596,7 @@
>  Py_intptr_t pid;
>  int status, options;
>
> -if (!PyArg_ParseTuple(args, _Py_PARSE_PID "i:waitpid", &pid,
> &options))
> +if (!PyArg_ParseTuple(args, _Py_PARSE_INTPTR "i:waitpid", &pid,
> &options))
>  return NULL;
>  Py_BEGIN_ALLOW_THREADS
>  pid = _cwait(&status, pid, options);
> @@ -6612,7 +6605,7 @@
>  return posix_error();
>
>  /* shift the status left a byte so this is more like the POSIX
> waitpid */
> -return Py_BuildValue("Ni", PyLong_FromPid(pid), status << 8);
> +return Py_BuildValue(_Py_PARSE_INTPTR "i", pid, status << 8);
>  }
>  #endif /* HAVE_WAITPID || HAVE_CWAIT */
>
> diff --git a/PC/msvcrtmodule.c b/PC/msvcrtmodule.c
> --- a/PC/msvcrtmodule.c
> +++ b/PC/msvcrtmodule.c
> @@ -113,11 +113,12 @@
>  static PyObject *
>  msvcrt_open_osfhandle(PyObject *self, PyObject *args)
>

Re: [Python-Dev] [Python-checkins] cpython: Add reference implementation for PEP 443

2013-06-07 Thread Thomas Wouters
On Wed, Jun 5, 2013 at 3:20 AM, lukasz.langa wrote:

> +from weakref import WeakKeyDictionary
>

FYI, this change exposes a bug in the atexit module involving
subinterpreters, causing the refleaks reported by Antoine's daily report:
interpreter startup now always imports weakref, which imports atexit and
registers a classmethod. Unfortunately the atexit module doesn't seem to
know subinterpreters from subtitles and so doesn't unregister this
classmethod when the subinterpreter is terminated.

This isn't a new bug, but it's exposed by always importing weakref and
atexit during interpreter startup. I'm wondering if that's really necessary
:)

-- 
Thomas Wouters 

Hi! I'm an email virus! Think twice before sending your email to help me
spread!
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com